Electronic Components Datasheet Search
  New Zealand  ▼
ALLDATASHEET.CO.NZ

X  

AN2341 Datasheet(PDF) 9 Page - STMicroelectronics

Part # AN2341
Description  Programming ST10F27x/F25x CAN interrupt drivers
PDF  26 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  STMICROELECTRONICS [STMicroelectronics]
Direct Link  http://www.st.com
Logo STMICROELECTRONICS - STMicroelectronics

AN2341 Datasheet(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


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
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