02-16-2012 03:22 PM
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
Solved! Go to Solution.
02-17-2012 02:34 AM
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
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.