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

hello everyone,

                      I would like to know how to control a while loop using case structure?? I would like the person to check if object A is in its home position or not,

if it is, then proceed....

 

The object should then perform its task as mentioned in the while loop... like move 10blocks up and down...

 

Later on, when it comes back to its home position, all the process should stop...

 

I have checked various forums on this http://forums.ni.com/t5/LabVIEW/How-to-stop-while-loops-inside-a-case-structure/m-p/591259

 

this is the nearest I can have... but can anyone tell me how to program for this/?? How the logic should be??

Now on LabVIEW 10.0 on Win7
0 Kudos
Message 1 of 38
(4,932 Views)

The thread you linked to centers around a state machine, and it sounds very much like what you need is a state machine. Do you know what a state machine is? If not, I would suggest reading this article: Application Design Patterns: State Machines

0 Kudos
Message 2 of 38
(4,910 Views)

It sounds suspiciously like you are looking for a "state machine".

 

I whipped up a Day-Off.vi snippet as an example.  Is it similar in structure to what you are looking for?

 

23392i069871BEFE4E9DE7


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 38
(4,900 Views)

Hey Jeff, can you please tell me what the Bool RefNum is doing??? I think it might be helpful.... 

 

 

Now on LabVIEW 10.0 on Win7
0 Kudos
Message 4 of 38
(4,889 Views)

 


@CrackJack wrote:

Hey Jeff, can you please tell me what the Bool RefNum is doing??? I think it might be helpful.... 


That's an artifact (read: limitation, a.k.a "bug")  from the snippet creation. Inside the loop is a property node directly linked to the front panel Boolean control.

 

0 Kudos
Message 5 of 38
(4,878 Views)

Hey Smercurio_fc, I was going through the application design and I clearly understand the logic of programming,

but I am failing to find the right way to implement the logic,... ex., i find it difficult how to reference a loop condition, using shift registers and stuff...

 

can you guide me where can I find a note/material which specifies how to build VIs.... ???

Now on LabVIEW 10.0 on Win7
0 Kudos
Message 6 of 38
(4,869 Views)

http://www.ni.com/academic/lv_training/how_learn_lv.htm

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 7 of 38
(4,856 Views)

NIquist, thanks for the link, but I am trying to understand howt to build state machines...

 

If we open a new VI, there is an option of create from a sample State Machine... however, I would like to convert my current VI into a state machine itself, Iam unable

 

to create new Type Defs which can be linked to my case states... I would like to know if there is any document which states tat/??

Now on LabVIEW 10.0 on Win7
0 Kudos
Message 8 of 38
(4,837 Views)

I understand what you're trying to do but you need to understand that you're getting ahead of yourself.  You need to learn the basics of dataflow, structures and functions before you can combine them into an architecture such as a state machine.  Once you understand the basics of LabVIEW you will be able to open the state machine template (or write your own version) and easily see how to modify it it to suit your own needs. 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 9 of 38
(4,828 Views)

Hello,

         I have been trying to learn state machines, and this is one of the simple examples that I came across, I am basically trying to

read from an analog input using DAQ assistant, and changing the tabs...

 

I would like the DAQ assistant to continue reading the analog input and write the same data on a txt file even when the tab is changed...

 

How can this be acheived? If I am able to do this, 75% of my code is finished...

 Can anyone please suggest/???

Now on LabVIEW 10.0 on Win7
0 Kudos
Message 10 of 38
(4,805 Views)