NI LabVIEW,CVI,数据采集等产品讨论区

取消
显示结果 
搜索替代 
您的意思是: 

仪器控制,怎么把一个仪器驱动程序分成三个部分?

从网上下载的仪器驱动程序一般都是初始化、配置、读数、关闭在一块的,如图:

22877iE1A45CF96A33F2D7

现在来说说我的问题:根据我的测试需求,初始化和配置只需要执行一次,因为仪器设置好了就没必要重复设置了,而读数则需要根据被测件个数重复执行,关闭也只需要最后执行一次。所以我想把他们分开成三部分,如下图:

 

22879i8EC336399401A8BC

 

请问这样可以吗?VISA资源名称常量是否可以直接连接到read(single point).vi和close.vi ? 需不需要在VISA资源名称后面加一个VISA打开?

谢谢

0 项奖励
1 条消息(共 8 条)
4,330 次查看

您的思路是正确的。这里提醒一个地方,2,3中不应该把资源名作为传入参数,而是将1中经过Initialize的VISA session(紫色的线)传入2,3即可。

0 项奖励
2 条消息(共 8 条)
4,320 次查看

The basic structure that you need will be something like this...

 

22964iA94BBC49E83A608B

Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 项奖励
3 条消息(共 8 条)
4,312 次查看

可能我没有说清楚,我现在控制多台仪器,读数部分放在一个子vi中,如果直接连线的话,我考虑难以实现,所以我才有上面的问题。不连线,而是用每个部分单独连接visa资源名的方式可以吗?

0 项奖励
4 条消息(共 8 条)
4,301 次查看

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 F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 项奖励
5 条消息(共 8 条)
4,292 次查看

 


@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 InitializeVISA 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 F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
6 条消息(共 8 条)
4,288 次查看

赞同ian fung的建议。

 

可以将所有需要使用的仪器的VISA Resource在初始化中都创建出来,放到一个Local Variable Array中。这样在读取的时候只需要从Array中取出当前需要控制的仪器的VISA Resource即可读取数据。程序结束前将Array中的元素全部调用Close释放资源。

0 项奖励
7 条消息(共 8 条)
4,284 次查看

Thanks a lot

0 项奖励
8 条消息(共 8 条)
4,266 次查看