6This script demonstrates the usage of data acquisition, which
7provides fast periodic access to data on target. Because values are
8buffered on an emulator, this approach provides much smaller
9sampling periods than normal access with read() or evaluate()
12Two locations are monitored on a running application. The acquired
13data is printed to console.
15See also dataRecorderWithDAQ.py
19import isystem.connect
as ic
20from isystem.connect
import IConnectDebug
26cmgr = ic.ConnectionMgr()
27cmgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
29debugCtrl = ic.CDebugFacade(cmgr)
32debugCtrl.runUntilFunction(
'main')
33debugCtrl.waitUntilStopped()
37daqCtrl = ic.CDAQController(cmgr)
40daqInfo = daqCtrl.info()
42if daqInfo.getMaxItems() == 0:
43 print(
'No DAQ items exist!')
46print(
'MaxItems = ', daqInfo.getMaxItems())
48daqVariables = ic.DAQConfigVector()
51daqVariables.append(ic.CDAQConfigItem(4, 0, 0x400001a8, ic.CDAQController.daqSample1s))
54daqVariables.append(ic.CDAQConfigItem(
'main_loop_counter'))
56daqCtrl.configure(daqVariables)
59daqTimeStart = daqCtrl.status().getTime()
62daqCtrl.enableGlobal(
True)
66 daqStatus = daqCtrl.status()
68 if daqStatus.getNumSamplesAvailable() > 0:
69 print(
'Max DAQ acquisition time = ', str(daqStatus.getLastLoopTime()))
70 if daqStatus.getOverflow():
71 print(
'SAMPLING OVERFLOW!')
74 daqSamples = ic.DAQSampleVector()
75 daqCtrl.read(daqSamples)
77 print(
'Number of samples = ', str(daqSamples.size()))
78 for daqSample
in daqSamples:
80 print(
' index =', str(daqSample.getIndex()),
81 ' data =', hex(daqCtrl.getDataValue(daqSample).getLong()),
82 ' time =', str((daqSample.getTime() - daqTimeStart)))