6import isystem.connect
as ic
12def test_readWriteMemory():
13 connMgr = ic.ConnectionMgr()
14 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
16 dataCtrl = ic.CDataController(connMgr)
17 addCtrl = ic.CAddressController(connMgr)
20 DATA = [random.randint(0, 100),
21 random.randint(0, 100),
22 random.randint(0, 100),
23 random.randint(0, 100)]
25 START_ADDRESS = addCtrl.getVariableAddress(
"main_loop_counter").getAddress()
27 print(f
"Writing {NUM} bytes to address: {hex(START_ADDRESS)}: {DATA}")
28 wData = ic.VectorBYTE(DATA)
30 dataCtrl.writeMemoryNAI(ic.IConnectDebug.fRealTime,
36 print(f
"Reading {NUM} bytes, starting at address: {hex(START_ADDRESS)}")
37 rData = dataCtrl.readMemory(ic.IConnectDebug.fRealTime,
41 for index, data
in enumerate(rData[:NUM]):
43 print(f
"\tByte {index}: read value: {data}, access status: {rData[index + NUM]}")
46if __name__ ==
"__main__":
47 test_readWriteMemory()