LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to have a while loop inside a case structure?

Solved!
Go to solution

 


@CrackJack wrote:

Hi NIquist, thanks but can you please save it in lv 8.0 version???

 


 

Now I'm definately out of code generation.  With my DAQmx version I don't have support all the way back to 8.0.  The best I'd be able to do is screen shots.

 

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 31 of 38
(1,356 Views)

 


@CrackJack wrote:

Hi NIquist, thanks but can you please save it in lv 8.0 version???

 


Here you go.  I'm using 8.5.1 and 2010.  I thought you were 8.2.

 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 32 of 38
(1,347 Views)

thanks NIquist...

 

I had 1 more question, like i mentioned previously that I need to make sure that the cylinder was initially @ HOME position, if not the operator has to

make sure it is @ home position... how should i implement that>??

 

to make life easy for me, i have the START While loop button simulating the home position

of the cylinder ... if its false, then I have to turn on a digital OUTPUT RELAY to take the cylinder to home position,

and once it reaches the home position, another DI should turn ON to check the current position of the cylinder ...

 

 

Now on LabVIEW 10.0 on Win7
0 Kudos
Message 33 of 38
(1,342 Views)

This is where the state machine starts to become useful.  You would have states like:

 

Initialize DAQ - Resets DAQ card, creates DAQ tasks, configures DAQ tasks.

Setup Test - Asks the user for any required variables like the operator name, Device Under Test (DUT) serial#, filename, etc., then opens a file reference and maybe writes the file header...

Initialize Sequence - Beep to alert operator, then move to home position, check for any alarms, etc...

Idle - usually just waits for operator input but may also monitor something.

Run Sequence - Starts all the DAQ tasks and does the actual test run.

Record Data - Displays current run data and stores it to file.

Shutdown - Closes file references and stops DAQ tasks.

Quit - Stops main loop and exits program

Error Handler - A state to jump to if any other state can't complete without throwing an error.  This state may try to fix the problem and return to previous state or just report the error to the operator.

 

Play around with the LV state machine template and try to use it to simulate what you're trying to do but without the confusion of real hardware.  I have my own template that's more advanced but maybe we could use it to get your project going AND have you learn a bit more as well.  I'll try to post it today but I'm really busy so I can't promise.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 34 of 38
(1,336 Views)

Hi NIquist,

               THanks a lot for the inputs... Can you post your advanced SM??? alongwith it, do you know any tutorial where I can have an indepth study of the

SM/??

Now on LabVIEW 10.0 on Win7
0 Kudos
Message 35 of 38
(1,321 Views)

OK, you asked for it! Smiley Surprised

 

I added many notes so you can see what it's doing.  This state machine template will run with no hardware.  It just reports back what state is running.  It uses a run-time menu driven event structure in the user interface loop (bottom loop), and triggers associated cases running in another separate timed loop (with notifier) for advanced simultaneous excecution of time critical hardware (You won't need anything like this for a while but I left it in anyway.).  Note how the configuration and timing control data is passed from iteration to iteration with the shift registers.  Note how the QMain queue is filled with states and the how they are popped of and executed in the idle state.  Have fun too.

 

Unzip it and run ~QStateMain.vi.  On the program tab there is a timing control to turn the states on and off (red/green bool) and change the timing of the states.  You can change anything on-the-fly and it will react appropriately.  Don't forget to look at the run-time menu.  It is NOT the normal LabVIEW menu when the program is running. 

 

Good luck! Smiley Wink

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
Message 36 of 38
(1,312 Views)

Man....thats too complex/... People arnd me will go crazy if I develop anything like that...

 

THanks a lot thou... I basically get confused with shift registers and updating the variable values and stuf...

 

hope this would help ... 😉

Now on LabVIEW 10.0 on Win7
0 Kudos
Message 37 of 38
(1,303 Views)

Just play around with it.  Add some probes here and there.  Run it with execution highlighting on.  Watch the monitors.  Drop your own code into the different states and see what happens. Etc.

 

The concept of using shift registers which pass variables from loop iteration to iteration is CRITICAL.  Make some simple VIs to try it out with your own code.  You'll get it.  You seem to be learning fast but give things time to sink in and then go back to it later, don't rush it.  We all start as noobs, build your skills and your confidence will follow. 

 

Enjoy your weekend!

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 38 of 38
(1,293 Views)