Skip to Navigation

UE9 Modbus TCP Example

The UE9 natively supports Modbus TCP. Check the Modbus map for a list of addresses to send. This is an example using LabJackPython of what bytes to send on the wire to talk to the UE9 over Modbus TCP:

  
>>> import ue9
>>> d = ue9.UE9(ipAddress =  "192.168.1.209", ethernet = True)
>>> d.debug = True
>>> d.readRegister(0)  #Reads AIN0
Sending:  [0, 0, 0, 0, 0, 6, 255, 3, 0, 0, 0, 2]
Response:  [0, 0, 0, 0, 0, 7, 255, 3, 4, 59, 97, 232, 0]
0.0034470558166503906
>>> d.writeRegister(5000, 3.3)    #Sets DAC0 to 3.3 V
Sending:  [0, 0, 0, 0, 0, 11, 255, 16, 19, 136, 0, 2, 4, 64, 83, 51, 51]
Response:  [0, 0, 0, 0, 0, 6, 255, 16, 19, 136, 0, 2]
3.2999999999999998
>>> d.readRegister(0)    #Reads AIN0 again
Sending:  [0, 0, 0, 0, 0, 6, 255, 3, 0, 0, 0, 2]
Response:  [0, 0, 0, 0, 0, 7, 255, 3, 4, 64, 83, 52, 90]
3.3000702857971191
  

In the example above, each line that starts with “Sending” contains the bytes that the PC sends to the UE9. The “Response” lines contain what the UE9 sent back to the PC.

Comments

No comments yet. Speak up. We're listening.