LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Acquisition in For Loop

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.

0 Kudos
Message 1 of 6
(2,810 Views)

Can u send me ur code for debugging? or Do you want new code?

 

Thanks

Sivabalan.V 

  

0 Kudos
Message 2 of 6
(2,798 Views)

Hi jamie310382,

  I just coded some outline of your idea.I attached the picture of my block diagram.Please find it in the attachments.

 

Thanks and regards,

srikrishnaNF

Regards,
Srikrishna


0 Kudos
Message 3 of 6
(2,795 Views)

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?

0 Kudos
Message 4 of 6
(2,791 Views)

hi jamie,

  Ofcourse you can do logging continuosly,but there should be some way to escape out of that while looop... :smileyhappy:.

 

Thanks and regards,

srikrishnaNF

Regards,
Srikrishna


0 Kudos
Message 5 of 6
(2,784 Views)

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.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 6
(2,760 Views)