From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Count up and down with constant

I need to create a program that let you select the start and stop number and start count up and after it wounld start counting down from where it stop. The number would incresing from the constant that also the user is going to select.

0 Kudos
Message 1 of 18
(7,735 Views)

@mundo_152 wrote:

I need to create a program that let you select the start and stop number and start count up and after it wounld start counting down from where it stop. The number would incresing from the constant that also the user is going to select.


Show us the vi that isn't working for you.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 18
(7,732 Views)

What have you tried so far?

 

I'm guessing you will need to use some or all of these:

tools.PNG

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 3 of 18
(7,725 Views)

@mundo_152 wrote:

I need to create a program that let you select the start and stop number and start count up and after it wounld start counting down from where it stop. The number would incresing from the constant that also the user is going to select.


 

  • If it is a constant, the user cannot change the value. So what do you mean by "select"?
  • Why do you call it "stop" if it starts counting down at that value? call it "top" instead, for example. 😄
  • Is "Stop" guaranteed to be larger thant "Start"?
  • How fast should it be counting?
  • Should the output be an array of all generated numbers or a scalar that changes over time?
  • .....

It would help if you could give an example of the desired output, e.g.

 

start=5

stop=8

output = 5-6-7-8-7-6-5

 

Is this about right or do you want something different?

0 Kudos
Message 4 of 18
(7,711 Views)
Hope your requirements looks simple but you might have narrated your concept bit informative.

As mentioned by altenbach you can't change the value of constant... that's the reason it is named as constant.

Can have a control outside loop,where user can select value.in the loop you can decide until which value you need to increment and then you can decrement the same number of times.

Use shift register to maintain value.which holds incremented and decremented value.
----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 5 of 18
(7,683 Views)

You don't need any shift registers! Here's a bunch of primitives sufficient to generate the required up-down ramp. All that's missing are the wires. 😄

 

 

 

Some assembly required 😄 😮

(there are many ways to do this of course.)

 

 

Message 6 of 18
(7,678 Views)
The user would only enter the number only once and run the program. Have a a number that would stop from counting up and start counting down. I would to graph the number over time.
0 Kudos
Message 7 of 18
(7,675 Views)

Don't let the user change diagram constants. Use controls like everybody else.

(diagram constant are for the programmer, not for the operator!)

 

(My code above (once assembled!) creates an array of number that you can wire directly to a graph;))

0 Kudos
Message 8 of 18
(7,672 Views)

There is also the Ramp VI in the Signal Processing->Signal Generation palette that could do the job for you.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 18
(7,655 Views)

Altenbach- the "Ikea" of LabVIEW 🙂

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
Message 10 of 18
(7,645 Views)