Emsa HS500E Car Stereo System User Manual


 
CHAPTER 6: MODBUS TCP PROTOCOL
6.2 MODBUS TCP HANDSHAKING
Modbus TCP handshaking is governed by the changing of the “Overall Length
value within a data packet. The Overall Length value is typically the first 2-bytes of a
command or response and indicates the total number of data words in the packet
(including one word for the Overall Length value).
Overall Length values are stored in the first holding register, 40001, of Device ID 1
(for commands) and Device ID 33 (for responses). When the value at register 40001
(of Device ID 1) changes from 00, the HS500E will recognize that a command is
waiting to be executed. The HS500E will then execute the command and return a
response at Device ID 33.
6.2.1 Host/HS500E Modbus TCP Handshaking
One implication of this process is that when the Host issues a command, it must first
write the entire command to the holding registers for Device ID 1, leaving the Overall
Length value to be written last.
For example, for the Host to issue the 6-word command “Read Data,” it must first
write the last 5 words of the command to Device ID 1, beginning at register 40002.
L
AST
5
W
ORDS OF A
R
EAD
D
ATA
C
OMMAND
Word MSB LSB Description
02
AA 02 Command ID: Read Data
03
00 01 Node ID
04
03 E8
Timeout Value of 1 second (measured in
ms)
05
00 20 Read Start Address: 0x20
06
00 04 Read 4 Bytes
After writing the last 5 words of the command, the Host will write the Overall Length
value to register 40001 of Device ID 1.
F
IRST
W
ORD OF A
R
EAD
D
ATA
C
OMMAND
Word MSB LSB Description
01
00 06 Overall Length (in words)
The moment the Overall Length value at register 40001 of Device ID 1 changes to a
“non-zero” value, the HS500E will recognize the waiting data and will execute the
command.
HS500E – OPERATOR’S MANUAL P/N: 17-1305 REV02 (12-05)
PAGE 55 OF 82