79
6 Useful Functions
79
Useful Functions
Chapter
6
04 (0x04) Read Input Registers
The contents of slave input registers are read.
Broadcast cannot be specified.
The start address of the input register and the number of registers are specified.
Slave devices transmit data by converting the contents of each register to 2 bytes.
* N = Number of registers
Example) Reading the contents of gross weight (address 30005 to 30006).
Note that the relative
address is 0x04 when reading the gross weight value.
The indicated value of the F701+ for this example is as follows.
* In function code 04, only the LO words or the HI words are read when the start address specifies
the LO words from a 32-bit integer data area, or the end of the start address + number of registers
specifies HI words from a 32-bit integer data area.
[Request]
Function 1 byte 0x04
Start addr
ess 2 bytes 0x0000 to 0xFFFF
Number of registers 2 bytes 1 to 125 (0x7D)
[Response]
Function 1 byte 0x04
Data bytes 1 byte 2 x N *
Register value N x 2 bytes
[Error response]
Error code 1 byte 0x84 (Function +0x80)
Exception code 1 byte 01 or 02 or 03
[Request]
Function 04
[Response]
Function 04
Start address (HI) 00 Data bytes 04
Start address (LO) 04 Gross weight (HI) (HI) 20
Number of registers (HI) 00 Gross weight (HI) (LO) 00
Numb
er of registers (LO) 02 Gross weight (LO) (HI) 25
Gross weight (LO) (LO) 1C
Weight status Sign OFF (0)
Unused OFF (0)
Unused OFF (0)
OVER OFF (0)
1/4 scale division ▼
OFF (0)
CZ ON (1)
1/4 scale division ▲
OFF (0)
Real CZ OFF (0)
Weight data: 9500 (0x251C)