我的代码:
import snap7.client as s7
ip = '192.168.0.7'
rack = 0
slot = 1
data_blok = 100
start_adress = 0
size = 260
try:
plc = s7.Client()
plc.connect(ip, rack, slot)
con = plc.get_connected()
print(f"Bağlantı Durumu: {con}")
db = plc.db_read(data_blok, start_adress, size) //read
name = db[0:256].decode('UTF-8').strip('\x00')
print(f'Data AA: {name}')
value = int.from_bytes(db[256:258], byteorder='big')
print(f'Data BB: {value}')
boll = bool(db[258])
print(f'Data CC: {boll}')
except:
print("hata")
输出:
Bağlantı Drumu: True
Data AA: HELLO WORD //string
Data BB: 55 //int
Data CC:True //bool
过程结束,退出代码 0 ...
////////////////////////////////////
如何在这里更改整数值?
plc.db_write(?????????)