04-06-2010 03:38 AM
Hi, I am writing a code at the moment where I have a sequence structure in a For loop which performs a sequence of events in order.
What I want the code to do is
Enter number of required cycles, start cycles, wait 1 second, turn on solenoid, wait until pressure reaches x value, hold for x seconds, close solenoid, wait until pressure reaches <1, hold for x seconds, repeat the cycle etc. At the same time, i want to datalogue the pressure value to file once every second so that i can open file and display after test.
I am fairly new and in experienced with labview so help appreciated.
04-06-2010 05:08 AM
Can u send me ur code for debugging? or Do you want new code?
Thanks
Sivabalan.V
04-06-2010 05:17 AM
04-06-2010 05:24 AM
Hi guys and thanls for the info.
The below example might just work. I haven't tried it yet but looks feasible - i didn't think of putting while llops in sequence structure!
Only thing is - I want to log pressure to file for duration of test (i.e always logging) can i add a seperate while loop under the for loop to take care of this?
04-06-2010 05:38 AM
hi jamie,
Ofcourse you can do logging continuosly,but there should be some way to escape out of that while looop... .
Thanks and regards,
srikrishnaNF
04-06-2010 11:09 AM
This sounds like a good application for a state machine. Look for examples on state machines. Get the number of cycles before you start the state machine. Your first state is to wait 1 second (I'm not sure why this is required since you have not started doing anything yet). Next state is to turn on solenoid. Next state is to wait until pressure reaches x value. Next state is to hold... and so on until all conditions are completed. This will continue until the number of cycles has been reached. You will need a cycle counter and have it incremented at the first state. In your last state, you have to check this value. If reached, next state is to quit. If not reached, next state is to the beginning. Try coding this and then post your code if you need help.