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.

CCS/TMDXIDDK379D: QEP raw theta calculation

Part Number: TMDXIDDK379D

Tool/software: Code Composer Studio

I don't understand the calculation of the raw theta due to the nature of "(*eQEP[m]).QPOSMAX". This is the code in the example project.

-----------------

/* Check the position counter for EQEP1 */ \
v.RawTheta = (*eQEP[m]).QPOSCNT + v.CalibratedAngle; \
if (v.RawTheta < 0) \
v.RawTheta = v.RawTheta + (*eQEP[m]).QPOSMAX; \
else if (v.RawTheta > (*eQEP[m]).QPOSMAX) \
v.RawTheta = v.RawTheta - (*eQEP[m]).QPOSMAX;

-----------------

The problem is that (*eQEP[m]).QPOSMAX = 4*v.LineEncoder

I assume that v.LineEncoder is equal to the number of positions that the encoder has for one revolution of the motor. So why should RawTheta count up for 4 rotations of the motor before being reset? Shouldn't it go from 0 to v.LineEncoder and reset back to 0?

Also, how is QPOSCNT updated, i was unable to find code that updated this variable.

Thank you