| поискавой системы для электроныых деталей |
|
AN1105 датащи(PDF) 32 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN1105 датащи(HTML) 32 Page - STMicroelectronics |
|
32 / 100 page ![]() 32/100 ST7 pCAN PERIPHERAL DRIVER example! You can implement a buffer for each message type, a FIFO of standardized buffers etc. Note 2: For safe programming, you should systematically verify whether the buffer is not currently being read/written, and whether the buffer is really free before further processing. (For specific information concerning the buffer data type, see Section 2.1.5.1 "Data-type Var- iables"). Remember that one of the received messages may switch off the cell. Once a message is re- c e i v ed, w e hav e t o c hec k to s ee i f i t i s thi s one . T h i s i s don e us i ng the CAN_Data_Reception_Notification function. CAN_Data_Reception_Notification Function The CAN_Data_Reception_Notification function is the following prototype in can_custom.c. The routine is called once the data in a data frame has been saved in the buffer passed in the CAN_Request_Buffer function. Before calling the CAN_Switch_on function, refresh the watchdog (See “Functions” on page 21, CAN_Switch_Off for further explanation). Let’s add the following code: void CAN_Data_Reception_Notification(u16 message_ident) { if (message_ident==0x6000)//checks the id of message { if (reception_buffer.CAN_msg_data[0]==0xFF)//Checks the content of data { CAN_Switch_Off(BUS_WAKEUP); } } } So, if the first data byte of the message whose identifier is 0x600 contains 0xFF, the cell will switch off and wait for a bus Wake-Up command (a dominant bit). CAN_Remote_Reception_Notification Function When a remote frame is received, we must send a message with a 0x500 ID. Let’s do it inside this routine which is called each time a remote frame is received. The message does not exist yet. As for the buffer, we have to create a variable message, by adding the following code in the file: //////////////////////////////////////// //VARIABLES///////////////////////////// //////////////////////////////////////// CAN_Buffer message_to_send_on_request= / {0x5000,DLC5,{0x00,0x01,0x02,0x03,0x04},CFALSE,CFALSE}; |
|
ссылки URL |
| Вашему бизинису помогли Аллдатащит? [ DONATE ] |
Что такое Аллдатащит | реклама | контакт | Конфиденциальность | Ссылка на техническое описание | обмен ссыками | поиск по производителю 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 |