| 数据搜索系统,热门电子元器件搜索 |
|
AN1105 数据表(PDF) 31 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN1105 数据表(HTML) 31 Page - STMicroelectronics |
|
31 / 100 page ![]() 31/100 ST7 pCAN PERIPHERAL DRIVER We have then to write our code. Look at the last lines of can_custom.h. There is a set of #de- fine options. As we want to be notified neither of status changes, nor of errors, we will leave them as comments. Please see Section 2.1.5.5 "Can_custom.c File" for more details about notification functions. We must then open can_custom.c, and learn how to use the notification functions that are al- ways compiled. If your application uses the watchdog timer, you have to write on top of the file: #include “wdg.h” to be able to use the refresh function in this module. The CAN_Request_Buffer function To retrieve data stored in the ST7 buffers after reception, the application must pass a software buffer when requested. The following prototype is given in the code: CAN_Buffer* CAN_Request_Buffer(u16 ident_of_message) { //The application must here return a pointer to a physical structure CAN_Buffer } This routine is called each time a message has been successfully filtered and is ready to be used. The parameter passed (i.e. the ID of the recovered message) may help you manage your buffer(s) more easily. You then have to create a buffer that will be used to save all data messages. At the top of the file, add: //////////////////////////////////////// //VARIABLES///////////////////////////// //////////////////////////////////////// CAN_Buffer reception_buffer; And then in the function body: CAN_Buffer* CAN_Request_Buffer(u16 ident_of_message) { reception_buffer.buffer_rw=CTRUE; return &reception_buffer; } The two first lines are used as a safety device: the driver will then be sure that the buffer is not currently in use and the data in that buffer can be overwritten. In your programs, use these fields as keys to know whether the data in a buffer can be accessed and whether it has already been processed. Note 1: There is only ONE buffer here that will be used to save all the receive messages. This is only an |
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 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 |