| Electronic Components Datasheet Search |
|
AN1278 Datasheet(PDF) 30 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN1278 Datasheet(HTML) 30 Page - STMicroelectronics |
|
30 / 44 page ![]() 30/44 LIN (LOCAL INTERCONNECT NETWORK) SOLUTIONS 4.2.1.3 Master data request ( DataRequest_Notification) The application handles one data request from the master corresponding to the identifier 0x20 ( ID_Table[1]). The application has to return a pointer to an array containing the data to be sent. In this example we declare an array “ slave_data[]”. This array will be shared between the application updating it with the last data and the LIN communication sending its contents on request of the master. The corresponding code for the “ DataRequest_Notification” function is: 4.2.1.4 Data reception ( DataReceived_Notification) The application handles 2 “data” frames from the master corresponding to the identifier 0x03 and 0x80. The first frame is part of the “normal” communication. The second frame is a sleep command frame that can be sent by the master at any time to interrupt the normal communi- cation and set all nodes into low power mode. On reception of the first frame the application saves the received data into the variable “ master_data[]“. On reception of the sleep command frame the application sets the ST7 in Halt mode. Before setting the ST7 in Halt mode the wake-up sources should be acitivated. An application func- tion, “PORTS_WakeUp_On()“, is called. Two pins are configured as interrupt and will wake the ST7 up upon a corresponding interrupt request. The first pin is connected to the LIN_RX pin (the SCI RX pin has no interrupt capability). As a result any bus activity will wake the ap- plication up. The second is an application pin that should be also able to wake up the applica- tion. The corresponding code for the “ DataReceived_Notification” function is: Any activity on the bus will wake up the ST7 out of Halt mode. As soon as the ST7 is ready to execute the next instruction any incoming frame can be received. The application can also be woken up by a sensor connected to one pin of the ST7 and then should also wake up the whole LIN network. To do this, a wake-up frame has to be sent, which is done by the “ LIN_SendWakeUpSignal()” function. This function is therefore inserted in the application wake-up interrupt routine: The last point to be configured is the timeout handling and the setting of the corresponding timer, which is timer A. The application software is not using timer A for other purposes. As de- extern uByte slave_data[]; uByte * DataRequest_Notification(@tiny t_header *header) { if(header->identifier == ID_Table[1].id){ return(slave_data); } } |
|
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 |