LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Want to change Event cycle variable in real time as well

Solved!
Go to solution

I have attached VI below. I want to change my code such that at "VAL": value change event I can do specific operation. I can not trigger event when "VAL" indicator changes.

 

I used "value signaling" property but it causes event to occur continuously.

0 Kudos
Message 11 of 17
(205 Views)
  • Please do not maximize the front panel and diagram to the screen. Very annoying.
  • "count" needs to be an integer (blue wire). You cannot have fractional counts!
  • None of your local variables are needed. Compare with my example.
  • Why is there a unconditional 200ms loop wait?
  • What's the purpose of the [11,12,13] array constant? Is the "val" always integers? The "set val" should be blue too!
  • Your "timeout array" constant belongs before the loop. It never changes. If you would kae the elements e.g. [-1, 5000, 10000, 15000], certain things could be simplified.

 


@doc_d wrote:

I have attached VI below. I want to change my code such that at "VAL": value change event I can do specific operation. I can not trigger event when "VAL" indicator changes.


  • Maybe you can explain what a "specific operation" is. Look into a state machine, e.g. place a case structure inside the timeout case and place the "specific operation" in the other case.

 


@doc_d wrote:

I used "value signaling" property but it causes event to occur continuously.


No, don't do that!!!

 

Please go back and study my code again, then get rid of all these local variables. Learn about dataflow and state machines, there are plenty of example.

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 12 of 17
(158 Views)

My operation:

 

OPEN: Opens file and read elements.(For ease I have taken 2 arrays.)

1. TIMEOUT array: For time delay

2. VALES array: For sending values

AUTO START: starts cycle. (Takes value one by one from the array.)

Example: If "TIMEOUT" array's first element is 10000, first element from "VALUES" array will go in "VAL" variable and will not change until 10seconds.

Cycle will repeat until array is completed to its last value.

STOP AUTO: Stops cycle and  "VAL" variable will have last value it won't reset to 0.

SET VAL: To set value of "VAL" variable manually, I will disable and grey it when cycle is running.

After cycle is completed i.e. Last time delay from the array completed, "VAL" will hold its value. 

0 Kudos
Message 13 of 17
(149 Views)

See if this can give you some ideas...

 

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 14 of 17
(130 Views)

This vi is working fine but the I have other events going on during the timing, if I add those events and trigger them the timer just restarts. For example if my delay is 5 seconds and if I trigger event at 3 sec then total 8 sec delay is taken.

 

0 Kudos
Message 15 of 17
(101 Views)
Solution
Accepted by topic author doc_d

If you want relatively regular timeouts, you can shorten the timeout accordingly whenever another event occurs (example). If certain things really need to occur at regular intervals, place them in an independent parallel loop.

 

(You are still using value property nodes instead of local variables. No reason for that!)


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 16 of 17
(90 Views)

I was trying to implement exact logic😁. That worked!! I have 2 more auto operations like this(Reading values from file: 1. time 2. Value1 3. Value2 4. Value 3 ) will be going on but I'll figure it out. 

Thank you.

0 Kudos
Message 17 of 17
(81 Views)