LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

resetting incremental encoder

Solved!
Go to solution

 

Hello, this is a simulation using Labview 2011 ans USB-6009,
the array contains X (angle from incremental encoder counting rising edges) and Y (distance from linear encoder simulated with random numbers).
The rotary encoder is incremental and should be therefore zeroed every 360 points (X), the XY graph should be refreshed to display the last 0-360 values.

 

Pseudo:
if count > 360 then set i = 0 and restart, write another 0-360 array and save all arrays for comparison

 

Question:
Is a case function to be used or two nested for loops with 2 counters, one up to 360 and the other up to the global value?

In normal programming I would divide the total number for 360, if the rest is zero, then I would reset the i counter to zero, but I do not know how to 'translate' this into Labview.
Thank you for suggestions

George

0 Kudos
Message 1 of 2
(3,143 Views)
Solution
Accepted by topic author feanorou

Some points to remark:


@feanorou wrote:

 

Pseudo:
if count > 360 then set i = 0 and restart, write another 0-360 array and save all arrays for comparison

 



Since 360 = 0 the code needs to be : If count >= 360 .... 0-359.9..  small but nasty difference 😉

The function you look for is the

Quotient & Remainder Function

Owning Palette: Numeric Functions

Requires: Base Package

Computes the integer quotient and the remainder of the inputs.

 

Another useful thing is the shift register (see LabVIEW tutorial) you can use in your loop to keep a revolution counter. Whenever that change( increase) you can save update etc.

 

 

 

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 2 of 2
(3,130 Views)