This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28379D: How to calculate actual mechanical degrees using the EQEP

Part Number: TMS320F28379D

Hello 

In your sample project EQEP_ex2_pos_speed/Eqep_ex2_calculation.c you calculate a mechanical theta. I was expecting this number to be in degrees. It is in fixed point Q15 format. When I convert from Q15 to floating point it gives me very small number.  

Can you explain how I can obtain degrees from 0 - 360. 

//
// The following lines calculate
//
// p->thetaMech ~= QPOSCNT / mechScaler [current cnt/(total cnt in 1 rev)]
//
// where mechScaler = 4000 cnts/revolution
//
temp = (int32_t)p->thetaRaw * (int32_t)p->mechScaler; // Q0 * Q26 = Q26
temp &= 0x03FFF000;

p->thetaMech = (int16_t)(temp >> 11); // Q26 -> Q15
p->thetaMech &= 0x7FFF;