05-05-2016 10:50 AM
I have a program running two indpendent visa sessions. At the end of the day a technician comes by and unplugs the serial cables from the device they are attached to. This is sadly unavoidable. which means that my VI hangs and waits for the timeout then loops, recording bunk data in the process. How can I avoid this from occurring? I would like the program to safe itself if one or both the serial cables are unplugged. Is it enough to put an event loop in teh while loop with the conditoin that if timeout is reached X number of times (for redundancy so that it does not accidentally shut off mid session on its own for another error) then True is sent to the stop button? How would this effectively close my visa session if the cable is forcibly unplugged?
As for part two of my question, if I have two devices connected under normal operations, but for some reason only want to connect one, or only one is unplugged during a session, how can i skip over the one that is unplugged automatically? is there a way to dynamically "comment" out a portion of the code if it detects that there is no actual device connected to that particular com port?
05-05-2016 12:07 PM
the 'comment out' functionality is commonly called case structure 😉
for each of you two ports you can create a state MC that outputs the data and handle its own init,read,timeout, retry, retry later, ignore, close,...
if one or both ports send an ignore status you can close you program, in case of an timeout activate the sound output with a sample of your choice 😆 😄