04-04-2016 01:07 PM
Hi All,
I modified this code from one of the example in the forum. I forgot which thread. Original file name is "loop speed control.vi"
I want to measure pressure and compare with target pressure. Once the pressure reading is higher than the target pressure, I hold the output high for 5 seconds and turn it to low.
When It goes back to low, I want the to exit the loop or when I pressed the stop button. I do not how to do this one. Please help.
Thanks
Solved! Go to Solution.
04-04-2016 01:10 PM
Hi Havevun,
Try using a case structure with a couple different states. For instance "Measure", "Hold" and "Exit". This way you are only checking for one condition in each state.
04-04-2016 01:19 PM
Yeah, you definately want a state machine. This probably would become very simple when you break down the states properly.
04-04-2016 03:22 PM
Hi Gregoryj and Crossruiz,
Thank you it really helps. The logic is cleaner than my previous.
There is this thing that I need to fix.
Motor is used to increase pressure
Valve is to dump the pressure.
I used delay to hold thre pressure once it reach the target pressure. (TRUE condition).
Pressure readings fluctuate.
The problem that I have here is that once the pressure reading is higher than the target. I do not want the code to return back to "False" (pressure reading is lower than target).
Please advise.
04-04-2016 03:36 PM - edited 04-04-2016 03:36 PM
I can't view your VI (I'm using LV 2014). Please see my attachment for an example. See what happens when you make the value of numeric >= 1. Turn on the highlight execution if it does not make sense.
04-05-2016 08:10 AM
Thank you, Gregoryj.
It works like a charm
04-05-2016 08:18 AM