从网上下载的仪器驱动程序一般都是初始化、配置、读数、关闭在一块的,如图:
现在来说说我的问题:根据我的测试需求,初始化和配置只需要执行一次,因为仪器设置好了就没必要重复设置了,而读数则需要根据被测件个数重复执行,关闭也只需要最后执行一次。所以我想把他们分开成三部分,如下图:
请问这样可以吗?VISA资源名称常量是否可以直接连接到read(single point).vi和close.vi ? 需不需要在VISA资源名称后面加一个VISA打开?
谢谢
您的思路是正确的。这里提醒一个地方,2,3中不应该把资源名作为传入参数,而是将1中经过Initialize的VISA session(紫色的线)传入2,3即可。
I do not see any problem... you can always have multiple while-loops.
Nevertheless, if you must have them not wired/ linked, you can create (from the DAQmx Create Channel) Task Out to either Indicator or Global Variable.
Then, Place and Read the Indicator's Local Variable or the Global Variable and input it to the Task/ Channels In of the DAQmx Read/ DAQmx Close etc.
@Ian fung wrote:
I do not see any problem... you can always have multiple while-loops.
Nevertheless, if you must have them not wired/ linked, you can create (from the DAQmx Create Channel) Task Out to either Indicator or Global Variable.
Then, Place and Read the Indicator's Local Variable or the Global Variable and input it to the Task/ Channels In of the DAQmx Read/ DAQmx Close etc.
Apology... please ignore previous reply... 😉
Nevertheless, if you must have them not wired/ linked, you can create (from the Initialize) VISA resource name out to either Indicator or Global Variable. Then, Place and Read the Indicator's Local Variable or the Global Variable and input it to the VISA resource name of the Configure Measurement/ Read/ Close etc.
赞同ian fung的建议。
可以将所有需要使用的仪器的VISA Resource在初始化中都创建出来,放到一个Local Variable Array中。这样在读取的时候只需要从Array中取出当前需要控制的仪器的VISA Resource即可读取数据。程序结束前将Array中的元素全部调用Close释放资源。