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.
11-20-2016 12:25 PM
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!
Solved! Go to Solution.
11-20-2016 12:45 PM - edited 11-20-2016 12:48 PM
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?
11-21-2016 01:07 PM
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?)
11-21-2016 01:47 PM
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.
To learn how to fire an "event" programatically, you'll want to look into Custom Events.
11-21-2016 01:55 PM - edited 11-21-2016 02:02 PM
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?)
11-22-2016 11:28 AM
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)
11-22-2016 11:31 AM
Hi pangvady. Thank you for sheding light into this problem. Your suggested code was valuable.
11-22-2016 05:09 PM - edited 11-22-2016 05:10 PM
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. 😄
11-24-2016 04:31 PM
Thank you much for your support. Love how compact your code is.
Have a nice thanksgiving!