Download Print this page

Microchip Technology AN908 Using Manual page 9

Advertisement

FIGURE 10:
VECTOR CONTROL INTERRUPT SERVICE ROUTINE
void __attribute__((__interrupt__)) _ADCInterrupt(void)
{
IFS0bits.ADIF = 0;
// Increment count variable that controls execution
// of display and button functions.
iDispLoopCnt++;
// acumulate encoder counts since last interrupt
CalcVelIrp();
if( uGF.bit.RunMotor )
}
 2004 Microchip Technology Inc.
{
// Set LED1 for diagnostics
pinLED1 = 1;
// Calculate velocity from accumulated encoder counts
CalcVel();
// Calculate qIa,qIb
MeasCompCurr();
// Calculate qId,qIq from qSin,qCos,qIa,qIb
ClarkePark();
// Calculate PI control loop values
DoControl();
// Calculate qSin,qCos from qAngle
SinCos();
// Calculate qValpha, qVbeta from qSin,qCos,qVd,qVq
InvPark();
// Calculate Vr1,Vr2,Vr3 from qValpha, qVbeta
CalcRefVec();
// Calculate and set PWM duty cycles from Vr1,Vr2,Vr3
CalcSVGen();
// Clear LED1 for diagnostics
pinLED1 = 0;
}
AN908
DS00908A-page 9

Advertisement

loading
Need help?

Need help?

Do you have a question about the AN908 and is the answer not in the manual?

Subscribe to Our Youtube Channel