AP29000
Connecting C166 and C500 Microcontroller to CAN
Ways of handling the SAE 81C90/91 and the CAN Module on the C167CR / C515C
Application Note
52
V 1.0, 2004-02
/* 4 3 2 1 0 |res| (Id.-Bits 1 1 1 9 8 7 6 5 */
/* 0 - 12) 2 1 0 */
/*
⇒
results in the 11-bit identifier "0110
1000
111" */
•
In the respective Message Control Register, the object is declared valid
(MSGVAL = set) and the programmer can decide whether he wants to get an
interrupt on successful reception (RXIE = set) and / or transmission (TXIE = set) of a
frame. As the data bytes of the message object contain unpredictable data at this
time, CPUUPD is set in the transmit objects in order to prevent the object from being
transmitted at this time (e.g. by an incoming Remote Frame). CPUUPD has to be
kept set until the data bytes have been filled with real data. Receive objects do not
have a CPUUPD field. This field is called MSGLST in these objects and is set by the
CAN controller if a new message comes in before the previously received message
has been read out.
Example for a transmit object which shall not generate interrupts:
C167CR:
MCR_Mn = 0x5995;
/* Configure Transmit Object n */
C515C:
MCR0_Mn = 0x95;
/* Configure Transmit Object n */
MCR1_Mn = 0x59;
/* RMTPND = reset;
TXRQ = reset */
/* CPUUPD = set;
NEWDAT = reset */
/* MSGVAL = set;
TXIE = reset */
/* RXIE = reset;
INTPND = reset */
Example for a receive object with interrupt generation on successful reception of a
Data Frame (RXIE = set):
C167CR:
MCR_Mn = 0x5599;
/* Configure Receive Object n */
C515C:
MCR0_Mn = 0x99
/* Configure Receive Object n */
MCR1_Mn = 0x55;
/* RMTPND = reset;
TXRQ = reset */
/* MSGLST = reset;
NEWDAT = reset */
/* MSGVAL = set;
TXIE = reset */
/* RXIE = set;
INTPND = reset */