1 ModbusTCP Communication (Server)
KW2D Series Smart RFID Reader User’s Manual
4-3
4
Co
m
m
un
ica
tio
n F
un
ctio
n
Read the value of the holding register or input register
The host device (ModbusTCP client) reads the value of the holding register or input register of the KW2D Smart RFID
Reader (ModbusTCP Server). The number of continuous read words is 1 to 32 words. The function code is "03h" for
the holding register and "04h" for the input register. In case of error, the function code is "83h" (03h + 80h) for the
holding register and "84h" (04h + 80h) for the input register.
Write the value to the coil relay.
The host device (ModbusTCP client) can write to the coil relay of the KW2D Smart RFID Reader (ModbusTCP Server).
When writing a value to one address number, the function code is "05h". When 0 is written, the value to write will be
"0000h", and when 1 is written, it will be "FF00h". When writing values to multiple consecutive address numbers, the
function code is "0Fh". The value to write is stored in order from the lower bit of the first byte. The function code for
error is "85h" (05h+80h) in the case of writing to one address number, and "8Fh" (0Fh+80h) in the case of writing to
multiple address numbers.
Example: Read data for 32 words from input register 0001
The value of the input register 0001 is "1234h", the value of the input register 0002 is "2345h", ...,
the value of the input register 0032 is "5678h".
Example: Try to access the input register of a slave address outside the range
For details on the error code, refer to "Error code" on page 4-5.
Example: Write 1 to coil relay 0001
Example: Try to access one coil relay with a slave address outside the range.
For details on the error code, refer to "Error code" on page 4-5.
00h
00h
04h
20h
00h
Function code Start address number Number of words of data to read
(
1 byte
)
(
2 bytes
)
(
2 bytes
)
Request
(
63th byte
)
(
64th byte
)
40h
12h
04h
23h
34h
Function code
(
1 byte
)
(
1st byte
)
(
2nd byte
)
(
3rd byte
)
(
4th byte
)
Number of data
Read value
45h
(
1 byte
)
. . .
...
56h
78h
ACK Reply
Error code
(
1 byte
)
02h
84h
Function code
(
1 byte
)
NAK Reply
00h
00h
05h
00h
FFh
Function code Start address number
Value to write
(
1 byte
)
(
2 bytes
)
(
2 bytes
)
Request
Start address number
(
2 bytes
)
(
2 bytes
)
00h
00h
05h
00h
FFh
Function code
(
1 byte
)
Written value
ACK Reply
Error code
(
1 byte
)
02h
85h
Function code
(
1 byte
)
NAK Reply