here I had write a Python program with SL4A to demonstrate Modbus/TCP.
there is no any Modbus library used in this case, because I just want show a simple case for Modbus/TCP.
of course, I will use Modbus library later. it will be more easy~
some about this program:
1. data = pack('<BBBBBB', 1, 2, 0, 0, 0, 6)
it's the Modbus/TCP header
2. data = data + pack('<BBBBBB', 1, 4, 0, 0, 0, 4)
it's the Function code 4, and to read 4 registers
here to download
沒有留言:
張貼留言