1 ModbusTCP Communication (Server)
4-2
KW2D Series Smart RFID Reader User’s Manual
■
Data fields
Function code
The number indicating the function.
Contents
This is the data required for the processing specified by the function code.
●
Communication format of Data fields
Read the value of the coil relay or input relay
The host device (ModbusTCP client) reads the value of the coil relay or input relay of the KW2D Smart RFID Reader
(ModbusTCP Server). The number of continuous read bits is 1 to 32 bits. The function code is "01h" for the coil relay
and "02h" for the input relay. In case of error, the function code is "81h" (01h + 80h) for the coil relay and "82h" (02h
+ 80h) for the input relay.
Function code
Description
01(01h)
01: Read the value of coil relay (000001 to 000016)
02(02h)
02: Read the value of input relay (100001 to 100032)
03(03h)
03: Read the value of holding register (400001 to 400032)
04(04h)
04: Read the value of input register (300001 to 300032)
05(05h)
05: Write a value to a coil relay (000001 to 000016)
06(06h)
06: Write a value to a holding register (400001 to 400032)
15(0Fh)
15: Write values to multiple coil relays (000001 to 000016)
16(10h)
16: Write values to multiple holding registers (400001 to 400032)
In the case of an NG response, the value obtained by adding 80h to the function code is stored.
Example: Read 32-bit (4 bytes) of data from input relay 0001.
Input relays 0001 to 0016 are "1234h" and input relays 0017 to 0032 are "5678h"
Example: Try to access an input relay with a slave address outside the range
For details on the error code, refer to "Error code" on page 4-5.
00h
00h
02h
20h
00h
Function code Start address number
Number of bits
of data to read
(
1 byte
)
(
2 bytes
)
(
2 bytes
)
Request
04h
34h
02h
78h
12h
Function code
(
1 byte
)
(
1st byte
)
(
2nd byte
)
(
3rd byte
)
(
4th byte
)
Number
of data
Read value
56h
(
1 byte
)
ACK Reply
Error code
(
1 byte
)
02h
82h
Function code
(
1 byte
)
NAK Reply