Force Multiple Coils (Function Code 15)

Query

This function forces each coil (Modbus 0x range) in a consecutive block of coils to a desired ON or OFF state. Any coil that exists within the controller can be forced to either state (ON or OFF). However, because the controller is actively scanning, unless the coils are disabled, the controller can also alter the state of the coil.
Coils are numbered from zero (coil 00001 = zero, coil 00002 = one, and so on). The desired status of each coil is packed in the data field, one bit for each coil (1= ON, 0= OFF). The use of slave address 0 (Broadcast Mode) forces all attached slaves to modify the desired coils.
TIP: Functions 5, 6, 15, and 16 are the only messages that are recognized as valid for broadcast. This is the structure of the message being sent out to the Modbus network. The following byte values are displayed in hexadecimal format.
The following example forces 10 coils starting at address 20 (13 HEX). The two data fields, CD = 1100 and 00 = 0000 000, indicate that coils 27, 26, 23, 22, and 20 are to be forced On.
Node Address
Function Code
Coil Address High
Coil Address Low
Number of Coils High
Number of Coils Low
Byte Count
Force Data High 20…27
Force Data Low 28…29
Error Check Field (2 bytes)
0B
0F
00
13
00
0A
02
CD
01
CRC

Response

The normal response to a function 16 query is to echo the address, function code, starting address and number of registers to be loaded.
Node Address
Function Code
Coil Address High
Coil Address Low
Number of Coils High
Number of Coils Low
Byte Count
Force Data High 20…27
Force Data Low 28…29
Error Check Field (2 bytes)
0B
0F
00
13
00
0A
02
CD
01
CRC
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal