ELM320
OBD Commands
If the bytes received on the RS232 bus do not
begin with the letters A and T, they are assumed to be
commands for the vehicle’s OBD bus. The bytes will
be tested to ensure that they are valid pairs of
hexadecimal digits and, if they are, will be combined
into bytes for transmitting to the vehicle. Recall that no
checks are made as to the validity of the OBD
command – data is simply retransmitted as received.
OBD commands are actually sent to the vehicle
embedded in a data message. The standards require
that every message begin with three header bytes and
end with a checksum byte, which the ELM320 adds
automatically to every message. The ELM320 powers-
on expecting to be used for the OBDII mandated
emissions diagnostics, and sets the header bytes
accordingly. If you wish to perform more advanced
functions, these bytes may be changed through the
use of AT commands. To view the extra bytes that are
received with the vehicle’s messages, turn the header
display on by issuing an ATH1 command.
The command portion of most OBD messages is
usually only one or two bytes in length, but can
occasionally be longer as the standard allows for as
many as seven. The current version of the ELM320
will accept the maximum seven command bytes (or 14
hexadecimal digits) per message, while users of
previous versions (v1.x) were limited to only three
command bytes. In either case, attempts to send more
than the maximum number of bytes allowed will result
in a syntax error, with the entire command being
ignored and a single question mark printed.
The use of hexadecimal digits for all of the data
exchange was chosen as it is the most common data
format used in the relevant SAE standards. It is
consistent with mode request listings and is the most
frequently used format for displaying results. With a
little practice, it should not be very difficult to deal in
hex numbers, but some may initially find the table in
Figure 2 or a calculator to be invaluable. All users will
eventually be required to manipulate the results in
some way, though (combine bytes and divide by 4 to
obtain rpm, divide by 2 to obtain degrees of advance,
etc.), and may find a software front-end more helpful.
As an example of sending a command to the
vehicle, assume that A6 (or decimal 166) is the
command that is required to be sent. In this case, the
user would type the letter A, then the number 6, then
would press the return key. These three characters
would be sent to the ELM320 on the RS232 bus. The
ELM320 would store the characters as they are
received, and when the third character (the carriage
return) is received, begin to assess the other two. It
would see that they are both valid hex digits, and
would convert them to a one byte value (with a
decimal value of 166). Three header bytes and a
checksum byte would be added, so a total of five bytes
would be sent to the vehicle. Note that the carriage
return character is only a signal to the ELM320, and is
not sent on to the vehicle.
After sending a command, the ELM320 listens on
the OBD bus for any responses that are directed to it.
Each received byte is converted to the equivalent
hexadecimal pair of ASCII characters and transmitted
on the RS232 port for the user. Rather than send
control characters which are unprintable on most
terminals, the digits are sent as numbers and letters
(e.g. the hex digit ‘A’ is transmitted as decimal value
65, and not 10).
If there was no response from the vehicle, due to
no data being available, or because the command is
not supported, a ‘NO DATA’ message will be sent. See
the error messages section for a description of this
message and others.
Hexadecimal
Number
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
Decimal
Equivalent
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Figure 2. Hex to Decimal Conversion
ELM320DSC
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
8 of 16