Force Multiple Coils (Function 15)
The Force multiple coils function can be used to set or reset a number of digital outputs at the same time.
The first 20 digital outputs are written in this example. The digital outputs start at an offset of 0x0000. Here the offset always describes a bit. Offset 0x0003 writes to the fourth bit in the output process image. The length indicates the number of bits, and the Byte count is formed from the combination all the bytes that are to be written.
Example: 20 bits yield a byte count of 3 (rounded up to a byte boundary).
The data bytes contain the values for the individual bits. In this example, bits 0 to 15 are set to TRUE, while bits 16 to 23 are FALSE.
Query
Byte Name |
Modbus RTU |
Modbus ASCII | ||
---|---|---|---|---|
Start - Frame |
- |
- |
":" |
0x3A |
Address |
11 |
0x0B |
"0B" |
0x30, 0x42 |
Function-Code |
15 |
0x0F |
"0F" |
0x30, 0x46 |
Start-Address high |
0 |
0x00 |
"00" |
0x30, 0x30 |
Start-Address low |
0 |
0x00 |
"00" |
0x30, 0x30 |
Length high |
0 |
0x00 |
"00" |
0x30, 0x30 |
Length low |
20 |
0x14 |
"14" |
0x31, 0x34 |
Byte Count |
3 |
0x03 |
"03" |
0x30, 0x33 |
Data 1 Bit 0..7 |
255 |
0xFF |
"FF" |
0x46, 0x46 |
Data 2 Bit 8..15 |
255 |
0xFF |
"FF" |
0x46, 0x46 |
Data 3 Bit 16..23 |
0 |
0x00 |
"00" |
0x30, 0x30 |
Error Check, LRC/CRC |
|
0x01, 0x95 |
"D1" |
0x44, 0x31 |
End - Frame |
|
t1-t2-t3 |
CRLF |
0x0D, 0x0A |
Response
The Bus Coupler answers with the same telegram.
Byte Name |
Modbus RTU |
Modbus ASCII | ||
---|---|---|---|---|
Start - Frame |
- |
- |
":" |
0x3A |
Address |
11 |
0x0B |
"0B" |
0x30, 0x42 |
Function-Code |
15 |
0x0F |
"0F" |
0x30, 0x46 |
Start-Address high |
0 |
0x00 |
"00" |
0x30, 0x30 |
Start-Address low |
0 |
0x00 |
"00" |
0x30, 0x30 |
Length high |
0 |
0x00 |
"00" |
0x30, 0x30 |
Length low |
20 |
0x14 |
"14" |
0x31, 0x34 |
Error Check, LRC/CRC |
|
0xDA, 0xB0 |
"D2" |
0x44, 0x32 |
End - Frame |
|
t1-t2-t3 |
CRLF |
0x0D, 0x0A |