Colway Solutions
Modbus Member Logo

How To: Write Multiple Coils

Modbus provides two functions to modify the state of Coils. Function Code 0x05 can be used to change the state of a single coil whereas Function Code 0x0F is for changing the state of multiple coils in one request. This section describes the procedure for changing the state of multiple coils using FC 0x0F.

The Write Coils form

Figure below shows a Write Coils form and provides a note on the important components of this form.

Procedure

  1. Open the Write Coils form by choosing menu item Write->Coils or by clicking the Write Coils toolbar button.
  2. Set Dev ID to the Slave (Unit) ID of your device. Note that this parameter is ignored by most Modbus TCP devices.
  3. Set Address to the Modbus address of the first coil in the block that will be modified
  4. Set Length to the number of coils to be modified. Length cannot be larger than 1000. Setting a large value to length has performance tradeoffs as the numberof controls for modifying so many coils will take time to load into the panel. It is suggested that the length be limited to 200.
  5. Modify the state of the coils as desired using the radio buttons. Use the Set All or Reset All buttons to quickly set (On) or reset (Off) all the coils.
  6. Click OK to transmit the Write command to the device.
Tips:
You may use the Wrap Contents checkbox to control the flow of the radio buttons within the panel. If this is checked, each pair of radio buttons (along with their address labels) flow over to the next column on reaching the bottom of the panel. If not, all textboxes are placed in the same column and a scroll bar appears using which you can view text boxes that are beyond the bottom of the panel.
Tips:
You may resize the Write Coils form to make more space so that all the addresses are visible without having to scroll. The radio buttons and their address labels reflow to fit into the resized form.

See Also

Topic link How To: Change values of multiple Holding Registers at once
Topic link How To: Change values of Modbus variables from the Data Group Form
Privacy Policy Site Map FAQ Contact Us