Simply Modbus logo
← Previous: Write Coil FC05

Modbus Write Multiple Coils (FC15)

Function Code 15

Request

This command is writing the contents of a series of 10 discrete coils from #20 to #29
to the slave device with address 17.

11 0F 0013 000A 02 CD01 BF0B

11: The SlaveID (11 hex = address 17 )
0F: The Function Code 15 (Force Multiple Coils, 0F hex  = 15 )
0013: The Data Address of the first coil.
             ( 0013 hex = 19 , + 1 offset = coil #20 )
000A: The number of coils to written ( 0A hex  = 10 )
02: The number of data bytes to follow (10 Coils / 8 bits per byte = 2 bytes)
CD: Coils 27 - 20 (1100 1101
01: 6 space holders & Coils 29 - 28 (0000 0001
BF0B: The CRC (cyclic redundancy check) for error checking.

The more significant bits contain the higher coil variables. This shows that coil 20 is on (1) and 21 is off (0). Due to the number of coils requested, the last data field 01 contains the status of only 2 coils.  The unused bits in the last data byte are filled in with zeroes.

Response

11 0F 0013 000A 2699

11: The SlaveID (11 hex = address 17 )
0F: The Function Code (Force Multiple Coils, 0F hex  = 15 )
0013: The Data Address of the first coil.
             ( 0013 hex = 19 , + 1 offset = coil #20 )
000A: The number of coils to written ( 0A hex  = 10 )
2699: The CRC (cyclic redundancy check) for error checking.