winIDEA SDK
Loading...
Searching...
No Matches
fnet_aout.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
"""
This example shows basic FNet AOUT controller initialization and usage.
(c) iSYSTEM Labs, 2022
"""
import isystem.connect as ic
winidea_id = ''
try:
# connect to last winIDEA
conn_mgr = ic.ConnectionMgr()
conn_mgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
# initialize FNet AOUT Controller
session_ctrl = ic.CSessionCtrl(conn_mgr)
fnet_ctrl = ic.CFNetCtrl(conn_mgr)
aout_ctrl = fnet_ctrl.AOUT('ADIO.AOUT1')
opt_aout_cfg = aout_ctrl.cfg()
opt_aout_cfg.reset()
n_my_channel = 0
# configure channel in one call
opt_aout_cfg.set_channel(nChannel=n_my_channel, strName='Drive', bShow=True, dInitial=5.0)
session_ctrl.end() #end first for cfg to take effect
session_ctrl.begin_prepare()
# use FNetTrigger 5 in the example
f_trig_q = 5
opt_aout_op = aout_ctrl.op()
# qualifier - starts on FTrig, not enabled from start
aout_ctrl.op_qualifier_enable(f_trig_q)
aout_ctrl.op_qualifier_enable_on_start(False)
# configure action
opt_aout_channel_op = opt_aout_op.opt_channel(0)
opt_aout_channel_op.set_action(nAction=0, nFTrig=f_trig_q, dLevel=2.5)
# apply new operation settings and restart operation
fnet_ctrl.op_apply()
voltage = aout_ctrl.ctrl_set_channel(n_my_channel, 0.1)
# reads the voltage of the channel
voltageRead = aout_ctrl.ctrl_read_channel(n_my_channel)
except Exception as ex:
print(ex)