Rockwell Automation Publication 5069-UM003B-EN-P - January 2020 139
Modbus Command Codes Appendix B
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.
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.
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.
TIP Functions 5, 6, 15, and 16 are the only messages that are recognized as valid
for broadcast.
TIP This is the structure of the message being sent out to the Modbus network.
The following byte values are in hexadecimal display.
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
Node Address Function Code Coil Address High Coil Address Low Number of Coils High Number of Coils Low Error Check Field
(2 bytes)
0B 0F 00 13 00 0A CRC