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 54 V 1.0, 2004-02
Now the CAN module waits for 11 consecutive recessive bits on the CAN bus (bus
idle) and can then participate in the bus communication.
6.4.2 The Transmission of a Data Frame with the CAN Module
Make sure that you have configured a valid message object as transmit object
(DIR=1). Before the next transmission, the TXOK bit in the Control Register which may
be still set from the last successful transmission can be reset.
C167CR:
CSR &= 0xFFF7; /* Reset TXOK */
C515C:
SR &= 0xF7; /* Reset TXOK */
Then "CPUUPD" (CPU Update) and "NEWDAT" (New Data) of the transmit object's
corresponding Message Control Register should be set to show that the CPU now
wants to work on the data bytes of this transmit object.
C167CR:
MCR_Mn = 0xFAFF; /* Set CPUUPD and NEWDAT */
C515C:
MCR1_Mn = 0xFA; /* Set CPUUPD and NEWDAT */
/* RMTPND = unchanged; TXRQ = unchanged */
/* CPUUPD = set; NEWDAT = set */
/* MSGVAL = unchanged; TXIE = unchanged */
/* RXIE = unchanged; INTPND = unchanged */
Now the data byte(s) (1-8 referring to the DLC field in the Message Configuration
Register) can be filled with the respective message (DLC = 4 here):
C167CR / C515C:
DB0_Mn = 0x00; /* load data byte 0 with 00H */
DB1_Mn = 0x11; /* load data byte 1 with 11H */
DB2_Mn = 0x22; /* load data byte 2 with 22H */
DB3_Mn = 0x33; /* load data byte 3 with 33H */