Go Down

Topic: Using the Hardware Quadrature Encoder Channel on the DUE (Read 83703 times) previous topic - next topic

al_iraqi



please help me can change the #define PERIOD_VALUE   (250)  to be #define PERIOD_VALUE   (value of speed from the rotary encoder)             

al_iraqi

please help me, can change the #define PERIOD_VALUE   (250)  to be #define PERIOD_VALUE   (value of speed from the rotary encoder)   

dooeh

I just wanted to add (for anyone who finds this thread in the future) that you can deal with the underflow by type-casting the register value to a signed 32 bit number.

Code: [Select]
encoderPosition = (int32_t) REG_TC2_CV0;

This will give you negative values as the encoder rotates past zero with the upper and lower limits of int32.

Go Up