46
9.11 Packet Structure Reply (from controlled device)
ASCII
Value
STX
02h
Start byte
0-9
30h-39h
4 byte unit address. In range 0-9999
Z
20h-7Eh
Status BYTE
PQR
20h-7Eh
Data –Optional, variable length
;
3Bh
Separator
X
20h-7Eh
Sum Check
ETX
03h
End byte
The Sum check byte is the summation of all bytes in the packet, not
including the start and end bytes. Higher order bytes are ignored and
the final byte result is modified to prevent ASCII control characters being
sent. Bit 7 (highest) is forced high.
Status byte will indicate command performed OK, or indicate an error.
ASCII
Meaning
1
All OK
E
General error, Command could not be actioned
Typically E will be returned if the message is formatted incorrectly
(separators in wrong place) or if commands are in upper case, or if
commands do not match against the allowed list of commands, or if the
checksum is wrong.
Addresses in the range 0001 to 9998 are for general use. Address 0000
is reserved and 9999 is a broadcast address. i.e. any device will reply to
this address. Its reply will contain its own specific address.
All data in the transmitter and receiver is stored as one of 5 data types,
Double, String, List, Integer or HexInteger. The data type dictates the
contents of the data section of the reply.
•
List – 1 byte for sending. Value is hexadecimal coded as ASCII. 2 byte
reply. Reply represents index into original choice list. e.g. Reply 02
indicates entry 2 in original list.
•
Double - variable length. Reply always contains decimal point and 4
decimal places. Can have 1 to 3 digits before decimal.
•
Integer - 6byte reply. integer value with stuffed with preceding zeros.
e.g. GOP reply 000012 = GOP length 12
•
String - Variable length. Reply is string excluding null terminator
•
HexInteger – 8byte Hex reply