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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

firing an LED value change event

Solved!
Go to solution

On the host vi I have an LED which turns on when the cRIO target enters a particular state.

I have been unable to fire an event on the host when the LED changes its state from false to true.

Any help or an example on how to generate events without user intervention will be greatly appreciated!

0 Kudos
Message 1 of 9
(3,338 Views)

Events are primarily triggered by changes made to a control by the operator via the front panel.

One way to fire an event programmatically, would be by writing the new state to a signaling value property of the indicator.

 

Why do you need an event structure? Since you are polling the LED anyway, you might lust add a simple case structure right there. can you show us some code?

0 Kudos
Message 2 of 9
(3,332 Views)

The cRIO target sets and sends an alert bit to the Host LED. The LED on the host goes "on", but it has to be accompanied by a sound alert to get the operator attention.

The requirement states that the sound needs to go on only once. The problem I have is that since the LED state is set to "on" all the time, the easiest way to make the sound once is to use an event structure. Additionally this would be a good opportunity to learn how to fire events programatically. Your hint "Value (signaling)" is well taken. 

(I'm embarrased. how do I attach a JPG with the code to this message?)

 

0 Kudos
Message 3 of 9
(3,290 Views)
Solution
Accepted by topic author MarcSanchez

If you're looking to just turn on a sound once when the LED goes on, you can just use a shift register that holds the previous LED Boolean value. Fire the sound only when the previous iteration's value is False and loop's current iteration's value is True.

 

LED Change Event.png

 

To learn how to fire an "event" programatically, you'll want to look into Custom Events.

Feel free. Contact me for anything more,
    Pang

You too can be LabVIEW Awesome!
0 Kudos
Message 4 of 9
(3,275 Views)
Solution
Accepted by topic author MarcSanchez

I would just use a queue and add an entry whenever the boolean goes from false to true. (use a feeback node and see if new >old) or even play a different file for each transition type.

 

Also note that you can play a sound in the background, simply set the timeout to 0 and it will not block the VI, so you could even add that to the top loop, eliminating the bottom loop entirely.

 

(Note that your sequence structure has no purpose. Why is it even there?)

0 Kudos
Message 5 of 9
(3,270 Views)

Hi Altenbach. I ended up using a feedback node for this particular problem as you suggested. I tried a "Value (signaling)" and firing a programatically event just for kicks. Thank you for your timely inputf.

(The code I sent you was half way done, thanks for looking at it)    

0 Kudos
Message 6 of 9
(3,233 Views)

Hi pangvady. Thank you for sheding light into this problem. Your suggested code was valuable.

0 Kudos
Message 7 of 9
(3,227 Views)

To detect boolean crossings, we of course have "Boolean Crosssing PtByPt".

 

I typically just use a feedback node as follows, depending on the transition I am interested in. 😄

 

 

 

0 Kudos
Message 8 of 9
(3,208 Views)

Thank you much for your support. Love how compact your code is.

Have a nice thanksgiving! 

0 Kudos
Message 9 of 9
(3,184 Views)