05-06-2013 12:55 AM
Hello,
While practicing Event Structure, I did a simple thing to detect the change in the state of a Boolean Indicator which was connected to a Boolean Control.
I made the event which was responsible to detect the change in state of that indicator, but the Structure don't detect its change, while when did with the same thing with the Boolean control, it detected it and comes out of the event.
So pls guide how could I detect the change in the state of an indicator
Regards
05-06-2013 01:48 AM - edited 05-06-2013 01:54 AM
Event structures are for user iteractions. They don't react to indicator changes or when a control or indicator is changed via a value property node or local variable. To trigger a value change event, you need to write to a "value (sgnl)" property.
Note that writing to a value(sgnl) property fires the event unconditionally, even if the new and old value is the same.
05-06-2013 01:50 AM
As far as I know, it will never work that way unless you use the 'value signalling' property of your boolean indicator.
It will write a certain value to your indicator AND fire a user event. You can catch this change event of your indicator with your event structure by using 'value changed' of that indicator
05-06-2013 01:56 AM
Thanks very much altenbach
So how could we then detect the change in the value of an indicator. With Event Structure and without Event Structure
05-06-2013 02:10 AM
Well, in your particular program, you would use an event case for the switch instead.
In you are interested in the change of a wire value, use a feedback node and compare current and previous values with a "not equal" the output will be true whenever the value changes.
What are you actually trying to achieve with all that. Maybe you are searching for a solution that is better handled in a completely different way.
05-06-2013 04:42 AM
Thanks once again
You wrote
/In you are interested in the change of a wire value, use a feedback node and compare current and previous values with a "not equal" the output will be true whenever the value changes./
But how when we are unable to detect the change of state of an indicator? So how to materialize it.
Sir actually i was practincg labivew with some mathematical tasks and so wanted to add the prime numbers, in the detection of prime numbers i placed a checked =0 there after dividing each number and so placed an indicator to see when the division result is not equal to zero and so that not a prime number.
Here i placed that indicator in an event structure and wanted to have a check on the change of its state.
I might not be using the event structure for the correct purpose but i wanna practice the event structure too.
So how could this be created using the Event structure.
Thanks
05-06-2013 05:17 AM
05-06-2013 05:19 AM
Are you using a state machine?
If so, when you connect the output of your =0 to the property node 'value (sign)' of your boolean indicator, LabVIEW will fire a user event => value change of that boolean indicator.
If afterwards you're checking your event structure, it will execute whatever is in that state of the event structure.
05-06-2013 07:17 AM
Why are you using an event structure? Just use a case structure after your check for prime. Then you don't need the indicator.
05-06-2013 09:09 AM
@Abuzar wrote:
Thanks once again
You wrote
/In you are interested in the change of a wire value, use a feedback node and compare current and previous values with a "not equal" the output will be true whenever the value changes./
But how when we are unable to detect the change of state of an indicator? So how to materialize it.
Sir actually i was practincg labivew with some mathematical tasks and so wanted to add the prime numbers, in the detection of prime numbers i placed a checked =0 there after dividing each number and so placed an indicator to see when the division result is not equal to zero and so that not a prime number.
Here i placed that indicator in an event structure and wanted to have a check on the change of its state.
I might not be using the event structure for the correct purpose but i wanna practice the event structure too.
So how could this be created using the Event structure.
As others have already said, your thinking is backwards here. The data primarily lives in the wire, an indicator just brings it into a readable form for the operator. This is secondary.
If you are interested if the remainder is =0 and want to communicate that fact to the user, just wire the output if this function to a LED. This is a direct result and does not depend on the previous state of the indicator, so no feedback node is needed. You are interested in the result itself, not the change in state.
Dataflow dictates that this =0 function gets evaluated whenever a earlier computation completes and that's the only time the value could change.
Feel free to show us your prime algorithm. Maybe we can give you some hints how to improve it. 😉