RF Measurement Devices

cancel
Showing results for 
Search instead for 
Did you mean: 

LabWindows VISA timeout exception

Solved!
Go to solution

I'm using viWrite and viRead in LabWindows to format a command string asking for data to write to a network analyzer over ethernet and read back the results.  Once every several hundred occurances the device seems to get hung on the read, which times out.  I wrote a 'while' loop around this and check on the viStatus to detect for the error and requery the device if needed.

 

However, when I run the program and the device times out on the viRead; if I'm running in debug mode it throws an exception bringing up a window asking whether I want to 'Debug' or 'Continue.'  If pressing 'Debug' shows that it's the viRead command that hung with a timeout, and pressing 'Continue' lets the program loop, ask for more data, and continue successfully.  But if I've configured the software for a 'Release' build, when the device times out the software throws an exception and the program crashes completely.

 

I just want my code to continue running, noting that there was a timeout and re-querying the hardware.  Is there any way to tell VISA not to create the exception?  I'm writing this program for techs to run, and they don't need to be asked to press the 'Continue' button whenever the device times out.

 

Thanks for the help.

0 Kudos
Message 1 of 2
(6,484 Views)
Solution
Accepted by topic author Brian Chase

You want to catch these exceptions. C inherently does not have exception handling, but there are some ways around it. Here is one solution to try. If not try looking through these results.

 

regards,

---

Peter Flores
Applications Engineer
0 Kudos
Message 2 of 2
(6,466 Views)