Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  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

    Code Block
    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

    Code Block
    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

    Code Block
    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

    Code Block
    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

    Code Block
    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

     

     

     

     

     

     

 

./modpoll  -a 42 -b 9600 -d8 -p even -s 1 -t3 -0 -r 1000 -c 1 /dev/ttyS1

./modpoll  -a 42 -b 9600 -d8 -p even -s 1 -t4 -0 -r 2002 -c 1 /dev/ttyS1

./modpoll  -a 42 -b 9600 -d8 -p even -s 1 -t4 -0 -r 2002 -c 1 /dev/ttyS1 1

./modpoll  -a 42 -b 9600 -d8 -p even -s 1 -t4 -0 -r 2005 -c 1 /dev/ttyS1 0x42

./modpoll  -a 42 -b 9600 -d8 -p even -s 1 -t4 -0 -r 2005 -c 1 /dev/ttyS1 0x24

...

Note

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

 

 

 

Info
Downloadlink for Modpoll

...