CHAPTER 2. USBOARD-USS5
2.5. COMMAND SET
The addresses used by the USBoard-USS5 are calculated from the base address by adding the following offsets.
Offset to base address
Function
+0
Receive commands
+1
Answer to
CMD_CONNECT
+2
First answer to
CMD_GET_DATA_1TO8
+3
Second answer to
CMD_GET_DATA_1TO8
+4
First answer to
CMD_GET_DATA_9TO16
+5
2nd answer to
CMD_GET_DATA_9TO16
+6
Answer to
CMD_READ_PARASET
+7
Answer to
CMD_GET_ANALOGIN
+8
Answer to
CMD_WRITE_PARASET
+9
Answer to
CMD_WRITE_PARASET_TO_EEPROM
+13
1st Answer to
CMD_GET_DATA
(group 0: 1 to 4)
+14
2nd Answer to
CMD_GET_DATA
(group 1: 5 to 8)
+15
3rd Answer to
CMD_GET_DATA
(group 2: 9 to 12)
+16
4th Answer to
CMD_GET_DATA
(group 3: 13 to 16)
2.5.3 USB / Serial Interface
Communication via USB is done via a USB-serial-converter on the USBoard-USS5. The computer’s operating system
can access it like a traditional serial interface. On request the USB converter can be replaced by an RS-232 transmitter.
This does not affect the communication protocol of the serial interface.
Note:
The RS-232 interface requires a common ground connection between the USBoard-USS5 and the computer.
The serial interface runs at 19200 Baud. Its protocol has the same format as the CAN communication except for the
following addition:
Every message
from
the USBoard-USS5 begins with a start byte which must have the value
0xFF
. After each mes-
sage, made up of eight data bytes, a 16 bit checksum is sent. Because of this, a complete message is 11 bytes long.
Byte 1
Bytes 2-9
Byte 10
Byte 11
0xFF
data bytes
checksum high byte
checksum low byte
The checksum is calculated with an CRC-CCITT algorithm using 8 databytes.
Messages
to
the USBoard-USS5 only contain the data bytes.
Example implementation of the checksum calulation (C code):
unsigned int
getCheckSum
(
unsigned char
*
c,
size_t
iNumBytes){
unsigned int
uCrc16;
unsigned char
ucData[
2
];
size_t
i;
uCrc16
=
0
;
ucData[
0
]
=
0
;
for
(i
=
0
; i
<
iNumBytes; i
++
){
ucData[
1
]
=
ucData[
0
];
ucData[
0
]
=
c[i];
(continues on next page)
18