1
2
3
4
5"""
6This example shows basic FNet AIN controller initialization and usage.
7"""
8
9import isystem.connect as ic
10
11winidea_id = ''
12
13
14try:
15
16 connMgr = ic.ConnectionMgr()
17 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
18
19
20 SessionCtrl = ic.CSessionCtrl(connMgr)
21 FNetCtrl = ic.CFNetCtrl(connMgr)
22 AINCtrl = FNetCtrl.AIN('ADIO.AIN1')
23
24
25
26 optAINCfg = AINCtrl.cfg()
27 optAINCfg.reset()
28
29 nMyChannel = 0
30
31 optAINCfg.set_channel(nChannel = nMyChannel, strName = 'MyAINChannel', bShow = True, dMultiply = 2.0)
32
33
34
35 optAINCfg.set_averager(8)
36
37
38 optAINCfg.power_measurement_disable()
39 if False:
40 optAINCfg.power_measurement_enable(1.0)
41
42
43
44
45 SessionCtrl.begin_prepare()
46
47
48
49
50 FTrigQ = 5
51 FTrigGen = 6
52
53 optAINOp = AINCtrl.op()
54
55 AINCtrl.op_qualifier_enable(FTrigQ)
56 AINCtrl.op_qualifier_enable_on_start(False)
57
58
59 optAINOp.set_sampling_interval(0.00001)
60
61
62 optChannel = optAINOp.opt_channel(nMyChannel)
63 optChannel.set_record(True)
64 optChannel.set_comparator(nComparator = 0, nFTrig = FTrigGen, bHigherThan = False, dVoltage = 3.0)
65
66
67 FNetCtrl.op_apply()
68
69
71 voltage = AINCtrl.ctrl_get_channel(nMyChannel)
72except Exception as ex:
73 print(ex)