...
- Install modpoll onto your system, which you are using to connect to the Modbus RTU device via a serial interface
We will now have to check the manual of the W2SC to see, what kind of register structure the device has
Register Type Value 2000 Slave ID 42 2001 Modbus mode 1 = ASCI
2 = RTU2002 Parity 1 = None
2 = Odd
3 = Even (default)2003 Baud rate default 9600 Baud 2005 Command register 0x42 = write configuration to EEPROM
0x24 = reset the deviceAs in the documentation described, changing the parity requires the using the register 2002
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
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 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 Written 1 reference.
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 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 Written 1 reference.
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 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 Written 1 reference.
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 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]: 1
...