Hi all,
Anyone know how to read the data inside modbus register after writing the IR command ? I just to make sure the data is correct.
Hi all,
Anyone know how to read the data inside modbus register after writing the IR command ? I just to make sure the data is correct.
Hi~
Step1:
Map IR bank to RAM
(edit port & device modbus address for your)
export DEV_PORT=/dev/ttyRS485-2
export DEV_ADDR=55
#BankNumber in {5200..5239}
export BankNumber=5200
modbus_client --debug -mrtu -pnone -s2 $DEV_PORT -a$DEV_ADDR -t0x05 -r$BankNumber 1
Step2:
After command IR bank may be read(and write for modify) in holding registers 2000…2510
for i in {2000..2510}
do
echo "register $i $(modbus_client --debug -mrtu -pnone -s2 $DEV_PORT -a$DEV_ADDR -t0x03 -r$i | grep Data:)"
done
Step3:
Before normal work need unmap IR bank from RAM registers:
modbus_client --debug -mrtu -pnone -s2 $DEV_PORT -a$DEV_ADDR -t0x05 -r$BankNumber 0