LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a function to finish the step add and decrease

Hi,sirs,

Can you give a simple example that uses a function to finish the step add and decrease? In fact, I am doing the following job:

I hope to use "while" frame to implement "step add":
when the "i" in the "while" frame increases, a value should be increased accordingly and then be output. However, after the value reached a Max value, it should be decreased while the "i" continues increasing.

Can you give me a simple program for that? I am using Labview 6.0.

Thanks a lot.
0 Kudos
Message 1 of 7
(3,336 Views)
here is the simple example FYR.
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 2 of 7
(3,336 Views)
Here's a slightly different version. In this one, you can specify the minimum and maximum count values, the starting count, start count direction, and even have different values for incrementing and decrementing. There is also a Pause and a reset control.

It reverses count direction when either the min or max count is reached.

It's saved in LabVIEW 6.0.2. This one is designed to be used as subVI.

Ed


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 3 of 7
(3,336 Views)
> I hope to use "while" frame to implement "step add":
> when the "i" in the "while" frame increases, a value should be
> increased accordingly and then be output. However, after the value
> reached a Max value, it should be decreased while the "i" continues
> increasing.
>

It sounds like you want i to increase continuously. Good, because that
is all it does. You want another value to ramp up, hit a value, then
ramp down. Make a shift register to hold the value and inside the loop
determine if you are in the state of increasing, holding, or decreasing.
This is in reality a simple state machine. If you want other
variables changing in other ways, add a shift register and determine how
it changes from one iteration to the next.

Greg McKaskle
0 Kudos
Message 4 of 7
(3,336 Views)
Thank you for your email. It is great.

In fact, I need do a little more jobs:

when the "i" in the "while" frame increases, a value should be increased accordingly and then be output. However, after the value reached a Max value, it should be decreased while the "i" continues increasing. When it decreases to Min value, the value should become bigger until it reaches Max Value.

Can you help me out again?
Thanks again.
0 Kudos
Message 5 of 7
(3,336 Views)
I think VI I included in my answer to your question will do what you want. Just drop it in your loop and it will count as you specify.

Have a look and see if this will do what you need.

Ed


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 6 of 7
(3,336 Views)
here you are.


cheers!
ian
PS: You might consider modify it with state-machine
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 7 of 7
(3,336 Views)