-
Notifications
You must be signed in to change notification settings - Fork 0
Communication Protocol
The Protocol is designed to use a subset of the RS232 serial specification. However, as an alternative to a traditional RS232 serial connection, the device may contain a USB interface that, along with a Virtual Com Port (VCP) driver on the host PC, allows a USB connection to behave as a traditional RS232 port from the point of view of the Logger Interface Software. The communication protocol is binary, full-duplex. There is no hardware or software (XON/XOFF) flow control. The host serial port should be configured for 9600 Baud rate, 8 Bits, No Parity,and 1 Stop Bit.
The device uses binary data rather than ASCII encoded data. A standard device packet (in either direction) is formatted as follows:
| SOT | ID | CMD | N | D1 | ... | Dn | CS | EOT |
|---|
| Name | Decimal | Hex | Function |
|---|---|---|---|
| SOT | 248 | F8 | Start of Transmission. The first byte of a new message. |
| ID | 0-255 |
0-FF |
Detected vehicle identification number. |
| CMD | 0-255 |
0-FF |
Command byte. |
| N | 0-255 |
0-FF |
Number of bytes of data (D1,...,Dn). |
| CS | 0-255 |
0-FF |
Checksum byte ~(ID+CMD+N+D1+...+Dn). |
| EOT | 249 | F9 | End of Transmission. The last byte of a message. |
The meaning of each byte composing packet is as follows:
This signal notifies the beginning of the packet.
It is the ID of the vehicle which passed through the gate. It can use 256 IDs from 0 to 255 (0X00~0XFF).
This command gives an instruction to master and has the following types.
| Value | Name | Function/Content | No. of data bytes | Sender |
|---|---|---|---|---|
| 0x01 | BEGIN | When device is first powered. | 0 | Slave |
| 0x02 | CALIB | When device is re-calibrated by pushing calibration switch. | 1 calibration distance
|
Slave |
| 0x03 | MANUAL | This command force master to take (a) picture frame(s) manually. | 0 | Slave |
| 0x04 | ENTER | When vehicle is entering. | 0 | Slave |
| 0x05 | LEAVE | When vehicle is leaving. | 0 | Slave |
There are also some commands for slave as follows:
| Value | Name | Function/Content | No. of data bytes | Sender |
|---|---|---|---|---|
| 0x06 | ERROR | When an error is received from master | 1 error byte
|
Master |
Which error byte in the above table is interpreted as follows:
| BIT#7 | BIT#6 | BIT#5 | BIT#4 | BIT#3 | BIT#2 | BIT#1 | BIT#0 |
|---|---|---|---|---|---|---|---|
| Res. | Res. | Res. | Res. | Res. | Res. | Res. | Sensor is blocked by an object |
Writing 1 in the corresponding error bit will set an alarm due to an error, similarly writing 0 will clear that alarm.