LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating and Generating User Events

Solved!
Go to solution

I am working on a VI in which a host computer is communicating with a PXIe system.  I am using two parallel while loops, one for control and display functions and the other devoted to communications with the PXIe system.  When the host Comms loop gets data from the PXIe system, it uses a queue to transfer the data from the Comms loop to the Control loop.

 

A LabVIEW CLA suggested that I use "Create User Event" and "Generate User Event" to trigger the data transfer from the Comms loop to the Contrl loop, but I am having a hard time wrapping my head around the mechanics of getting that done. I haven't found any good examples of how to code that. I will keep searching, but if anyone can help me out in the meantime, I would appreciate it greatly.

 

I wish I could post some code, but my company prohibits it.

 

Thanks!

Forbes Black
Lapsed CLAD, LV 5 - LV 2022 (Yeah, I'm that old...)
0 Kudos
Message 1 of 3
(2,513 Views)
Solution
Accepted by topic author diarmaede

Forbes,

 

Bummer that you can't share the exact code you are working on.

I've attached a simple example of how I often use user events. From a high level it is your own interrupt. Loop one says "Generate User Event" and the other loop that is registered and waiting to handle that event handles it when it happens. The nice thing about this architecture is that the consumer loop can essentially sleep while it waits for things to do. 

 

Attached is my example. Let me know if it doesn't make sense and perhaps we can modify it to become an analog for what you are actually doing and go from there. 

Message 2 of 3
(2,497 Views)

Perfect example.  Thanks very much!

Forbes Black
Lapsed CLAD, LV 5 - LV 2022 (Yeah, I'm that old...)
0 Kudos
Message 3 of 3
(2,481 Views)