From 02:00 AM CST Saturday, February 4 - 06:00 AM CST Saturday, February 4, 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 use a Switch connected to DAQ Card as event source in an Event Structure

Solved!
Go to solution
Is easy use a Front Panel Switch as event source. However, I want to do use an external switch hardwire to my DAQ Card (NI PCI-6229) as the event source in the Event Structure. Can anyone help?
0 Kudos
Message 1 of 6
(2,456 Views)

You can use "User Events" to generate events whenever/wherever you want. User Events use dynamically registration.

 

See the example program: Programmatically Fire Events.vi (yes it does have 2 "m"s in LV2009)

 

Notes:

 

  • To get started, right-click the event structure border and select "Show Dynamic Event Terminals".
  • The Events palette is hard to get to quickly, so I just right-click on an event item (like the Dynamic Event Terminals) to bring up the palette
  • You can generate the same event from multiple places
  • If you have more than one User Event, bundle the "Create User Events" outputs and use naming to "self document" code
  • You can replace "value signaling" calls with User Events
  • User Events are quite powerful and deserve more attention than they get

 

steve

 

User Event.png

 

 

--------------------------------------------------------------------------------------------------------------------------
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
--------------------------------------------------------------------------------------------------------------------------
Message 2 of 6
(2,439 Views)

Here is some more usful info on User Events

 

LabVIEW 2009 Help : User Events

0 Kudos
Message 3 of 6
(2,414 Views)

Happy New Year!!!

 

Thank you. I put all the field wired inputs from the DAQ Card into a Cluster. I use unbundle by name to call the switch, the state changes on the probe but I am having no success in activating an event using the "value change" from any Push Button.  Even if I put an indicator to double check the event is happening, I don't see indicator light turning on. Will you be able to show with an example vi?

================================================================== 

You can use "User Events" to generate events whenever/wherever you want. User Events use dynamically registra I ion.

 

See the example program: Programmatically Fire Events.vi (yes it does have 2 "m"s in LV2009)

 

Notes:

 

  • To get started, right-click the event structure border and select "Show Dynamic Event Terminals".
  • The Events palette is hard to get to quickly, so I just right-click on an event item (like the Dynamic Event Terminals) to bring up the palette
  • You can generate the same event from multiple places
  • If you have more than one User Event, bundle the "Create User Events" outputs and use naming to "self document" code
  • You can replace "value signaling" calls with User Events
  • User Events are quite powerful and deserve more attention than they get

 

0 Kudos
Message 4 of 6
(2,375 Views)
Solution
Accepted by Shining_Eagle

Happy New year to you too!

 

Attached is an example in LV 8.5

 

  • It uses the timeout loop (running every 100ms) to simulate your reads from the DAQ card.
  • A shift register is used to keep track of the previous value of the switch.
  • When a switch change is detected, the User Event is fired and the indicator shows the new state.

 

Running the vi with highlight execution turned on may be helpful.

 

steve

 

--------------------------------------------------------------------------------------------------------------------------
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
--------------------------------------------------------------------------------------------------------------------------
Message 5 of 6
(2,344 Views)

Thank you so much Steve!!!

 

I will continue playing with Event Structures.

0 Kudos
Message 6 of 6
(2,319 Views)