LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sweep and stop after fall and rise: IMPOSSIBLE QUESTION.

I want to create a VI that allows the variable (SEE SHIFT REGISTER) to increase from min to MAX by Delta and then decrease from MAX to min. The problem is that I want one thing: that at the end of the descent the cycle stops itself (Numeric, at the end, must be zero). I have tried with variable Control, but the program stops itself when numeric is 3.

 

To explain: the variable starts from 0, after 1, 2, 3, 4, 5, 4, 3, 2, 1, 0 and stop.

 

Have you a very intelligent solution for this problem? Can you post a VI for LW8? Maybe with same correction to my, THANKS!!!

 

Sweep2.JPG

Message Edited by Laura82763 on 03-25-2010 06:08 PM
0 Kudos
Message 1 of 9
(3,610 Views)

a very basic fix would be:

 

stop the loop if Numeric=0 and iteration counter i>0

 

this would only work for your example case 0,1,2,3,4,5,4,3,2,1,0

 

if your starting value [min] is < 0, then it won't work

0 Kudos
Message 2 of 9
(3,601 Views)

Laura,

 

One thing I notice is that you write TRUE to Stop local variable when Control=2 (lower left of the diagram).  It doesn't sound like this is something that you want.

 

Greg

v7.1
0 Kudos
Message 3 of 9
(3,594 Views)
How about this...
v7.1
0 Kudos
Message 4 of 9
(3,591 Views)
Slightly simpler...(working hard for a potential 1st kudo)
v7.1
Message 5 of 9
(3,570 Views)
I desire a best solution... it's possible to have this? I desire a solution very simple, intellingent, fast... can you propose your soltion?
0 Kudos
Message 6 of 9
(3,551 Views)
Mercurio can you help me? The problem is that I desire a condition of stop that can be activated and de-activated by an other loop? I have thought about an array of boolean with 3 led. 1 becames green when there is minimum, 2 becames green when there is maximun, 3 becames green when there is the second minimum, but when i implemented this the counter doesn't stop when is zero. SO i can put all zero if i want sweep and when there are all one (boolean green) the cycle is stopped. Can you help me please?
0 Kudos
Message 7 of 9
(3,534 Views)

Why dont you use another shift register to count the number of minimums (when =0 then add count).  Then when this is equal to a value you want to stop at you can use it to stop the loop.

 

As a side note, if you are working in integers I would change all your control representations to I16 or similar.  Sometimes working with an equals and double precision float can throw up anomolies due to rounding errors etc.  Not only that but your code will be more efficient too.

 

Craig 

LabVIEW 2012
0 Kudos
Message 8 of 9
(3,523 Views)
Thanks Craig.
0 Kudos
Message 9 of 9
(3,490 Views)