AP29002
Standalone TwinCAN Controller
Using special features of the 82C900
Application Note
43
V 1.0, 2004-02
3.9
Using the parallel port as general purpose I/O
If the 82C900 is used in the SSC/SPI mode (Slave or Master), it is possible to
configure the port pin P1-P8 as general purpose I/O port. The function of each pin can
be configured in the registers IOMODE0/2. If the pins are used as input the value can
be read from the register INREG and if the pins are used as output, the value must be
written in the register OUTREG. This can be done by writing directly into the registers
via SPI or CAN-INIT messages or by configuring MSGOBJs as INMSG and OUTMSG.
These MSGOBJ’s are configured in the register CANIO. The OUTMSG must be a
receiving object and the first data byte of each message is written into OUTREG and
INMSG must be an transmitting object. It transmits the value of INREG as the first byte
of the message, if TXRQ is set to ‘10’ e.g. via SPI or with a matching remote frame. So
it is possible to communicate easily with connected peripherals via CAN messages
especially in stand-alone mode.
Application example
For the following example the 82C900 is used in the SSC-slave mode. See the related
chapter for detailed descriptions. The SSC-master is a C167CR on a KitCon167 board.
The 82C900 StarterKit and the KitCon167 board are connected via KitCon-connector.
The port pins P0-P7 of the 82C900 are connected to P2.0-P2.7 of the C167CR.
Therefore wires are used connecting P0-P7 on JP41 and the StarterKit with the pins
for P2.0-P2.7 on the KitCon-connector (pins 85-92).
Note:
In this configuration all jumpers of JP38 must be open!!
Figure 12
Hardware connections for the application example
2 4 M H z
2 2 p F
2 2 p F
8 2 C 9 0 0
M O D E 0
M O D E 1
C T R L 0 - 3
R D Y
S P I - B U S
I O - B u s
P 0 - P 7
/ O U T 0
I N T 0
C 1 6 7 C R
P 3 . 4 / 6 / 8 / 9 / 1 3
P 2 . 0 - P 2 . 7
P 2 . 1 0