mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-29 17:22:56 +08:00
13 lines
268 B
Python
13 lines
268 B
Python
import modbus_rt
|
|
import modbus_rt_defines as cst
|
|
|
|
ip_addr = "192.168.28.150"
|
|
|
|
tm = modbus_rt.tcp(cst.MASTER)
|
|
tm.set_net(ip_addr, 0, cst.SOCK_STREAM)
|
|
tm.set_server(ip_addr, 502)
|
|
tm.open()
|
|
# tm.excuse(1,3,0,5)
|
|
# tm.excuse(1,16,0,5,[21,23,24,25,65])
|
|
# tm.excuse(1,3,0,5)
|