LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA event and event structure

Is there a way to get an event structure, which normally handles things like control changes, to handle a VISA event, in particular a serial "data ready" event? Otherwise, how would I combine the two, since having two event handlers is normally a bad idea?

0 Kudos
Message 1 of 5
(2,657 Views)

One option would be to have a separate loop communicate with the VISA connection and when data is received, it can put that data into a User Event that your single event handler is registered for. You can use a queue from your event handling loop to pass outgoing data back to your VISA loop. I use this method very successfully all the time. You can even do some more complicated things like have he VISA loop monitor for changes in status data returned from your device and send events based on those conditions. Then your event handler is freed up even more.

0 Kudos
Message 2 of 5
(2,647 Views)

It's worth noting that having 2 event structures isn't a bad idea all by itself.  You only run into actual problems when you have 2+ structures all registered for the same "filter" events.  Apart from that, there should be no problems at all if both structures don't have the same events in them, and you can have the same events in them if you want just as long as you don't need them to run in a particular order.

 

 

0 Kudos
Message 3 of 5
(2,626 Views)

pblase,

 

Check out this example I found. It's not the exact same thing, but maybe it will help you move in that direction of handling VISA events: https://forums.ni.com/t5/Example-Programs/Register-VISA-Event-as-Top-Level-Event-Using-a-User-Event/...

 

VanCamp

0 Kudos
Message 4 of 5
(2,593 Views)

Perhaps something like this.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 5 of 5
(2,581 Views)