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
40
V 1.0, 2004-02
6
Ways of handling the SAE 81C90/91 and the CAN
Module on the C167CR / C515C
6.1
Notes on the following Sections
The following sections contain important hints necessary for establishing a
communication via the CAN bus using the devices described above. The program
parts are mainly written in "C". They show just
one
way to solve a certain problem and
they don't claim for optimized code. For better understanding the reader should also
refer to the Infineon information "Description of the On-Chip CAN-Module", the
SAE 81C90/91 Data Sheet, and the C515C User's Manual.
6.2
Accessing the Registers of the CAN Module and the
SAE 81C90/91
To access the registers of the CAN module and the SAE 81C90/91, the registers have
been given names that show the task of the respective register. Via pointer these
names have been connected with the respective address in three include files.
Therefore, in the software hints, not "address EF04h of the C167CR" is accessed but
"directly" the register "BTR" (the Bit Timing Register). Those registers, which appear
more than once (e.g. in each message object) are given the name adder "_M1", "_M2"
etc. for message object 1, 2 etc. Another possibility would be to define the message
objects as "structures" ("MOBJ1", "MOBJ2",...) to then access for example the
Message Control Register of message object 5 with "MOBJ5.MCR".
Extract from the include file for the C167CR:
/* Register
Address
*/
#define
CSR
*(unsigned int *)
0xef00
#define
IR
*(unsigned char*)
0xef02
#define
BTR
*(unsigned int *)
0xef04
#define
GMS
*(unsigned int *)
0xef06
#define
UGML
*(unsigned int *)
0xef08
#define
LGML
*(unsigned int *)
0xef0a
#define
UMLM
*(unsigned int *)
0xef0c
#define
LMLM
*(unsigned int *)
0xef0e
#define
MCR_M1 *(unsigned int *)
0xef10
#define
UAR_M1 *(unsigned int *)
0xef12
#define
LAR_M1 *(unsigned int *)
0xef14
#define
MCFG_M1 *(unsigned char*)
0xef16
#define
DB0_M1 *(unsigned char*)
0xef17
#define
DB1_M1 *(unsigned char*)
0xef18
#define
DB2_M1 *(unsigned char*)
0xef19