ADwin-light-16
, manual version 2.2, December 2004
35
DIO1 Add-On
ADwin
Programming example
8.3 CAN-Bus
The add-on board DIO1 has a CAN bus interface for the high-speed CAN pro-
tocol. The connections are available on a 9-pin D-SUB connector (male); the
pin assignment can be found on page 25.
Bus termination
The CAN bus has to be terminated at its physical end (and only there) by a
resistor, that means only at the first and the last CAN node. This is made by set-
ting a corresponding DIP switch on the DIO1 printed circuit board. (see Fig. 23
– Position of the DIP switches on the DIO1 PCB). If a termination is necessary,
set the DIP switch toward the CAN connector.
8.3.1 Functions of the CAN controller
The CAN bus interface is equipped with the Intel
®
CAN controller AN82527
which works according to the specification CAN 2.0 parts A and B as well as
to ISO 11898. You program the interface with
ADbasic
instructions, which are
directly accessing the controller’s registers.
Message
Messages sent via CAN bus are data telegrams with up to 8 bytes, which are
characterized by so-called identifiers. The CAN controller of the DIO1 add-on
supports identifiers with a length of 11 bit and 29 bit. The communication, that
means the management of bus messages, is effected by 15 message objects.
The 255 registers are used for configuration and status display of the CAN con-
troller. Here the bus speed and interrupt handling, etc. are set (see separate
documentation "82527 - Serial Communications Controller, Architectural Over-
view" by Intel
®
)
initialize
disable counter
clear counter
mode internal reference clock at internal CLK
input of the counter ...
... with 20 MHz or
... with 5 MHz
set input CLR/LATCH to LATCH mode
enable counter
read latch A
read latch B
evaluation in the program
INIT:
CNT_ENABLE(0)
CNT_CLEAR(1)
CNT_MODE(1)
CNT_INPUTMODE(1)
CNT_ENABLE(1)
. . .
. . .
CNT_SET(0)
CNT_SET(1)
EVENT:
CNT_READLATCH(1)
CNT_READFLATCH(1)
. . .