LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How I do change this equation (A = A+1) to be


LabVIEW Block diagram. Please exsample. Thank you.
0 Kudos
Message 1 of 4
(3,052 Views)
You can do it by using a local variable, or a shift register.
See the example attached
0 Kudos
Message 2 of 4
(3,052 Views)
NOT wrote:

> How I do change this equation (A = A+1) to be
> LabVIEW Block diagram. Please exsample. Thank you.

This is how I do it;

Assuming you have defined 'A' as a numeric control (or indicator) then
you can create a local variable for it. Right Click on the 'A' Control's
symbol on the block diagram> create>local variable. You should see a new
rectangle representing the local variable.


Then
feed the 'A' Control symbol into an ' +1' increment symbol (get from
the numeric or arithmetic palette I think). Feed the output from this
into the local variable for 'A' that you created as above.

Note local variables can be set to be "Read" or "Write" , you need
"Write" but I think this is the default. Otherwise Right Click on the
variable and "Set to Write".
0 Kudos
Message 3 of 4
(3,052 Views)
> > How I do change this equation (A = A+1) to be
> > LabVIEW Block diagram. Please exsample. Thank you.
>
> This is how I do it;
>
> Assuming you have defined 'A' as a numeric control (or indicator) then
> you can create a local variable for it. Right Click on the 'A' Control's
> symbol on the block diagram> create>local variable. You should see a new
> rectangle representing the local variable.
>
> Then
> feed the 'A' Control symbol into an ' +1' increment symbol (get from
> the numeric or arithmetic palette I think). Feed the output from this
> into the local variable for 'A' that you created as above.
>

While this will work, and is a direct translation, it is hopefully
not what you will be doing very often. This -- read local, modify,
write local
-- is what you might do if the code needs to update the
user interface.

Another translation is to take the value on a numeric wire. If the
value of the wire is A, then drop a numeric increment node, wire
the A wire to the left, and from the right side comes A+1. Now
wire the value to wherever it is needed.

This may not seem like much of a big deal, but if these literal
translations are applied too often, the LV diagram ends up being
lots of small read, modify, write code snippets that then need
to be sequenced. The writes are often made to an open panel which
needs to redraw things, and that takes thousands of times longer
than updating the variable. Basically, too much of this leads to
a diagram that is hard to modify, hard to debug, hard to read, etc.

Greg McKaskle
0 Kudos
Message 4 of 4
(3,052 Views)