06-02-2017 06:01 AM
Since I am very new to LabView, this was very difficult for me.
I succeeded to communicate with the device using Matlab, from there everything works fine since now I know how I can send SCPI commands (very well referenced in the device's Programmers User Guide) directly to the device. So for me, using matlab the problem is solved.
I am sure I could do the same using LabView but it is too tedious for me.
Anyway,
Many thanks for your help!
06-02-2017 08:10 AM - edited 06-02-2017 08:14 AM
Sending SCPI commands with LabVIEW can be very easy to do. I have written a simple send SCPI command vi which should allow you to send any SCPI command to the instrument. You should be able to take any command that you are sending through Matlab and send it using LabVIEW to achieve the same result. There are 5 vi's here. VISA open, VISA Clear, VISA Set Timeout, VISA Write and VISA Close. The first opens a connection to the device. VISA Clear, removes anything sitting in the device buffer (clears any previous data or commands). The Timeout block is likely unnecessary because we are not expecting a response from the instrument with this simple program. Visa Write sends the string (the SCPI command). And VISA Close ends the session and closes the communication channel to the device. (I'm sure someone would describe them more accurately but that's a pretty simple in-the-ballpark explanation)
There is a lot of extra programming garbage that most instrument libraries contain that make it seem a lot more complicated than it is. I find that I usually just write my own simple communication libraries instead of using the provided instrument libraries from nearly every company.
There are many example VI's in the agilent library (Keysight). I have opened up one called "Series Edge Triggered Acquisition.vi" The innards of these VI's are quite overwhelming, but in the end it is really only sending SCPI strings to the instrument. I believe that if you play around with the example VI's and dig into them, you can get a feel for how LabVIEW operates as a language. But, in all, I seem to resort to the programmers manual and I usually just build simple vi's to issue commands and read responses. Here's a screenshot of the example VI. I'm not sure what version of LabVIEW you are using, so I'm just posting the screenshots. One thing to notice on their first VI in this chain is the 'initialize.vi'. By default this will reset the instrument to its default state clearing any settings that have been already configured. Most instrument libraries do this by default. Note also that this example VI will also get the oscilloscope waveform from the device. LabVIEW is a very powerful language and can be overwhelming at first (like any language). But, keep at the forums because there is a lot of people very willing to help you learn! Good luck.