From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Value change indicator event structure does not working properly

Solved!
Go to solution

Hello 

I want to print/record time when the boolean indicator changes its value. Attached program works one way, means if you go more than 20, this trigger event properly. however, if you come less than 20 it does not do anything. I need to implement this in 2 while loop not in a loop.

I have tried different ways from online help. nothing work properly in my case.

0 Kudos
Message 1 of 21
(3,332 Views)

Got the solution. Thanks. I dont know how to delete the post. Sorry

0 Kudos
Message 2 of 21
(3,323 Views)

Hi hossaimm,

 

your "solution" should be simplified to this snippet:

check.png

No event structure needed! (And you don't need to create events on indicators…)

 

I need to implement this in 2 while loop not in a loop.

So you failed your own homework description?

Using two loops absolutely makes sense here as your current "solution" stops signal aquisition as long as the dialog box is shown. You should implement a (proper) producer-consumer scheme using queues (or user-defined events)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 21
(3,306 Views)

Hello GredW,

Thanks for reply. I may be failed to describe properly. In my main program, I have already 2 loop. One for continuous calculations and one for event structures (around 40 events set already). I did not post the main program here.

I simplified the problem. trying to do the calculation in one loop and trigger the event in another. Please check out the updated file. I would like to have calculations/decisions from continuous loop and (event structure loop) write the time(.csv) when the value goes "more than 10" or "less than 10".

The one I posted is not a solution as well. I want to have calculation/decision in another loop. Its not working.

Please help. 

0 Kudos
Message 4 of 21
(3,294 Views)

As has been metioned, events are for user interactions, not for indicator changes.

Writing to an indicator and to a local variable (left loop) of that same indicator show a basic lack of understanding of local variables. Please continue with some basic tutorials.

If you would create an event for the stop button, you would not need a dummy timeout event. In the left loop you are polling the boolean anyway, so why would you need to fire an event? Makes absolutely no sense!

Writing to a signaling property will fire the event even if old and new values are the same.

Your left loop needs a wait too. No need to spin billions of times per second.

0 Kudos
Message 5 of 21
(3,292 Views)

Hello 

Thanks

Please check this vi I posted earlier. Digital Input Event Structure Example.vi ‏13 KB

This is working. This is almost what I want. I just want to have the calculation/decision(as attached pic) done on my right loop.

I am not concerned about the stop button at all. 

0 Kudos
Message 6 of 21
(3,287 Views)
Solution
Accepted by topic author hossaimm

@hossaimm wrote:

I just want to have the calculation/decision(as attached pic) done on my right loop. 


The comparison is already made in the right loop. Nothing to change. Can you explain what you really want?

 

Here's a simple rewrite. See if it works for you. I repeat: event structure are for controls, not indicator!

Message 7 of 21
(3,285 Views)

Hello altenbach,

Thanks for your support. 

What I really want is this attached vi(Right loop). If there is any alarm? ON/OFF I need to write the time in a csv file.

I am not worried about stop button for now. 

 

Normally event structures are for controls. However, I need this for indicators.

0 Kudos
Message 8 of 21
(3,273 Views)

@hossaimm wrote:

 

Normally event structures are for controls. However, I need this for indicators.


Obviously, you still don't get it! Simply place the file writing code inside my case structure! Abusing event structure for indicators is rarely never a good idea. Please study my earlier code.

 

Also note that your boolean logic is flawed because e.g. if alarm A is on and alarm B goes off, you won't notice a change. Your conditions needs to be labeled "all alarms off", "any alarms ON".

 

You still don't have a wait in the right loop. I doubt you can change the controls millions of times per second! 

0 Kudos
Message 9 of 21
(3,269 Views)

Thanks a lot. Your code does exactly what I want.

Also Thanks to GredW and all for support. 

0 Kudos
Message 10 of 21
(3,235 Views)