| Electronic Components Datasheet Search |
|
UM0459 Datasheet(PDF) 16 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
UM0459 Datasheet(HTML) 16 Page - STMicroelectronics |
|
16 / 29 page ![]() Controller area network (CAN) routines UM0459 16/29 2.2.10 CAN_SetTxMsgObj function Note: When defining which message object number to use for TX or RX, you must take into account the priority levels when processing the objects. The lowest number (0) has the highest priority and the highest number (31) has the lowest priority, whatever the type of the object. Also, for optimum performance, it is recommended not to have “holes” in the object list. Example: This example illustrates how to define transmit message object 0 of CAN1 with standard identifiers and, how to disable the answer to remote frames with matching ID. { CAN_SetTxMsgObj(CAN1, 0, CAN_STD_ID, DISABLE); } Table 14. CAN_SetTxMsgObj function description Function name CAN_SetTxMsgObj Prototype ErrorStatus CAN_SetTxMsgObj(CAN_TypeDef* CAN, u16 msgobj, u16 idType, FunctionalSate RemotEn) Behavior description Configures the message object to transmit a message object with idType passed as a parameter. This function performs the following operations: – searches for a free message interface from IF0 and IF1. – Sets the WR/RD, Mask, Arb, Control, DataA and DataB bits in the Command Mask register. – Sets the masks to 7FF for standard ID and 0x1FFFFFFF for extended ID. – Sets the Mdir and MXtd – If remote functionality is enabled, then the US_MASK is not set in the message control register in order not to handle the remote frames received – Enables the message object interrupt. – Clears the data registers – Writes 1+msgobj into the command request register to start the transfer to the message RAM. Input parameter 1 CAN: pointer to a CAN1 or CAN2 CAN_TypeDef structure. Input parameter 2 msgobj: message object number, from 0 to 31. Input parameter 3 idType: the identifier type of the frames that will be transmitted using this message object. The value is one of the following: CAN_STD_ID (standard ID, 11-bit) CAN_EXT_ID (extended ID, 29-bit) Input parameter 4 RemoteEN: if enabled, the message object answers remote frames with matching ID. The value is one of the following: ENABLE: To enable the remote functionality DISBALE: To disable the remote functionality Output parameter None Return value An ErrorStatus enumeration value: – SUCCESS: Interface to handle the message – ERROR: No interface to handle the message Required preconditions None Called functions CAN_GetFreeIF() |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |