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
62
V 1.0, 2004-02
...
BYTE0MSGm = 0x00;
/* end with writing to data */
/*
byte
0!
*/
•
After resetting the bits RES and IM, the initialization of the device is completed.
MOD
=
0x00;
/* end initialization */
/* 0 0 0 0 0 0 0 0 */
/* ADE RS TC TWL RWL BS RES IM */
6.5.2
The Transmission of a Data Frame / Remote Frame with the
SAE 81C90/91
•
To transmit a
Data Frame
, make sure that you have configured a message
object "n" (e.g. MO 1) that handles Data Frames (RTR = 0) and that carries the right
identifier and the right DLC. Then the data bytes (1 to 8 depending on the
configuration in descriptor byte 0) can be loaded with the desired message (DLC = 4
here):
BYTE3MSGn = 0x33;
/* load data byte 3 obj.n with 33h */
BYTE2MSGn = 0x22;
/* load data byte 2 obj.n with 22h */
BYTE1MSGn = 0x11;
/* load data byte 1 obj.n with 11h */
BYTE0MSGn = 0x00;
/* load data byte 0 obj.n with 00h */
Please take care that writing must end with data byte 0 as mentioned in the previous
section about the initialization of the device.
•
The message is transmitted by setting the bit that corresponds to message object n
in the registers TRSR1 (messages 0 - 7) or TRSR2 (messages 8 - 15), resp.:
TRSRy = 0xdd; /* send mess.; y = 1..2; dd = 01h..FFh */
/* ? ? ? ? ? ? ? ? < Reg. TRSR1*/
/* TRS7 TRS6 TRS5 TRS4 TRS3 TRS2 TRS1 TRS0 */
/* ? ? ? ? ? ? ? ? < Reg. TRSR2*/
/* TRS15 TRS14 TRS13 TRS12 TRS11 TRS10 TRS9 TRS8 */
Several bits may be set simultaneously which results in the transmission of all selected
messages. The message with the highest message object number (e.g. message
object 15, if selected) is sent first. Message object 0 is transmitted at last.