How to change the parity of a WTSC MODBUS RTU device via modpoll

Most of the time, the parity can be changed for the serial port in a Gateway, but sometimes it is required to change the parity of a Modbus RTU device directly.

We will use the software "modpoll" for this purpose, available for Windows and Linux.

In this example we are changing the parity of a WTSC 485 (Wiegand To RS-485 Serial Converter - Link) on a Linux system.

 

  1. Install modpoll onto your system, which you are using to connect to the Modbus RTU device via a serial interface
  2. We will now have to check the manual of the W2SC to see, what kind of register structure the device has

    RegisterTypeValue
    2000Slave ID42
    2001Modbus mode1 = ASCI
    2 = RTU
    2002Parity1 = None
    2 = Odd
    3 = Even (default)
    2003Baud ratedefault 9600 Baud
    2005Command register0x42 = write configuration to EEPROM
    0x24 = reset the device
  3. As in the documentation described, changing the parity requires the using the register 2002

  4. First we read from the device using the following command

    root@ubuntu:/# modpoll -a 42 -b 9600 -d 8 -p even -s 1 -t 4 -0 -r 2002 -c 1 /dev/ttyUSB0
    modpoll 3.4 - FieldTalk(tm) Modbus(R) Master Simulator
    Copyright (c) 2002-2013 proconX Pty Ltd
    Visit http://www.modbusdriver.com for Modbus libraries and tools.
    
    Protocol configuration: Modbus RTU
    Slave configuration...: address = 42, start reference = 2002 (PDU), count = 1
    Communication.........: /dev/ttyUSB0, 9600, 8, 1, even, t/o 1.00 s, poll rate 1000 ms
    Data type.............: 16-bit register, output (holding) register table
    
    -- Polling slave... (Ctrl-C to stop)
    [2002]: 3
  5. The device is thus correctly set in parity even, now we will change it to parity none, by adding a 1 to the command line used previously

    root@ubuntu:/# modpoll -a 42 -b 9600 -d 8 -p even -s 1 -t 4 -0 -r 2002 -c 1 /dev/ttyUSB0 1
    .
    .
    .
    
    Protocol configuration: Modbus RTU
    Slave configuration...: address = 42, start reference = 2002 (PDU), count = 1
    Communication.........: /dev/ttyUSB0, 9600, 8, 1, even, t/o 1.00 s, poll rate 1000 ms
    Data type.............: 16-bit register, output (holding) register table
    
    Written 1 reference.
  6. To write the changes to the device, we need to use the register 2005

    root@ubuntu:/# modpoll -a 42 -b 9600 -d 8 -p even -s 1 -t 4 -0 -r 2005 -c 1 /dev/ttyUSB0 0x42
    .
    .
    .
    
    Protocol configuration: Modbus RTU
    Slave configuration...: address = 42, start reference = 2002 (PDU), count = 1
    Communication.........: /dev/ttyUSB0, 9600, 8, 1, even, t/o 1.00 s, poll rate 1000 ms
    Data type.............: 16-bit register, output (holding) register table
    
    Written 1 reference.
  7. And finally we will reboot the device, for the changes to take effect

    root@ubuntu:/# modpoll -a 42 -b 9600 -d 8 -p even -s 1 -t 4 -0 -r 2005 -c 1 /dev/ttyUSB0 0x24
    .
    .
    .
    
    Protocol configuration: Modbus RTU
    Slave configuration...: address = 42, start reference = 2002 (PDU), count = 1
    Communication.........: /dev/ttyUSB0, 9600, 8, 1, even, t/o 1.00 s, poll rate 1000 ms
    Data type.............: 16-bit register, output (holding) register table
    
    Written 1 reference.
  8. Now we can check if the changes were done correctly

    root@ubuntu:/# modpoll -a 42 -b 9600 -d 8 -p none -s 1 -t 4 -0 -r 2002 -c 1 /dev/ttyUSB0
    .
    .
    .
    
    Protocol configuration: Modbus RTU
    Slave configuration...: address = 42, start reference = 2002 (PDU), count = 1
    Communication.........: /dev/ttyUSB0, 9600, 8, 1, even, t/o 1.00 s, poll rate 1000 ms
    Data type.............: 16-bit register, output (holding) register table
    
    -- Polling slave... (Ctrl-C to stop)
    [2002]: 1

Use the modpoll help for more information regarding the commands available. Here in this example we've used the following

-a : slave address; -b : baud rate; -d : databits; -p : parity; -s : stopbits; -t : register data type; -0 : PDU addressing;

-r : reference; -c : number of values to read

 

 

 

Downloadlink for Modpoll