数据搜索系统,热门电子元器件搜索
  Chinese  ▼
ALLDATASHEETCN.COM

X  

AN2628 数据表(PDF) 13 Page - STMicroelectronics

部件名 AN2628
功能描述  Programming ST10F27x CAN interrupt drivers
PDF  27 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
制造商  STMICROELECTRONICS [STMicroelectronics]
网页  http://www.st.com
标志 STMICROELECTRONICS - STMicroelectronics

AN2628 数据表(HTML) 13 Page - STMicroelectronics

Back Button AN2628 Datasheet HTML 9Page - STMicroelectronics AN2628 Datasheet HTML 10Page - STMicroelectronics AN2628 Datasheet HTML 11Page - STMicroelectronics AN2628 Datasheet HTML 12Page - STMicroelectronics AN2628 Datasheet HTML 13Page - STMicroelectronics AN2628 Datasheet HTML 14Page - STMicroelectronics AN2628 Datasheet HTML 15Page - STMicroelectronics AN2628 Datasheet HTML 16Page - STMicroelectronics AN2628 Datasheet HTML 17Page - STMicroelectronics Next Button
Zoom Inzoom in Zoom Outzoom out
 13 / 27 page
background image
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
}



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27


数据表 下载

Go To PDF Page


链接网址



ALLDATASHEET是否为您带来帮助?  [ DONATE ] 

关于 Alldatasheet   |   广告服务   |   联系我们   |   隐私政策   |   数据表链接    |   链接交换   |   制造商名单
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
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