UM-0086-A2
CANgate User’s Manual
Page 32
7 RECVJ 1 65226 9.8 9.6 FORMAT "FMI: %x "
8 RECVJ 1 65226 10.7 10.1 FORMAT "Count: %x\n"
END
When polled using
RP 1 8
this might return:
15FF
5E000401
6F000201
5B000401
61000301
6C000401
(lamp)(DTC 1) (DTC 2) (DTC 3) (DTC 4) (DTC 5)
MIL:
0
SPN: 752 FMI: 4 Count: 1
SPN: 888 FMI: 2 Count: 1
In this case five fault codes are active (spaces have been manually inserted in the hex data for clarity).
If CANgate is connected to a data logger then you would typically dispense with the decoding and just return the hex data,
eg:
BEGIN
1 RQSTJ 1 65230 1 1 ' number of fault codes
2 RECVJ 1 65226 ' fault code data
END
The DT80 would then be programmed to regularly poll the slots using
RP 1 2
, then parse the returned hex string and log
individual fault codes.
Using CANgate with a DT8x Data Logger
CANgate can be readily interfaced to a
DT80
series data logger. The supplied host port RS232 cable plugs directly into the
DT80's
serial sensor
port.
The
DT80's
1SERIAL
channel type can then be used to send commands to the CANgate host port and interpret the
responses. Refer to the
DT80 User's Manual
for more information on programming the logger.
The logger program will generally consist of:
a number of immediate schedule
1SERIAL
commands (channel definitions). These are executed once only and
serve to configure CANgate's operating parameters and define the required memory slots.
a number of
1SERIAL
commands within one or more logger schedules – typically one
1SERIAL
command per
parameter of interest. These commands will normally send a poll command (
RP
memslot
) then parse the response
and either log it directly or assign it to a channel variable (CV). As well as polling the pre-defined memory slots, these
commands may also set up a Slot 0 request then poll it and interpret the response.
A typical program structure would be:
BEGIN"CANNY"
' ***** Immediate Schedule (execute once only) *****
' Initialise DT80 port that CANgate is connected to
PS=RS232,57600,8,N,1,HWFC
' Initialise CANgate settings
1SERIAL("{VERBOSE
OFF^M}",W)
1SERIAL("{CONNECT 1 250^M}",W)
1SERIAL("{GPSBAUD
9600^M}",W)
' define CANgate memory slots
1SERIAL("{BEGIN^M}",W)
1SERIAL("{1 RECVJ 1 61444 4 5 256 3 FORMAT .125^M}",W)
1SERIAL("{2 GPS \034GPGLL\034 1 D^M}",W)
1SERIAL("{END^M}",W)
' ***** "A" Schedule (execute once per second) *******
RA1S
1SERIAL("\e{RP
1^M}%f","EngSpd~RPM")
1SERIAL("\e{RP
2^M}%f","Lat-Deg~Degrees")
1SERIAL("\e{RQSTJ 1 65256 3 4 FORMAT 0.00390625; RP^M}%f","NavSpd~km/h")
LOGON
END
Escaping Control Characters
A frequent source of confusion when using
DeTransfer
(dataTaker terminal software), the DT80 serial sensor control
language, and CANgate, is the process of "escaping" control characters. Each of these pieces of software parses input text
strings and performs certain actions when particular characters are seen. For example, CANgate uses the backslash
character to introduce special character sequences, eg
\n
is used to indicate that a CR, LF character sequence should be
inserted into a format string, or
\003
for an ETX character.