winIDEA SDK
Loading...
Searching...
No Matches
test_read_write_value.py
# This script is licensed under BSD License, see file LICENSE.txt, or search for `License` in the SDK online help.
#
# (c) TASKING Germany GmbH, 2023
import isystem.connect as ic
winidea_id = ''
def test_readWriteValue():
connMgr = ic.ConnectionMgr()
connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
dataCtrl = ic.CDataController(connMgr)
addCtrl = ic.CAddressController(connMgr)
address = addCtrl.getVariableAddress("mainLoopCounter").getAddress()
print(f"Writing value '{42}' to address: '{hex(address)}'...")
valType = ic.SType()
valType.m_byType = ic.SType.tUnsigned
valType.m_byBitSize = 32
cVal = ic.CValueType(valType, 42)
dataCtrl.writeValue(ic.IConnectDebug.fRealTime,
ic.maPhysicalTriCore,
address,
cVal)
print(f"Reading back value...")
value = dataCtrl.readValue(ic.IConnectDebug.fRealTime,
ic.maPhysicalTriCore,
address,
valType)
print(f"\tValue: '{value.getInt()}'")
print(f"Alternatively, value can be written without updating winIDEA GUI (faster method)...")
dataCtrl.writeValue(ic.IConnectDebug.fRealTime,
False,
ic.maPhysicalTriCore,
address,
cVal)
if __name__ == "__main__":
test_readWriteValue()