FieldPoint Family

cancel
Showing results for 
Search instead for 
Did you mean: 

FP-QUAD-510 counting in CW and CCW directions

Hello,
-I have A+  and   B+  Encoder signals connected to FP-QUAD-510 module (Z is N/A).

-I'd like to count in CW direction in positive counts (1,2,3,4....)  and count  negative counts (-1,-2,-3,-4....) in CCW direction

-The FP-QUAD-510   counts from 0,1,2,3....4294967295 in CW direction ,however in the  other  direction it rollsover  from
0,4294967295 ,4294967294,4294967293 ,4294967292 ,.....etc      

-With DAQmx (DAQmxCreateCICountEdgesChan) and STC or TIO counters you can set  mid range value for the counter to start from like 8000000,
the subtract it from the count,this gives the Positive/Negative Counting based on encoder direction.

QUESTION:
-What is the workaround  to make it count  in negative via MAX or Programatically?

Thanks
A.Kat                  
0 Kudos
Message 1 of 6
(7,409 Views)
The programmatic option would be to subtract 8,000,000 from whatever number comes out of the FP read operation.  That way if it is below 8,000,000, it becomes negative.
0 Kudos
Message 2 of 6
(7,397 Views)
i ran into that same problem a while back.  Max doesn't seem to care about negative reading from encoders.  You'll need to take care of it programatically.  I attached a vi i wrote that takes care of ranging for a 16 bit encoder.  the divide factor is my counts per inch (10000) of my linear encoder.  take a look.  Its also got an invert function, in case your CW and CCW don't match up right away.
0 Kudos
Message 3 of 6
(7,349 Views)

Hi Wdkng_24,

I don't completely understand what you are doing in your VI.  If the actual count is less than 20,000 you subtract 65535, if it isn't then you leave it alone.

So if your input is 0-20,000 you get -65,535 to -45,535, but 20,001 and above would be 20,001 to .........  (this is all before invert and divide by 10,000)

Why the disjointed output?

0 Kudos
Message 4 of 6
(7,344 Views)
umm, that seems backwards.  if its below 20,000 it should run straight through, and if its above 20000 it should subtract full scale to go negative ... hold on, let me look .... yeah, if its less that 20000 counts the number should run straight through, divide by counts per inch to output in this case deflection in inches.   its it is greater than 20000 counts (because in my system, 20000 counts is 2", and it will never deflect that much) it then subtracts full scale and makes the number negative.  does that make more sense?
0 Kudos
Message 5 of 6
(7,342 Views)

You're right.  I flipped the logic in my mind.  I usually set up the true case to be the "Do something" case and the false case to be the "Do nothing case".   And the fact that it never exceeds two inches is significant.

The key thing for MyKat is to determine what are the possible encoder outputs, what they physically mean, and what engineering value they should be.  Then it is just a matter of determining the correct math.  The possible range of encoder readings, whether the encoder can wrap around in count, or whether the physical device can exceed some predetermined limits would all come into play.

 

0 Kudos
Message 6 of 6
(7,337 Views)