Modbus TCP Client ManualWriting to Registers and Coils
Installation, Configuration, and Operation Manual
versions 8.x.xTable of Contents
Writing to Registers and Coils
Press WRITE to open the write window.
Controls (inputs) that can be changed by the user.
Indicators (outputs) that cannot be directly changed.
To write to a slave device, the following settings are needed.
Mode
Mode is copied from the main READ window.
mode: "Modbus TCP" or "Modbus RTU-over-TCP" protocol. → Modbus TCP
Building a Command
Enter Slave ID, First Register and Number of Values to Write,
the Values and their Data Type to build the command string.
SlaveID: The 1st byte in the Command string.
The unit address of the Slave device to get data from. normal range: 1 to 247.
→ SlaveID
2byte ID: Setting a Slave ID over 255 will automatically check this box
and allow Slave IDs up to 65535.
→ SlaveID
Remains on for all addresses until a Slave ID below 256 is entered and the box manually unchecked.
Function code: The 2nd byte in the Command string.
The Write Window supports these Function codes:
FC 06 is used to write to one Holding Register.
FC 16 is used to write to multiple Registers.
FC 05 is used to write to one Coil.
FC 15 is used to write to multiple Coils.
→ Function codes
First Register: The 3rd and 4th bytes in the Command string.
The register (or coil) number at the start of the block to read.
→ Data tables
Offset: This value is subtracted from the First Register to get the data address used in the Request. → Data tables
Number of Values to Write: The 5th and 6th bytes in the Command string.
The quantity of registers (or coils) to write to the slave.
Register size: The size of the registers.
16 bit registers - standard modbus registers.
1 bit coils - standard modbus coils.
32 bit registers - most Enron modbus registers.
→ Data tables
Use defaults: When checked, the program will automatically populate the circled settings to default values as the value in "First Register" changes. To use non-default settings, or to keep these controls from changing with First Register, uncheck "Use defaults".
Default values
| First Register | Function Code | Offset | Register Size |
|---|---|---|---|
| 1-10000 | 01 | 1 | 1 bit coils |
| 10001-20000 | 02 | 10001 | 1 bit coils |
| 20001-30000 | 03 | 0 | 32 bit regs |
| 30001-40000 | 04 | 30001 | 16 bit regs |
| 40001+ | 03 | 40001 | 16 bit regs |
Data Type
Select the data type for the data to be written.
Multiple data types will require multiple write messages.
class="image">
These are the available Datatypes that can be selected. → Data Types
Values to Write
Enter the values in the first column.
The scrollbar will appear when writing more than 5 values.
High Byte first and High Word first
The bytes and words can be swapped by toggling these check boxes. → Byte/Word Order
Sending a Command
Set "fail in" time large enough to keep the program from timing out before the full response is received.
The default is 2 seconds.
Press SEND to transmit the command to the TCP server (slave) device.
The response time and a progress bar are shown as the program waits for a response. It stops when the expected response bytes are received or the "fail in" time is reached.
Reading the Response
After pressing SEND, the response bytes received from the slave device are displayed in the response indicator.The response for write commands is often an echo of the command.
This response indicates the command was acted on and there was no error.
Byte History Log
All bytes sent and received are added to the byte history log with date/time stamps.The maximum size of the byte log is 50,000 bytes when the oldest 10,000 is removed to keep the program from slowing down.
Pressing Save Bytes will Display a 'Save As..' dialog box to
allow the log contents to be saved to a text file.
Pressing Clear Bytes will empty the byte log contents.
Save and Restore Configurations
Press Save Configuration to display a 'Save As..' dialog box
to save the current settings to a text file.
Press Restore Configuration to display an 'Open File' dialog box
to select a previously saved settings file.
Configuration File Format
The file is saved in tabbed-text format (tab separated values).Sending it to, or opening it from, a spreadsheet program like Excel will use the tabs as column delimiters as shown here...

Columns A & B contain the setting descriptions and their values.
Column C contains the data type numbers 0 through 6.
Column E contains the values to write.
Context help
Pressing Control-H will open the Context Help box which shows additional help information as you hover over the controls and indicators.

Troubleshooting
If you see no response after hitting send- Check slave device is powered on and connected to the network
- Check the IP Address and Port in the Modbus Server (Slave device) to make sure it matches the settings in the TCP Client program (Master device)
- Check IP Address and port number.
- Check mode. TCP or RTU-over-TCP.
- Check slave ID.
- Check slave device tables to verify the addresses of registers or coils.
- Check offset to verify the hexadecimal address in the request message.
- Check "fail in" time is not too low causing the program to time out before the response is received.