Professional Documents
Culture Documents
controller area
network (CAN) (5)
Part 5:
a CAN interface using BASIC537
H5
H6
Capacitors:
K3
C1, C3 = 10µF 16V (radial)
000020-1 C2, C4 = 100nF (ceramic)
Semiconductors:
D1 = 1N4001
IC1 = 7805
Miscellaneous:
K1 = 2-way PCB terminal block,
raster 5mm
K2 = 2-way PCB terminal block,
raster 5mm
K1 K3 = boxheader, straight, 16 pins
K4 = pin header, 1 row, 4 pins
C4 K5, K6 = pin header, one row,
IC1 C3
straight, 35 pins
D1
C1
ROTKELE )C(
(C) ELEKTOR
1-020000
000020-1
C2
K2
H7
H8
assume that the controller is driven on the two wires. As soon as the trans-
with the proper signals. mit program is started, data is easily
Now the complete program may be recognized as rectangular signals with
loaded and executed. Experienced as a level of 1 V. The shortest logic levels
you are, you will no doubt have an are just 50 µs long, which means that
oscilloscope ready to observe data traf- the transmission rate is indeed
fic on the bus. Without a connection 20 kBits/s. However, you will not fail to
having been made to a second system, see that there is a quasi-steady datas-
you will be able to find signals on the tream with 2-ms pauses, rather than
data lines. After a hardware reset and short data packets as would be
without an initialisation you will not be expected. Not to worry, however, this
able to find the ‘inactive’ level of 2.5 V is the normal behaviour of the con-
AT THE
RECEIVER SIDE
Now we are ready to ‘deploy’ the
receiver program as given in Listing 2.
This program is for system number 2.
As you can see from the listing, the ini-
tialisation is the same as that used for
the transmitter. As soon as the initiali-
sation is done and the message “Init
OK” has appeared on the PC display,
the transmitting controller will com-
Figure 4. Received
data in the terminal
window of BASIC537.
Figure 5. Reception of
messages with Identi-
fiers (IDs) ‘300’ and
‘500’.