LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA events for logging SCPI messages

Hi, 

 

I’m creating a VI for configuring and managing an Agilent 34980A. I need to trace somehow the SCPI commands that I sent by Agilent‘s Vis. I have thought to use the VISA events to do for avoid changing in those Vis but I’m not able to find a way or the property to obtain back the string written to the device. Is there anyone who has done that?

Thank you for the help!

Here after a little example to understand my idea: since the Agilent’s Vis are inside my VIs for manipulating the data I prefer to pass by the events. I have Labview 2019.

 

Best Regards,

Zuc

 

Zuc_lab2_0-1758100615070.png

0 Kudos
Message 1 of 7
(135 Views)

Hi Zuc,

 


@Zuc_lab2 wrote:

I need to trace somehow the SCPI commands that I sent by Agilent‘s Vis. I have thought to use the VISA events to do for avoid changing in those Vis but I’m not able to find a way or the property to obtain back the string written to the device. Is there anyone who has done that?


So you want to create a logfile with all commands send to your device? (Like VISATrace in MAX?)

 

I would change that Agilent device driver to:

  1. Use a Write subVI in each of those driver VIs
  2. Inside this Write subVI I would place another subVI that writes the command message into a logfile, together with additional information like VISA reference and (ISO8601) timestamp…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(129 Views)

Hi GerdW,

 

yep the semplified aim is to have a text file with all the SCPI commands. Hopefully, in the future, to also save the answers of the device.

as i said i'm trying to not change the Agilent's VIs (since they are in other projects) and to have something a bit more flexible also because the Agilemnt's VIs are so many that it can be quite boring.

 

best regards,

Zuc

0 Kudos
Message 3 of 7
(116 Views)

Hi Zuc,

 


@Zuc_lab2 wrote:

Hopefully, in the future, to also save the answers of the device.


So you need a Write subVI next to the Read subVI…

(The device responses can be quite large once you use the buffer abilities of such DMMs…)

 


@Zuc_lab2 wrote:

as i said i'm trying to not change the Agilent's VIs (since they are in other projects) 


Create a copy of the driver, only used in (and inside) your own project.

 


@Zuc_lab2 wrote:

because the Agilemnt's VIs are so many that it can be quite boring.


That's why I suggested this Read/Write subVI, so you only need to replace the VISARead/Write function with your subVI.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(106 Views)

Hi GerdW,

 

sorry for my questions that can appear to be quite simple, so you suggest to modify this Vi to have everything done in one shot. Is it possible?  because i have no access to the code of that vi. Moreover i then need to replace is in all the Agilent's VIs, It's the same to add a the Writetotxt Vi in all of them, right? i was trying to develop something that can be reused and was a module aside from the rest.

Zuc_lab2_0-1758103452952.png

 

best regards,

Zuc

 

0 Kudos
Message 5 of 7
(90 Views)

Hi Zuc,

 


@Zuc_lab2 wrote:

so you suggest to modify this Vi to have everything done in one shot. Is it possible?  because i have no access to the code of that vi. 


You don't "modify" the VISAWrite, but you place it in a subVI. Inside the subVI you can add anything else like your logfile feature…

 


@Zuc_lab2 wrote:
Moreover i then need to replace is in all the Agilent's VIs, It's the same to add a the Writetotxt Vi in all of them, right? 

I have seen device drivers that already came with a dedicated subVI for Read or Write, but haven't checked for your specific device.

Yes you would need to replace all instances (of interest) of VISAWrite with your subVI…

 


@Zuc_lab2 wrote:

i was trying to develop something that can be reused and was a module aside from the rest.


How often do you need to develop/re-use device drivers?

You know learn the basics once and can apply it to all future developments 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 7
(74 Views)

@Zuc_lab2 wrote:

Hi, 

I need to trace somehow the SCPI commands that I sent by Agilent‘s Vis

 


There is a separate SCPI manual for those instruments that explain the SCPI commands in detail

 

You can just open the Agilent VIs block diagram and look at the SCPI commands they are using. 

 

Or you don't even need the instrument to do this.

 

  1. Open the block diagram of a VI you are interested in
  2. Drop a string indicator on the string sent to the VISA Write in the VI.
  3. Enter some typical data/settings to the VI's controls
  4. Run it.
  5. Sure it's going to error but you will see the SCPI string the VI generated in the string indicator

 

Also if you install the full NI-VISA you should have NI I/O-Trace (NI-MAX "Tools" menu) that will log and save all the commands sent and responses received to and from the instrument 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 7
(29 Views)