| Electronic Components Datasheet Search |
|
AN1278 Datasheet(PDF) 29 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN1278 Datasheet(HTML) 29 Page - STMicroelectronics |
|
29 / 44 page ![]() 29/44 LIN (LOCAL INTERCONNECT NETWORK) SOLUTIONS 4.2.1.2 lin_ai.c The first part of the lin_ai.c code is the definition of the LIN frames the application has to handle. Out of the 4 defined for the whole network the application handles the 3 following frames: The corresponding setting of “ ID_Table” is: const t_id_list ID_Table[]= { {0x03, ID_DATASENT, 2}, {0x20, ID_DATAREQUEST, 4}, {0x80, ID_DATASENT, 8} }; The second part of the lin_ai.c code consists of 3 notification functions and is the kernel of the LIN communication. Filling the notification functions enables you to define the behaviour of the application upon a master data request ( DataRequest_Notification function) upon the recep- tion of data from the master ( DataReceived_Notification function) and upon errors ( Error_Notification function). Timeouts One output compare of one timer is needed for the timeouts han- dling. We choose the output com- pare 1 of timer A. So “TIMEOUT_TIMERA” and “TIMEOUT_OC1” are defined. #define TIMEOUT_TIMERA //#define TIMEOUT_TIMERB #define TIMEOUT_OC1 //#define TIMEOUT_OC2 LIN baudrate The example LIN baudrate is 9600 Baud. #define BAUDRATE 9600 SCI peripheral registers See Table 8. Example of (BRR,ExPR) values versus baudrate and fCPU. //#define BRR 0xC9 //#define ExPR 0x00 Number of LIN frames to be han- dled The network communication con- sists of 4 LIN frames. The appli- cation example handles 3 of them: DataToSlave1, RequestToSlave1 and SleepMo- deCommand. #define ID_TABLE_SIZE 3 Resynchronization Not supported using the on-chip SCI peripheral. “RESYNCH” is commented out. //#define RESYNCH Frame name Identifier ID[7..0] Message Length Data Direction DataToSlave1 0x03 2 master to slave1 RequestToSlave1 0x20 4 slave1 to master SleepModeCommand 0x80 2 master to all slaves |
|
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 |