winIDEA SDK
fnet_aout.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5"""
6This example shows basic FNet AOUT controller initialization and usage.
7
8(c) iSYSTEM Labs, 2022
9"""
10import isystem.connect as ic
11
12winidea_id = ''
13
14
15try:
16 # connect to last winIDEA
17 conn_mgr = ic.ConnectionMgr()
18 conn_mgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
19
20 # initialize FNet AOUT Controller
21 session_ctrl = ic.CSessionCtrl(conn_mgr)
22 fnet_ctrl = ic.CFNetCtrl(conn_mgr)
23 aout_ctrl = fnet_ctrl.AOUT('ADIO.AOUT1')
24
25
26
27 opt_aout_cfg = aout_ctrl.cfg()
28 opt_aout_cfg.reset()
29
30 n_my_channel = 0
31 # configure channel in one call
32 opt_aout_cfg.set_channel(nChannel=n_my_channel, strName='Drive', bShow=True, dInitial=5.0)
33
34
35
36 session_ctrl.end() #end first for cfg to take effect
37 session_ctrl.begin_prepare()
38
39
40
41 # use FNetTrigger 5 in the example
42 f_trig_q = 5
43
44 opt_aout_op = aout_ctrl.op()
45 # qualifier - starts on FTrig, not enabled from start
46 aout_ctrl.op_qualifier_enable(f_trig_q)
47 aout_ctrl.op_qualifier_enable_on_start(False)
48
49 # configure action
50 opt_aout_channel_op = opt_aout_op.opt_channel(0)
51 opt_aout_channel_op.set_action(nAction=0, nFTrig=f_trig_q, dLevel=2.5)
52
53 # apply new operation settings and restart operation
54 fnet_ctrl.op_apply()
55
56
58 voltage = aout_ctrl.ctrl_set_channel(n_my_channel, 0.1)
59 # reads the voltage of the channel
60 voltageRead = aout_ctrl.ctrl_read_channel(n_my_channel)
61except Exception as ex:
62 print(ex)