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

X  

AN2341 数据表(PDF) 9 Page - STMicroelectronics

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

AN2341 数据表(HTML) 9 Page - STMicroelectronics

Back Button AN2341 Datasheet HTML 5Page - STMicroelectronics AN2341 Datasheet HTML 6Page - STMicroelectronics AN2341 Datasheet HTML 7Page - STMicroelectronics AN2341 Datasheet HTML 8Page - STMicroelectronics AN2341 Datasheet HTML 9Page - STMicroelectronics AN2341 Datasheet HTML 10Page - STMicroelectronics AN2341 Datasheet HTML 11Page - STMicroelectronics AN2341 Datasheet HTML 12Page - STMicroelectronics AN2341 Datasheet HTML 13Page - STMicroelectronics Next Button
Zoom Inzoom in Zoom Outzoom out
 9 / 26 page
background image
AN2341
Programming through CAN hardware features
9/26
3
Programming through CAN hardware features
Programming the CAN interrupt drivers through CAN hardware features uses bits RXIE and
TXIE in the message control register of each message object. Whenever a message is
transmitted or received by a message object, the corresponding interrupt is serviced
according to its priority (based on the value of IntId). This method uses the hardwired priority
scheme of the CAN module and requires minimum CPU overhead. This section provides a
sample program for programming through CAN hardware features.
Hints:
If the Status Change Interrupt is enabled, the CPU is interrupted every time a message
is acknowledged on the CAN bus. Disable the Status Change Interrupt!
RXOK is cleared by the Status Change Interrupt routine. Therefore, do not use RXOK
to identify the cause of interrupts.
TXOK can be used to identify the cause of an interrupt if the Status Change Interrupt is
disabled and if TXOK is cleared by every interrupt routine of message objects with
direction = ‘transmit’. For clarity, the example below assumes that Status Change
Interrupt is enabled.
There are two ways to use the sample program provided below:
The software interrupt driver repeats itself as long as there is an active interrupt in
the CAN module.
The software driver is run once and handles only one interrupt. This allows the
interrupt controller to re-arbitrate interrupts of the same priority level but not of a
higher priority group.
// 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) void CAN_IT (void)
// CAN Module IR, trap number 0x40, 0x41, 0x43,
// according to user choice, see
Section 1.1
{
XIRxCLR = 0xXX; //flag to be cleared according to user choice
//see
Section 1.1
unsigned char status, intid, control;
while (intid=CANxIR) //reload intid with CANxIR,
// continue loop if intid != 0
//‘while’can be removed to run IT driver once
{
status = CANxSR;// copy status + control REG to variable
control = CANxCR;
CANxSR=0; // clear status register
switch (intid)
{
case 0x8000: // Status Change Interrupt
if (CANxCR & SIE)// if SIE is set (status 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


数据表 下载

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