modbus

mbpoll writing data to relay board


I am having trouble writing the correct data to a relay board using mbpoll. It uses Modbus RTU, and the data that I NEED to write is: 01 06 00 01 01 00 D9 9A

The command I am using is: sudo ./mbpoll -m rtu -b 9600 -0 -t 4:hex -P none -v /dev/ttyUSB0 -1 0001 This gives me a result of:

Protocol configuration: Modbus RTU
Slave configuration...: address = [1]
                        start reference = 1, count = 1
Communication.........: /dev/ttyUSB0,       9600-8N1 
                        t/o 1.00 s, poll rate 1000 ms
Data type.............: 16-bit register, output (holding) register table

[01][06][00][01][00][01][19][CA]
Waiting for a confirmation...
<01><06><00><01><00><01><19><CA>
Written 1 references.

It is slightly off and the relay board does not respond. Any idea how I can use mbpoll to write the correct formatted data?

Thank you very much!!!!!


Solution

  • You need to request register 256 (PDU addressing as you have specified -0). So the following (using different port) should work:

    mbpoll -m rtu -b 9600 -0 -t 4:hex -P none -v  /dev/ttymxc0 -1 256
    

    Results in:

    Protocol configuration: Modbus RTU
    Slave configuration...: address = [1]
                            start reference = 1, count = 1
    Communication.........: /dev/ttymxc0,       9600-8N1
                            t/o 1.00 s, poll rate 1000 ms
    Data type.............: 16-bit register, output (holding) register table
    
    [01][06][00][01][01][00][D9][9A]