LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

small project

Hello,

This small part of my project is giving me a hard time. I am sure you champs will figure iit out in a sec.

It's a simple substraction (don't worry about the addition). my problem is to have : total = 501 - y1 - y2 - yn where y is any numerical input.( x is eiher 301 0r 501), I tryed to use **bleep** regis. different ways . It doesn't seem to save the last output.

I appreciate any solution

Thank you,

Labview learner

0 Kudos
Message 1 of 27
(292 Views)

Hi fan,

 

unfortunately you failed in providing a downconverted version of your VI…

 


@soccerfan wrote:

my problem is to have : total = 501 - y1 - y2 - yn where y is any numerical input.( x is eiher 301 0r 501)


I would use a CompoundArithmetic to add/sub those 4 items…

How do you define the "n" in "yn"?

 


@soccerfan wrote:

I tryed to use **bleep** regis. different ways . It doesn't seem to save the last output.


What are "bleep regis."?

When you talk about shift registers: how do you use them in "different ways"? They will ALWAYS store the last written value!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 27
(265 Views)

Thank you for your quick response.

"bleep" is supposed to be "shift" as shift register

Yn as y1-y2-y3....yn

as far as vi i did attach it. i don't know other ways

0 Kudos
Message 3 of 27
(246 Views)

Hi fan,

 


@soccerfan wrote:

as far as vi i did attach it.


I already wrote about providing a downconverted version of your VI… (I prefer LV2019.)

 


@soccerfan wrote:

Yn as y1-y2-y3....yn


That still don't answers how you define the n…

Is "n" the last element of an array?

Do you want to subtract all elements of an array from "501"?

 

What exactly do you want to achieve?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 27
(241 Views)

@GerdW wrote:
Is "n" the last element of an array?

Do you want to subtract all elements of an array from "501"?

 

What exactly do you want to achieve?


Here are a couple of interpretations. Maybe one of these will meet the OP's needs.


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
Message 5 of 27
(202 Views)

@GerdW wrote:

What are "bleep regis."?


That's what you get from the automatic forum censors if you write "shift register", but omit the "f". 😄

Message 6 of 27
(170 Views)

I am afraid you did not understand my problem. "y " is not a array, it's a user input. the saved output is substracted from 501 untill the total is 0,

 ex:    501-100-24-50.......(100, 24, 50 ..are user input)

Your suggestion doesn't save the total untill the next user input

Cheers

 

0 Kudos
Message 7 of 27
(156 Views)

Can you save for version 2020 ? 

0 Kudos
Message 8 of 27
(149 Views)

Aha!  See if I (now) understand what you want to do:

 

  • You start with some number (you seem to like 501 and 301).  Call this "N".
  • You input a number (probably from the keyboard, i.e. "123", but without the quotation marks), it is subtracted from N, and the updated N now appears.
  • You keep on doing this until you reach 0 (or maybe overshoot 0?  or maybe you enter -100, which makes N increase because you are "subtracting a negative number).
  • If/when you reach 0, the program stops.

Here, the key element is the second step, where you wait until the user inputs a number.  Have you learned about the Event Structure?  This is something that can wait until you "fill in" a Front Panel Numeric control, letting the data flow continue when you hit "return".  If this is in a While Loop with a Shift Register that holds the "sum" (or "difference", if you want) that results from subtracting the entered number from the "total" held in the Shift Register.  Since this is all in a While Loop, after doing the subtraction/addition, you can compare the result to 0 and test for it equal to 0, which you wire to the Stop indicator.

 

Of course, I mgiht be guessing entirely wrong about what you are trying to do.  Maybe you should spend a few more weeks learning the fundamentals about LabVIEW ...

 

Bob Schor

0 Kudos
Message 9 of 27
(139 Views)

Thanks for your answer. You almost got it. I cosidere myself an intermadiate labview learner, i still have a long way to go. However ii know a fiew hings about events stucture and that is what i used in this problem

 

soccerfan_1-1732678282031.png

 

0 Kudos
Message 10 of 27
(130 Views)