From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate a message and stop LabVIEW based on instrument failure or error message thrown

How are you reading from the device? Are you using VISA, TCP, something else? Regardless, all of the receive/read functions have timeouts. Is it possible that you are using -1 as your timeout which is effectively "wait forever"? If so, change your timeout to something reasonable. If on the other hand you need long timeouts but want to interrupt them, you will need to put your reads in a loop, use a short timeout value and have your code check the execution time against the desired long timeout. For example, if you need to have a 60 second timeout, you could change your read to use a 1 second timeout. When you get your data you would exit the loop immediately. If you get a timeout, you would check to see if the total time you have been working has exceeded the total timeout of 60 seconds. If it has, exit with a timeout error. If it hasn't, go back and try the read again. Each iteration you could also check some other element to see if you recevied an abort. in the past I have used a notifier for this with a 0 set as the timeout for the notifier. a notificatio is recevied that would signal the abort. If no notification was recevied continue processing.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 11 of 11
(133 Views)