void QEIIntHandler(void) { long lDelta; // // Clear the timer interrupt. // TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT); // // Capture the number of edges in the previous time period, and reset the // count for the next time period. // lDelta = g_ulVelCount * 4; g_ulVelCount = 0; // // Get the speed of the motor and convert it from pulses per 1/100th of a / second into rpm. // g_ulSpeed = lDelta = (lDelta * 100 * 60) / ENCODER_LINES * 4; // // Update the PWM duty cycle if the motor is being driven closed-loop. // if(!g_bOpenLoop) { // // Compute a new duty cycle delta. // lDelta = PIDUpdate(&g_sPID, lDelta, g_ulTarget - lDelta); // // Update the PWM duty cycle. // lDelta = g_ulBaseDutyCycle + (lDelta / 10000); SetPWMDutyCycle(lDelta); } }