Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Differences between NI MAX and LabVIEW

Solved!
Go to solution

I am not new to LabVIEW, but I would not call myself a GPIB expert either. We have a NI PCIE GPIB 488.2 board installed in our computer. I understand the high-level calls, but I don't know the difference between what LabVIEW VISA or GPIB calls are doing and NI MAX other than EOS and EOI which are not obvious at the higher level VISA and GPIB LabVIEW calls.

 

Our LabVIEW software has always worked with this external device. Recently, the vendor completely rewrote their software and now we see hang ups right after startup where we cannot communicate with this external device. We have to use NI MAX to send an *IDN? query to "wake" the external device up before we can use our software. After that all of our legacy VISA commands (including the *IDN?) work. I tried sending the *IDN? query from LabVIEW at startup, but I get a VISA Write timeout with an EABO (6) error which is not very helpful. What is strange is after I send the NI MAX *IDN? query once, the LabVIEW *IDN? query works every time.

 

I tried simplifying things by using just the LabVIEW GPIB and VISA examples and sending just one *IDN? query, but I get the same timeout error. I tried extending my timeout and playing with the expected read bytes, but no luck. I tried changing my Open VISA setup parameters (VISA Defaults, Loaded Configuration, etc) with no luck.

 

I switched from VISA to GPIB and played around with the GPIB Write Mode parameter for EOS and still had no luck.  We are supposed be using the default NI 488.2 board settings with just EOI (no EOS). In case the vendor was trying to use EOS, I tried Codes Display and sending \r and \r\n with no luck.

 

Why does my *IDN? query always work in NI MAX, but not LabVIEW until after I run the NI MAX query ?  I am using the LabVIEW examples (VISA and GPIB). I can send them, but anyone that has LabVIEW can drop a VISA Write or a GPIB Write block and right-click on them and go to the Examples to see what I am using.

0 Kudos
Message 1 of 3
(4,285 Views)
Solution
Accepted by topic author Rob_L2

So you can Open a VISA session to the instrument without error, but then it doesn't respond to commands?  Or does it fail to Open as well?  If it fails to open it sounds like your new vendor software doesn't release the instrument when it terminates.  I've never used it, but VISA does have an "Exclusive Lock" setting that might not be handled properly by vendor software.  Or perhaps the vendor software is still in memory when you try to run your LabVIEW code and needs to be closed first.

 

Try to explicitily Open a VISA session, Write a qurey, Read the response and Close VISA session as below.  What happens?  What errors do you see?

Message 2 of 3
(4,249 Views)

Thanks! Adding the Clear function after Open VISA resolved the issue. I'm wondering if there was some kind of conflict between my NI MAX and LabVIEW 2012. What is perplexing is that the old external device does not require this function in my code to work, but adding it allows us to use the new external device as well as the old one. We could reproduce the issue on the new external device, but we could never saw the loss of communication with the old device using my same LabVIEW application. After I added your code to my initialization, the new device works after every restart.

 

It is still kind of confusing whether the Clear function is clearing out my own GPIB System Control card's I/O buffer or sending a Clear (CLS) command to the external device. Anyways, Thanks!

0 Kudos
Message 3 of 3
(4,232 Views)