📄 defaultisr.c
字号:
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void XINT2_ISR(void) // 0x000D48 XINT2
{
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void ADCINT_ISR(void) // 0x000D4A ADCINT (ADC)
{
int16 u; // fixed pt. control input
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
/*** Manage the interrupt registers ***/
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Must acknowledge the PIE group
/*** Manage the ADC registers ***/
AdcRegs.ADCTRL2.bit.RST_SEQ1 = 1; // reset SEQ1 to CONV00 state
AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1; // clear ADC SEQ1 interrupt flag
/*** Read the thermistor ***/
TEC1.y = AdcRegs.ADCRESULT0 >> 1; // read ADC result, I1Q15
/*** Filter the thermistor reading ***/
#if FILTER != 0 // low-pass filter in use
FirFilter(&TEC1, aLP, NLP); // call the FIR filter function
#else // low-pass filter not in use
TEC1.yf = (3.0/4096)*(float32)(TEC1.y >> 3);
#endif
/*** Compute the controller output ***/
PidCtrl1(&TEC1); // call the PID controller
u = (int16)TEC1.u; // convert to fixed pt.
/** Handle the sign with the H-bridge **/
if(u > 0) EvaRegs.ACTRA.all = ACTRA_pos_mask;
else EvaRegs.ACTRA.all = ACTRA_neg_mask;
EvaRegs.CMPR1 = abs(u); // update the PWM duty cycle
} // end ADCINT_ISR()
/*********************************************************************/
interrupt void TINT0_ISR(void) // 0x000D4C TINT0 (CPU TIMER 0)
{
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void WAKEINT_ISR(void) // 0x000D4E WAKEINT (LPM/WD)
{
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void CMP1INT_ISR(void) // 0x000D50 CMP1INT (EV-A)
{
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
PieCtrlRegs.PIEACK.all = PIEACK_GROUP2; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void CMP2INT_ISR(void) // 0x000D52 CMP2INT (EV-A)
{
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
PieCtrlRegs.PIEACK.all = PIEACK_GROUP2; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void CMP3INT_ISR(void) // 0x000D54 CMP3INT (EV-A)
{
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
PieCtrlRegs.PIEACK.all = PIEACK_GROUP2; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void T1PINT_ISR(void) // 0x000D56 T1PINT (EV-A)
{
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
PieCtrlRegs.PIEACK.all = PIEACK_GROUP2; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void T1CINT_ISR(void) // 0x000D58 T1CINT (EV-A)
{
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
PieCtrlRegs.PIEACK.all = PIEACK_GROUP2; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void T1UFINT_ISR(void) // 0x000D5A T1UFINT (EV-A)
{
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
PieCtrlRegs.PIEACK.all = PIEACK_GROUP2; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void T1OFINT_ISR(void) // 0x000D5C T1OFINT (EV-A)
{
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
PieCtrlRegs.PIEACK.all = PIEACK_GROUP2; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void T2PINT_ISR(void) // 0x000D60 T2PINT (EV-A)
{
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
PieCtrlRegs.PIEACK.all = PIEACK_GROUP3; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void T2CINT_ISR(void) // 0x000D62 T2CINT (EV-A)
{
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
PieCtrlRegs.PIEACK.all = PIEACK_GROUP3; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void T2UFINT_ISR(void) // 0x000D64 T2UFINT (EV-A)
{
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
PieCtrlRegs.PIEACK.all = PIEACK_GROUP3; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void T2OFINT_ISR(void) // 0x000D66 T2OFINT (EV-A)
{
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
PieCtrlRegs.PIEACK.all = PIEACK_GROUP3; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void CAPINT1_ISR(void) // 0x000D68 CAPINT1 (EV-A)
{
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
PieCtrlRegs.PIEACK.all = PIEACK_GROUP3; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void CAPINT2_ISR(void) // 0x000D6A CAPINT2 (EV-A)
{
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
PieCtrlRegs.PIEACK.all = PIEACK_GROUP3; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void CAPINT3_ISR(void) // 0x000D6C CAPINT3 (EV-A)
{
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
PieCtrlRegs.PIEACK.all = PIEACK_GROUP3; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void CMP4INT_ISR(void) // 0x000D70 CMP4INT (EV-B)
{
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
PieCtrlRegs.PIEACK.all = PIEACK_GROUP4; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void CMP5INT_ISR(void) // 0x000D72 CMP5INT (EV-B)
{
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
PieCtrlRegs.PIEACK.all = PIEACK_GROUP4; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void CMP6INT_ISR(void) // 0x000D74 CMP6INT (EV-B)
{
// Work around Compiler v3.03 bug
asm(" SPM 0"); // Compiler not properly setting SPM 0 in ISRs
asm(" CLRC AMODE"); // Compiler not properly setting AMODE=1 in ISRs
// End workaround
PieCtrlRegs.PIEACK.all = PIEACK_GROUP4; // Must acknowledge the PIE group
// Next two lines for debug only - remove after inserting your ISR
asm (" ESTOP0"); // Emulator Halt instruction
while(1);
}
/*********************************************************************/
interrupt void T3PINT_ISR(void) // 0x000D76 T3PINT (EV-B)
{
// Work around Compiler v3.03 bug
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -