LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Store a variable to add every time X occurs LegoNxt

Hello, i was working on a VI to check encoder values on my motor, i want the program to add 1 to a variable or some stored integer every 1140 ticks of the encoder, allowing me to track how many rotations that motor makes over the course of the program, i built a system to check the encoder, and a way to initally set a value, but i dont know how to create a variable to store it in, i tried using a local variable, but it wont let me set the value from a constant, any help would be appriciated

0 Kudos
Message 1 of 5
(2,806 Views)

Use a shift register on your loop.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 5
(2,692 Views)

i have never used a shift register, could you explain what it does?

0 Kudos
Message 3 of 5
(2,690 Views)

It is used to pass a value from one loop iteration to the next.

 

For example, the following code is used to add the numbers 1 through 10.

 

Simple Shift Register (Add).png



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 5
(2,677 Views)

It depends on your requirements. In general, I have found the use of a shift register in the loop to do the job. See png file.

0 Kudos
Message 5 of 5
(2,676 Views)