5.3.1.2 Read Coil Status (function code 0x01):
This function reads the status of the input and output bits (coils) in slave, whereby broadcast is not supported. With coupler/controller the number of I/O points is limited to 256.
Inquiry:
яюэьыъщэш The Inquiry determines the starting address and the number of bits to be read.
The first point is addressed with 0. With Modicon the addressing starts with 1 (0x01).
The following table shows an example for an inquiry, with which the bits 0 to 7 of the slaves 11 are to be read:
Field name |
Example |
RTU |
ASCII |
|
Start of frame |
- |
t1-t2-t3 |
”:” |
0x3a |
Slave address |
0x0B |
0x0B |
”0B” |
0x30, 0x42 |
Function code |
0x01 |
0x01 |
”01” |
0x30, 0x31 |
Starting address high |
0x00 |
0x00 |
”00” |
0x30, 0x30 |
Starting address low |
0x00 |
0x00 |
”00” |
0x30, 0x30 |
Number of points high |
0x00 |
0x00 |
”00” |
0x30, 0x30 |
Number of points low |
0x08 |
0x08 |
”08” |
0x30, 0x38 |
Error Check (LRC / CRC) |
- |
0x3D |
”EC” |
0x45, 0x43 |
|
|
0x66 |
|
|
End of frame |
|
t1-t2-t3 |
- |
0xD, 0xA |
Table 5.30: Inquiry example, Read Coil Status |
|
|
|
|
Reply:
The current values of the interrogated bits are packed in the data field. A 1 corresponds to the ON status and a 0 to the OFF status. The lowest value bit of the first data byte contains the first bit of the inquiry. The others follow in an ascending order. If the number of inputs are not a multiple of 8, the remaining bits of the last data byte are filled with zeroes. If the number of bits interrogated exceed the number of inputs or outputs present in the node, the remaining input bits are set to zero and the outputs contain the last valid value.
Field name |
Example |
RTU |
ASCII |
|
Start of frame |
- |
t1-t2-t3 |
”:” |
0x3A |
Slave address |
0x0B |
0x0B |
”0B” |
0x30, 0x42 |
Function code |
0x01 |
0x01 |
”01” |
0x30, 0x31 |
Byte Count |
0x01 |
0x01 |
”01” |
0x30, 0x31 |
Data (point 8...0) |
0x12 |
0x12 |
”12” |
0x31, 0x32 |
Error Check (LRC / CRC) |
- |
0xD2 |
”E1” |
0x45, 0x31 |
|
|
0x5D |
|
|
End of frame |
- |
t1-t2-t3 |
- |
0xD, 0xA |
Table 5.31: Reply example, Read Coil Status
MODBUS / Configuration |
55 |
15.12.99
The status of the inputs 7 to 0 is shown as byte value 0x12 or binary 0001 0010. Input 7 is the bit having the highest valency of this byte and input 0 the lowest value.
The assignment is thus made from 7 to 0 with OFF-OFF-OFF-ON-OFF-Off-ON-OFF.
Bit: |
0 |
0 |
0 |
1 |
0 |
0 |
1 |
0 |
Coil: |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
56 |
MODBUS / Configuration |
15.12.99
5.3.1.3 Read Input Status (function code 0x02):
This function reads the input bits in the slave, whereby broadcast is not supported. With the coupler/controller the number of points is limited to 256.
Inquiry:
The inquiry determines the starting address and the number of bits to be read. яюэьыъщэш The first point is addressed with 0. With Modicon addressing starts with 1 (0x01).
The following table shows an example of an inquiry with which the bits 0 to 7 of the slaves 11 are to be read:
Field name |
Example |
RTU |
ASCII |
|
Start of frame |
- |
t1-t2-t3 |
”:” |
0x3a |
Slave address |
0x0B |
0x0B |
”0B” |
0x30, 0x42 |
Function code |
0x02 |
0x02 |
”02” |
0x30, 0x32 |
Starting address high |
0x00 |
0x00 |
”00” |
0x30, 0x30 |
Starting address low |
0x00 |
0x00 |
”00” |
0x30, 0x30 |
Number of points high |
0x00 |
0x00 |
”00” |
0x30, 0x30 |
Number of points low |
0x08 |
0x08 |
”08” |
0x30, 0x38 |
Error Check (LRC / CRC) |
- |
0x79 |
”EC” |
0x45, 0x42 |
|
|
0x66 |
|
|
End of frame |
|
t1-t2-t3 |
- |
0xD, 0xA |
Table 5.32: Example inquiry, Read Input Status |
|
|
|
|
Reply:
The current value of the inquired bit is packed into the data field. A 1 corresponds to the ON status and a 0 the OFF status. The lowest value bit of the first data byte contains the first bit of the inquiry. The other follow in an ascending order. If the number of inputs are not a multiple of 8, the remaining bits of the last data byte are filled with zeroes. If the number of bits interrogated exceed the number of inputs present in the node, the remaining input bits are set to zero.
Field name |
Example |
RTU |
ASCII |
|
Start of frame |
- |
t1-t2-t3 |
”:” |
0x3A |
Slave address |
0x0B |
0x0B |
”0B” |
0x30, 0x42 |
Function code |
0x02 |
0x02 |
”02” |
0x30, 0x32 |
Byte Count |
0x01 |
0x01 |
”01” |
0x30, 0x31 |
Data (point 8...0) |
0x12 |
0x12 |
”12” |
0x31, 0x32 |
Error Check (LRC / CRC) |
- |
0x22 |
”E0” |
0x45, 0x30 |
|
|
0x5D |
|
|
End of frame |
- |
t1-t2-t3 |
- |
0xD, 0xA |
Table 5.33: Example reply, Read Input Status
MODBUS / Configuration |
57 |
15.12.99
The status of the inputs 7 to 0 is shown as a byte value 0x12 or binary 0001 0010. Input 7 is the bit having the highest valency of this byte and input 0 the lowest value.
The assignment is thus made from 7 to 0 with OFF-OFF-OFF-ON-OFF-Off-ON-OFF.
Bit: |
0 |
0 |
0 |
1 |
0 |
0 |
1 |
0 |
Coil: |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
58 |
MODBUS / Configuration |
15.12.99
5.3.1.4 Read Holding Register (function code 0x03)
The binary contents of holding registers are read out in the slave using this function. Broadcast is not supported. The maximum number is limited to 128 registers in one frame.
Inquiry:
The inquiry determines the start word address (start register) and the number the register to be read.
яюэьыъщэш |
The addressing starts with 0. The Modicon address starts with 1 (0x01). |
|
|
|
Example for an inquiry of the registers 0 and 1 of slave 11: |
Field name |
Example |
RTU |
ASCII |
|
Start of frame |
- |
t1-t2-t3 |
”:” |
0x3a |
Slave address |
0x0B |
0x0B |
”0B” |
0x30, 0x42 |
Function code |
0x03 |
0x03 |
”03” |
0x30, 0x33 |
Starting address high |
0x00 |
0x00 |
”00” |
0x30, 0x30 |
Starting address low |
0x00 |
0x00 |
”00” |
0x30, 0x30 |
Number of points high |
0x00 |
0x00 |
”00” |
0x30, 0x30 |
Number of points low |
0x02 |
0x02 |
”02” |
0x30, 0x32 |
Error Check (LRC / CRC) |
- |
0xC4 |
”F0” |
0x46, 0x30 |
|
|
0xA1 |
|
|
End of frame |
|
t1-t2-t3 |
- |
0xD, 0xA |
Table 5.34: Example inquiry, Read Holding Register
Reply:
The reply register data is packed as 2 bytes per register. The first byte contains the higher value bits, the second the lower values. A reply to the above inquiry appears as follows:
Field name |
Example |
RTU |
ASCII |
|
Start of frame |
- |
t1-t2-t3 |
”:” |
0x3A |
Slave address |
0x0B |
0x0B |
”0B” |
0x30, 0x42 |
Function code |
0x03 |
0x03 |
”03” |
0x30, 0x33 |
Byte Count |
0x04 |
0x04 |
”04” |
0x30, 0x34 |
Data Hi (Register 0) |
0x3F |
0x3F |
”3F” |
0x33, 0x46 |
Data Lo (Register 0) |
0xFB |
0xFB |
”FB” |
0x46, 0x42 |
Data Hi (Register 1) |
0x00 |
0x00 |
”00” |
0x30, 0x30 |
Data Lo (Register 1) |
0x00 |
0x00 |
”00” |
0x30, 0x30 |
Error Check (LRC / CRC) |
- |
0x2D |
”B4” |
0x42, 0x34 |
|
|
0x61 |
|
|
End of frame |
- |
t1-t2-t3 |
- |
0xD, 0xA |
Table 5.35: Example reply, Read Holding Register
The contents of register 0 is displayed hexadecimal by two byte values: 0x3F and 0xFB or 16379 decimal. The contents of register 1 are 0x00 and 0x00 or 0 decimal.
MODBUS / Configuration |
59 |
15.12.99