From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
06-25-2015 10:36 AM - edited 06-25-2015 10:37 AM
In short, why would one want to use Visa Events? I have been experimenting with them in order to try to find new ways to handle or avoid Visa Read timeouts and I am struggling to see how they are useful, because they throw timeout errors too. To provide some background, I am hacking on a test application that reads and displays data from a serial port. The data can be intermittent, because I often toggle my my serial devices on and off. I don't want to be bothered with timeout errors stopping my application, so I have used varisous ways to handle them. The current way I am experimenting with uses Visa Events, hence the reason for this question.
If the Visa Read times out and the Visa Wait on Event times out, then what is the advantage of the latter? Is the Wait on Event less resource intensive than Visa Read? By the last question, I mean does the Visa Read poll or block behind the scenes while the Wait on Event does not?
Thanks in adavnce.
06-26-2015 08:08 AM
Hi Tysoni,
There are many advantages to using VISA events, one of which being that they can prevent LabVIEW from continuously polling your serial ports.
The links below provide some additional information on VISA events and receiving time outs while using VISA events.
http://digital.ni.com/public.nsf/allkb/179E61F87CF8B340862571EA0037CFA3
http://digital.ni.com/public.nsf/allkb/E393205297CFF1B386256DFA00738F4A
Regards
06-26-2015 10:02 AM - edited 06-26-2015 10:05 AM
So, when I use a VISA Read with count set to say 100, then LabVIEW will poll for those 100 bytes (or to termination character or timeout) behind the scenes until it returns? Would a better (non-polling) approach be to enable a VISA Event for a termination character and then once the event triggers, read all the data available? Conceptually, this seems like the cleaner, better approach. The only problem is timeouts. The Wait for Event will timeout just like the VISA Read will timeout, and because using events is more invovled, it begs the question of why to use events in this case. The timeouts from the events seems like the polling on the read is replaced with a polling on the events.
06-26-2015 10:11 AM
06-26-2015 10:59 AM - edited 06-26-2015 11:00 AM
I do not think timeouts are bad. I am just wondering what the difference between using VISA Read and VISA Wait on Event is with respect to timeouts. If one need to handle VISA Wait on Event timeouts when they occur, then why not just eliminate the event code and simply handle the VISA Read timeouts instead. What's the advantage of VISA events? The two errors/exceptions are the same, but using events requires more code.
06-26-2015 11:13 AM