是德科技
直播中

张琴

7年用户 187经验值
私信 关注
[问答]

如何使用VBA将组触发器发送到两个E3648A电源?

嗨,我是VB的新手,并且一直在尝试按照E364xA用户和服务指南中的应用示例,使用Excel中的VBA程序对一对E3648A电源进行编程。
我有一个NI USB接口,可以让示例应用程序正常工作。
我的目标是让电源输出同时改变。
我理解如何从GPIB设置触发源。
我可以向每个电源发送一个“* TRG”命令,输出会按预期变化。
我认为要同时更改两个电源,我需要使用GPIB组执行触发器(GET),如用户指南第93页所述。
这样做的推荐方法是什么,因为“GET”似乎不是SCPI命令?
我假设我需要调用VI函数直接在接口上发送GET?
谢谢!

以上来自于谷歌翻译


     以下为原文

  Hi,
I'm pretty new to VB and have been trying to follow the application example in the E364xA User's And Service Guide for programming a pair of E3648A power supplies using a VBA program within Excel.

I have a National Instruments USB interface and can get the example application to work just fine.

My goal is to have the outputs on the power supply change at the same time. I understand how I can setup a trigger source from GPIB. I can send each power supply a "*TRG" command and the outputs change as expected.


I think to get both power supplies to change at the same time, I would need to use the GPIB Group Execute Trigger (GET), as described on page 93 of the user's guide.

What would be the recommended way of doing this, as "GET" doesn't seem to be a SCPI command?

I assume I would need to call a VI function to send GET out on the interface directly?

Thanks!  

回帖(1)

王伊

2018-11-16 10:59:12
我附上了一个可以导入的编程示例。
它提供了我用于成功使用GET的方法。
要使用组执行触发器,除了仪器会话外,还必须打开计算机接口会话,并使用VISA中的viAssertTrigger功能和一些低级编程。
可以使用* viOpen *(defaultRM,+ ioAddress +,VI_NULL,1000,my_controller)打开计算机接口会话,其中ioAddress =“GPIB0 :: INTFC”。
在GPIB接口与指定设备的会话打开后,将各个电源的输出(如果需要)耦合,并将触发源设置为总线。
设置所有仪器的所需触发电平,打开输出,然后启动触发系统。
现在这里有一个棘手的部分:在使用viAssertTrigger之前,你必须确保所有乐器都在听。
这必须使用低级命令完成。
要编写低级命令,请使用命令* viGpibCommand *(my_controller,+ cmdString +,Len(+ cmdString +),actual)。
cmdString是一串ASCII字符,对应于IEEE-488设备的Talk和Listen Addresses。
此字符串将根据您使用的GPIB地址而更改。
我在我的示例程序中使用的字符串是“U!”。这里概述了每个字符的作用。? - >所有设备的“Unlisten”。这可以确保在发送触发器时没有不需要的设备正在侦听。
- >“通话”用于计算机界面。您正在使用的软件将是唯一一个发送命令。! - >“听”GPIB0 :: 1(第一台乐器的地址)“ - >”听“
GPIB0 :: 2(第二个仪器的地址;在VBA中,引号在字符串中输入为“”)?U将用于您拥有的任何仪器地址。
不断变化的组件是!
和。“我附上了一张图片,告诉你要使用哪些字符。一旦完成低级编程,使用* viAssertTrigger *(my_controller,VI_TRIG_PROT_DEFAULT)来使用”GET。“-----编辑:我已经附上了
第二个文件显示了另一种使用VISA在文件VISA_GET_ex2.xlsm中发送GET的方法。编辑:MaxineF于2015年8月6日下午2:56
e3648aVBA.xlsm54.8 KBtalklisten.PNG36.3 KB

以上来自于谷歌翻译


     以下为原文

  I have attached a programming example that you can import.  It provides the methods I used to successfully use GET.

To use the Group Execute Trigger, you must open a computer interface session in addition to the instrument sessions and use the viAssertTrigger function in VISA in conjunction with some lower level programming.

The computer interface session can be opened using *viOpen* (defaultRM, +ioAddress+ , VI_NULL, 1000, my_controller) where ioAddress = "GPIB0::INTFC".

After sessions to the GPIB interface and specified devices have been opened, couple the outputs of individual power supplies (if desired), and set the trigger source to bus.  Set the desired trigger level of all instruments, turn the output on, and initiate the trigger system.

Now here is the tricky part:  Before using viAssertTrigger, you must make sure that all the instruments are listening.  This must be done with low-level commands.  In order to write low-level commands, use the command *viGpibCommand* (my_controller, +cmdString+ , Len( +cmdString+ ), actual). cmdString is a string of ASCII characters that corresponds to the Talk and Listen Addresses of an IEEE-488 device.  This string will change based on what GPIB addresses that you are using. The string that I used in my example program is ?U!".  Here's an overview of what each character does.

     ? --> "Unlisten" for all devices.  This ensures that no unwanted devices are listening when the trigger is sent.
     U --> "Talking" for Computer interface.  The software that you are using will be the only one sending commands.
     ! --> "Listening" for GPIB0::1 (address of first instrument)
     " --> "Listening" for GPIB0::2 (address of second instrument; in VBA a quotation mark is entered as "" within a string)

?U will be used for whatever instrument addresses you have.  The changing components are the ! and the ".  I have attached a picture that tells you which characters to use.

Once the low-level programming is finished use *viAssertTrigger* (my_controller, VI_TRIG_PROT_DEFAULT) to use "GET."

-----
Edit: I have attached a second file showing another way to send GET using VISA in the file VISA_GET_ex2.xlsm.

Edited by: MaxineF on Aug 6, 2015 2:56 PM

附件

举报

更多回帖

发帖
×
20
完善资料,
赚取积分