Simply Modbus logo
← Previous: RTU/ASCII Slave

Modbus RTU/ASCII Slave Manual

Installation, Configuration, and Operation Manual

versions 8.x.x

Table of Contents

Installation

System Requirements:
Windows NT, 95, 2000, XP, Windows7, Windows8, Windows10 & 11
display resolution: 800 x 600 minimum
PC with serial port (built in, serial card or USB serial port)

Download

Simply Modbus RTU/ASCII Slave 8.1.3

Download the installation file and unzip the contents into a folder. Run setup.exe and follow the installation wizard.

Starting the Program

Click on the Simply Modbus Master item in the start menu to start the program.
Unlicensed versions will start with the Loading Demo window, which takes about 15 seconds.

RTU Slave Tool - Loading Demo Screenshot

Press "Enter key" to enter a license key and unlock the full version.

Enter License Key dialog box

Demonstration mode had full functionality but limits sending of response messages to the master to six.
It can then be restarted to send more messages.



The main read window is then shown.

RTU Slave Tool - Main Window Screenshot

Control color Controls (inputs) that can be changed by the user.
Indicator color Indicators (outputs) that cannot be directly changed.

Program Summary

When the program is opened, the circular clock indicator spins to show that the program is running. The program monitors the chosen serial port looking for incoming bytes from a modbus master.  All bytes received (and sent) are displayed in the 'Log'. 

The most recent request received is displayed in the indicator labelled "Latest Request received". A lookup is done to determine if the request has a valid SlaveID, function code, data addresses, valid data if writing and valid error detection bytes (CRC or LRC).

The request must meet the following 2 conditions before a response is generated and sent:

             1) The ID in the request (the first byte received) must match the entered Slave ID,
                 or 'Respond to all Slave IDs' must be checked.
                 If the ID does not match, the Slave program will ignore the request since it is intended for a different slave.

             2) The CRC (if  RTU mode) or LRC (if ASCII mode) at the end of the request must be correct.

Data flow for request and response

The request must meet the following additional conditions before a response with data is generated and sent:
             3) the request must have a function code that matches enabled data in the tables.
                 Function code 03 or 04 to read registers with a block of register data set with the same code.
                 Function code 06 or 16 to write registers with a block of register data set as read/write.
                 Function code 01 or 02 to read coils with a block of coil data set with the same code.
                 Function code 05 or 15 to write coils with a block of coil data set as read/write.
                 If not, an exception code 01 is generated and sent.

             4) The requested registers or coils must exist in an enabled block. More specifically, the request must be for register
                 or coil addresses with a hex values that match the register number minus offset for one of the enabled tables.
                 If not, an exception code 02 is generated and sent.

                 For example, A request for 0003 addresses starting from 0002 will match a block setup with Registers 40001 to
                 40008 and offset 40001. It will reply with data from 40003, 40004 & 40005. A request for 0007 addresses
                 starting from 0002 will not match the same block, since it needs registers 40003 through 40009.
                 Since 40009 does not exist in the block, an exception code 02 would be generated and sent.

             5) When receiving function codes that request writing data, the data size and format must be correct.
                  If not, an exception code 03 is generated and sent.
                 
                 For example, A FC16 request to write 0005 16bit addresses must contain 10 data bytes (two bytes per address),
                 otherwise an exception code 03 would be generated and sent.

                 When a response is generated, it is written to the serial port and the Log.

On a multi-dropped network (eg. RS485) with multiple slaves, this application will also receive responses from other slaves.
All messages received will be monitored and processed to determine if they are valid requests from a modbus master.

Enter these settings to match the Slave you wish to simulate.

Modbus mode

Modbus mode selector

Select Modbus RTU or Modbus ASCII protocol.     Modbus ASCII

Serial Settings

Set the COM port, baud rate, data bits, stop bits, and parity to match the Modbus master on the network.
COM port selector

COM port: PC serial port to a modbus slave device. Range: COM1 to COM99
                    A red border is shown for ports that do not exist or have initialization errors.

Serial settings selectors

baud: The baud rate (bits per second) of the serial connection.
data bits: The number of data bits in each byte, RTU mode requires 8, ASCII mode is usually 7 but may be 8.
stop bits: The number of stop bits for each byte sent. allowable values are 1, 1.5 or 2 .
parity: The value of the parity bit for each byte sent. allowable values are none, odd, even, mark or space.

RS232C Wiring

To receive requests from a modbus master before sending a message, the serial port needs to be physically connected to a modbus master device. The simplest connection is RS232C on a single serial cable.

DTE masters (PC serial ports) have DB9 male connectors which transmits on pin3, receives pin2 and grounds on pin5.
A DCE slave will have a DB9 Female connector which will allow the use of a straight through cable.
A DTE slave will have a DB9 Male connector and will require the use of a null modem cable.

RS232 Wiring diagrams

The RS232 specification states a maximum distance of 50 feet at 20kbaud. Slightly longer connections are possible at slower baud rates depending on cable quality and noise in the area.

Modems and radios are used to transmit longer distances. These are typically DCE devices so straight through cables can be used. Some MDS non-spread spectrum radios require RTS Delay to be used so a 4th conductor is needed on pin 4.

RS485 converters can be used to extend the distance up to 4000 feet at 100kbaud. This can be a 4 wire or 2 wire system, depending on the converter. This also allows multi-dropping up to 32 devices on one pair of wires.

Slave ID

SlaveID selector

The 1st byte in the Request and Response strings The unit address of the Slave device to be emulated. normal range: 1 to 247
The program will only respond to requests directed to this Slave ID.     SlaveID

Respond to All SlaveID's check box

When this box is checked, the program will respond to requests directed to any Slave ID to simulate many slaves.

High Byte first and High Word first

High Byte first and High Word first check boxes

The bytes and words can be swapped by toggling these check boxes.     Byte/Word Order

Add Random Noise

Add Random Noise check boxes and controls

Random noise can be added to the data values to simulate live data.
When checked, the program will apply a random multiplier to the values found in the tables to a maximum of the '%reading' value entered.
The program then gives slightly different responses when the same request is repeated.

Data Table window

Data button to open the Slave Data Window

Press the DATA button to open the Slave Data window. Where the Register and Coil values are entered.

Slave Data window snapshot - where the tables are entered


Enter data in up to six data blocks for the slave to respond with. A Configuration file (see below) can be saved, edited and restored to assist in entering the data.     Data tables

Data Blocks

1 of 6 Data Blocks in the Slave Data window

Blocks 1 to 4 are registers for storing numerical data.
Blocks 5 to 6 are coils for storing boolean (on/off) data.

Enable data block selector

Enabled:    Each block can be set to enabled or disabled.

Function Code selector

Function Code:    Each register block is set to respond to either FC03 or FC04 for read register requests.
Each coil block is set to respond to either FC01 or FC02 for read coil requests.     Function codes

read-write vs. read-only selector

Write:    Each block can be set as read only to accept the only the function code above,
or read/write to allow the host to change the data with FC06&16 (for registers) and FC05&15 (for coils).

Register Size selector

Register Size:    Each register block can be set as 16bit registers (typical for standard modbus),
or 32bit registers (used for Enron modbus 32bit Int (5000) block or 32bit float (7000) block)     Data tables

Data Type selector

Data Type:    Select the data type for the data table.
All values in one table must have the same data type.     Data Types

Available Data Types to select

These are the available Datatypes that can be selected.
16bit Unsigned Integer (range: 0 to 65535)
32bit Unsigned Integer (range: 0 to 4.3 billion)
16bit Signed Integer (range: -32768 to 32767)
32bit Signed Integer (range: -2.1 to 2.1 billion)
32bit IEEE Floating Point

First Register selector

First Register:    Set the register or coil numbers for the start of the block.     Data tables

Offset selector

Offset:    Set the difference between the register or coil number and the hex number used in the commands for each block.
For example register#40005 minus offset 40001 uses hex address 04.     Data tables

Number of Values selector

Number of Values:    Set the size of the register or coil block.

Register Numbers indicator

Register or Coil Numbers:    A read-only indicator displaying the register or coil numbers as set above.

Register Numbers indicator in hexadecimal

Register or coil Numbers in hex:    A read-only indicator displaying the register or coil numbers minus the offset in hexadecimal as used in the request message.

Register Values indicator

Register Values:    Enter the register data values in this control.

Coil Values indicator

Coil Values:    Enter the coil data values in this control.

Clock indicator

Clock indicator:    This indicator is used to verify that the program is running.

REFRESH button

Refresh button:    Press to refresh the data shown following a change by a write command from the master.

CANCEL button

Cancel button:    Press CANCEL to close the window and leave the data unchanged.

OK button

OK button:    Press OK to accept the changes entered and close the window.

Program Operation

Once the correct input data is entered, the program operates by itself.

 'Latest Request Received' indicator

 

  When bytes are read on the serial port,  they are displayed here.
  The bytes are then processed to see if a response should be generated.

 

 'Slave ID' control             'ID match' indicator

The first byte of the request is shown in 'ID'.  This is the Slave Address that the Master is requesting a response from.
This hex value is converted to decimal and compared to the 'Slave ID' entered.
If they match or if "Respond to all Slave IDs" is selected, the 'ID match' indicator will turn green as shown.

 

 'function code match' indicator

 

The second byte of the request is shown in 'fc'.  This is the Function code indicating which table to read from.
This program support function codes 01,02,03,04,05,06,15 (0F hex) and 16 (10 hex).
If one of these function codes is found in the request, the 'fc okay' indicator will turn green as shown.

 

 'data found in tables' indicator

 

 

The 3rd and 4th bytes of the request are shown in '1st register req'.  This is the register address of first register to read.
This number is converted from hex to decimal and shown in 'First Register req'.
The program then looks for this register in the data tables showing the function code above.
If found, the matching table is displayed in 'found in block', and the 'data found' indicator will turn green as shown.

 

 'No. of Registers' indicators

 

The 5th and 6th bytes of the request are shown in 'number of regs'.  This is the number of registers to read.
This hex value is converted to decimal and displayed in '# of Registers'.

 

 'CRC ok' indicator

 


The 7th and 8th bytes of the request are shown in 'CRC' (or 'LRC' if in ASCII mode). 
The expected CRC (or LRC) is calculated from the first 6 bytes and displayed in 'Expected CRC'  (or 'Expected LRC').
If the two match, the 'crc ok' indicator will turn green as shown.

crc  The last 2 bytes of a modbus RTU message are the cyclic redundancy check.   These are error detection bytes.     CRC

lrc  ASCII Mode messages are preceded with a colon and the crc is replaced with an lrc (longitudinal redundancy check), carriage return and line feed characters.     LRC

 

If the 'ID match', 'fc okay', 'data found' and ' crc ok' indicators all turn green, a response with data will be generated.
The data is read from the matching table and a response is generated and returned.

A breakdown of the response is shown in the registers table

Data found table


   A scrollbar will appear for responses with more than 5 values as shown here.

   The columns show the register number (including the offset), its value in hex,

   the decimal value of the data and this value in hex.

 

 

 'Latest Response Given' indicator


   The response string is generated from the data
   and shown in 'Latest Response given'.
   This is an example of a response with 6 data bytes.

 

The bytes in the above data response are explained here:

   0A      The Slave ID responding
   03      The function code
   0C      The number of data bytes to follow
00 1E      register 40012 = 30
00 28      register 40013 = 40
00 32      register 40014 = 50
00 46      register 40015 = 60
00 50      register 40016 = 70
E4 71      The CRC (or 'LRC' if in ASCII mode).

 

If the 'ID match' and ' crc ok' indicators both turn green, but the function code found is not supported, a response is generated with exception code '01'.

If the 'ID match' and ' crc ok' indicators both turn green, but the data is not found in the table, a response is generated with exception code '02'.

If the 'ID match' and ' crc ok' indicators both turn green, and a 'write data' function code 05, 06, 15, or 16 is found followed by valid data, the data is written to the tables and an appropriate response is generated.

If the 'ID match' and ' crc ok' indicators both turn green, and a 'write data' function code 05, 06, 15, or 16 is found followed by invalid or missing data, a response is generated with exception code '03'.

 

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 are removed to keep the program from slowing down.

Byte Log indicator and buttons

Save Byte Log button

Press Save Bytes to Display a 'Save As..' dialog box to save log contents to a text file.

Clear Byte Log button class="image">

Press Clear Bytes to empty the byte log contents.

Save and Restore Configurations

Save Configuration button

Press Save Configuration to display a 'Save As..' dialog box to save the current settings to a text file.

Restore Configuration button

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...

Configuration File contents

Columns A & B contain the setting descriptions and their values.
      Mode  0 = ASCII, 1 = RTU
      serial port  1 = COM1, 2 = COM2 etc
      baud rate
      data bits
      stop bits  0 = 1bit, 1 = 1.5bits, 2 = 2bits
      parity  0 = none , 1 = odd, 2 = even, 3 = mark, 4 = space
      slave ID
      byte order  0 = low byte first, 1 = high byte first
      word order  0 = low word first, 1 = high word first
      add noise  0 = unchecked, 1 = checked
      %reading Integer 0 to 100
     scroll lock  0 = unchecked, 1 = checked (lock scrollbar at bottom)
The remaining columns contains the data from the 6 data tables:
      enabled  0 = disabled, 1 = enabled
      function code  0 = FC 03, 1 = FC 04 (for the 4 register tables)
      function code  0 = FC 01, 1 = FC 02 (for the 2 coil tables)
      read/write  0 = read only, 1 = read/write
      register size  0 = 16 bit, 1 = 32 bit (not applicable to coil tables)
      data type     0 = 32bit IEEE Floating Point  (0 = 1 bit for coil tables)
                         1 = 32bit Unsigned Integer (0 to 4.3 billion)
                         2 = 32bit Signed Integer (-2.1 to 2.1 billion)
                         3 = 16bit Unsigned Integer (0 to 65535)
                         4 = 16bit Signed Integer (-32768 to 32767)
      1st Register : the register number of the first register including the offset
      Offset : The offset between the register numbers and their hex values for the table
      Number of values:  The size of the table
The table settings are followed by the register or coil numbers and their corresponding values.

The data can be saved and edited within a spreadsheet and then loaded into the program with the RESTORE CFG button.

About Box

ABOUT button

Press the About button to display the About Box and see the full version number and if you are in demo mode.

RTU Slave tool ABOUT box

Context help

Contect Help indicator

Press Control-H to open the Context Help box which shows additional help information as you hover over the controls and indicators.

Contect Help pop-up

Troubleshooting

If you see no response after hitting send
  • Check serial wiring and ensure slave device is powered on.
  • Check the correct COM port is selected. active COM ports are listed in the Device Manager > Ports(COM & LPT).
  • Check COM port settings.
  • Check mode. RTU or ASCII.
  • Check slave ID.
  • Check slave device tables to verify register or coil addresses.
  • Check offset to verify 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.
← Previous: RTU/ASCII Slave