LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

step sequence

Hello everyone,

Im trying to create a sequence that works in steps. Im new in labview and I need some of your help.

What Im trying to do is to specify a range of pressure values FROM and TO and move trought the values in steps specified by the user. For example:

FROM: 1000

TO: 5500

STEPS: 500

1000-1500-2000-2500-3000-3500- etc ... until 5500.

The signal to change from one step to the other is a 5V buttom that i already have. I just need to know how to do the steps sequence in labview.

Thanks.

0 Kudos
Message 1 of 11
(4,475 Views)

I am almost positive I am re-inventing the wheel, this function is probably out there somewhere,

but here is a very simple way to do it.

Step Function.PNG

Cory K
0 Kudos
Message 2 of 11
(4,471 Views)

You could use either a For loop or a while loop.  Maintain the current value of the pressure in a shift register and add the new increment to that every iteration of the loop

 

 

 

Cory got there quicker.  But his is the For loop version, mine is a while loop version.

Message Edited by Ravens Fan on 05-29-2009 12:01 PM
Message 3 of 11
(4,466 Views)

Thanks for your answers ...

I was using something similar to the for loop but my problem now is that i have to use this step sequence inside a case structure and inside another while loop that acquire signals every second ... so if I use the for loop is going to run all the steps every second .. and I need to run at the same speed of the outside while structure ... or whit a case structure that is controlled by an ON/OFF signal.

It is quite a complicate problem ..

Let me just work a little bit of time and I could reorganize my question.

Thanks ..

0 Kudos
Message 4 of 11
(4,451 Views)

What kind of timing do you want for how long the program should stay at each step?

 

You could use the while loop version and put the increment function in a small true case.  When "Want to increase" = True, then the increment occurs.  In the false case, just wire it through with out incrementing.

0 Kudos
Message 5 of 11
(4,449 Views)

It sounds as though you need to give some thought to the overall program architecture.  From the little description you gave, it seems likely that you can get by with just the outer while loop with some shift registers.  If you are not familiar with the state machine architecture, I recommend that you look at some of the examples or design patterns to see if that might be suitable for your application.

 

Lynn 

0 Kudos
Message 6 of 11
(4,445 Views)

Hello again,

Ok I was working a little bit more on the problem and trying to find a solution to the problem of the step sequence. So, I am going to explain better the complete problem.

As I told you I want to control a proportional air control for pressure. I have 3 options of control:

- Manual Control

- Table Control

- Step Control

 

The manual control and the control by a table is working perfect. My problem is in the Step control in wich I want to give the step size and Max and Min.

I attached the portion of the program in which I have the problem. In the front panel put all the attention to the square that contains the contron for the steps.

In works for an step size of 1 but if I give more it doesnt want to jump .. please just check it and maybe you will find a sollution.

The step count must to restart every time that I run the program, for some reason when I move the portion of the program this option is not working.

I need that the step occurs when I give the signal in "Next Step Boolean Switch" and that the program runs every second. Because I am acquiring and sending signals at the same time.

 

I really appreciatte your effort and time ...

Thanks ...

0 Kudos
Message 7 of 11
(4,383 Views)

The problem is that you have an uninitialized feedback node.  Right click on the feedback node that is at the top of your true case and Select Move One Loop Out.  This will put the initialization node on your outer while loop.  Feed a 0 constant into that.  Now your feedback node will restart at zero every time the program restarts. (Actually you might just be able to wire a zero constant into that node right where it is right now.)

 

Your program runs forever and can only be stopped by using the Abort button because you have a false constant wired into the stop terminal of the while loop.  Delete that false constant.  Right click on the stop terminal and select Create Control.  Now your program can stop nicely.

0 Kudos
Message 8 of 11
(4,381 Views)

Thanks Ravens for the suggestions.

I have that problems solved on the big program as I told you this attached program is just a portion of the big program that I'm working on.

The real problem that I have it could be ressume in this example:

Example 1: From ... 1

                  ... To     8

                  Step Value 2

                  The add step must to be : 1 3 5 7 and Stop

Example 2: From ... 1

                  ... To     8

                  Step Value 3

                  The add step must to be: 1 4 7 and stop

 

The program is only working if I put : From ... 1

                                                        ... To     8

                                                        Step Value 1

                                                        Th add step is : 1 2 3 4 5 6 7 8 Stop ... PERFECT !!

The problem that you are pointing I already have it solved in the big program that I have ... When I copy paste this portion of the problem to let you know how is this working I forgot to move this conditions too.

 

Thanks for your help and if you find I way ... please let me know.

Im working in another option for the control ... that is reading a file with options or attributes for example :

Another program send me a file with the pressure that must have the proportional control.

 

Thanks ...

                                           

0 Kudos
Message 9 of 11
(4,374 Views)

I'm not going to be able to figure that out unless you clean up the code some.

 

1.  You have a For loop in the True case of step 3 that runs only once.  Why?

2.  You have a number of wires that run to the right edge of structure to be never used again.

3.  Be careful where you do a division of two integers.  You get a double value.  Then you compare that to another integer.  Even if the double is 3 and the integer is 3, they may not necessarily be exactly equal to each other due to round offs and the computer representation of floating point values.  (e.g.  1 divided by 3 times 3 is NOT equal to 1, but .9999 ....)

 

A useful function thay will probably help you is the quotient and remainder function in the numeric palette.

 

Don't work in any new options until you are satisfied this part of your code is working correctly.

0 Kudos
Message 10 of 11
(4,365 Views)