mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-02-05 17:28:23 +08:00
15 lines
305 B
Python
15 lines
305 B
Python
import modbus_rt
|
|
import modbus_rt_defines as cst
|
|
|
|
ip_addr = "192.168.28.150"
|
|
|
|
tmu = modbus_rt.tcp(cst.MASTER)
|
|
tmu.set_net(ip_addr, 0, cst.SOCK_DGRAM)
|
|
tmu.open()
|
|
|
|
# tmu.set_server("255.255.255.255", 502)
|
|
# tmu.excuse(1,3,0,5)
|
|
# tmu.get_saddr()
|
|
# tmu.excuse(1,16,0,5,[21,23,24,25,65])
|
|
# tmu.excuse(1,3,0,5)
|