| 전자부품 데이터시트 검색엔진 |
|
AN2628 데이터시트(PDF) 13 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN2628 데이터시트(HTML) 13 Page - STMicroelectronics |
|
13 / 27 page ![]() AN2628 Programming through polling 13/27 4 Programming through polling Programming the interrupt driver using polling generates an interrupt whenever a successful transmission or reception occurs. This is done by setting bit SIE of the control register. RXOK or TXOK is (or both are) set when a message object transmits or receives a message. The CAN module sets RXOK whenever a message is acknowledged on the CAN bus. Once in the interrupt routine, the CPU polls bit IntPnd of each message object. The message object polling sequence defines the message object priority, independent of the existing hardware priority scheme defined for IntId. Polling is high in the CPU overhead as the CPU is interrupted every time a message is acknowledged on the CAN bus. Therefore, programming the interrupt driver using polling is recommended for small networks only. This section provides a sample program for programming through polling. // CAN interrupt driver // include <REGF2xxx.h> // standard include file for F27x/F25x #include "CCAN_drvs.h" // inc file to define bit masks and macro // see Section 6 for description. interrupt(0x4x) // CAN Module IR, trap number 0x40, 0x41, 0x43, void CAN_IT (void)// according to user choice see Section 1.1 { unsigned short i; unsigned char status, control; { status = CANxSR;// copy status + control REG to variable control = CANxCR; CANxSR=0; // clear status register XIRxCLR = 0xXX; //flag to be cleared according to user choice //see Section 1.1 CANxIF1CM = 0x7F; // Transfer entire message into interface CANxIF1CR = 1; // register and clear IntPnd and NewDat CANx_WAIT_FOR_IF1; if (CANxIF1MC & IF_INTPND) {.....} // procedure to handle message 1 interrupts .... CANxIF1CM = 0x7F; // Transfer entire message into inference CANxIF1CR = 32; // register and clear IntPnd and NewDat CANx_WAIT_FOR_IF1; if (CANxIF1MC & IF_INTPND) {.....} // procedure to handle message 32 interrupts } |
|
|
링크 URL |
| 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 |