User manual

78
Tabel interrupt vectoren:
Nr
Interrupt naam Beschrijving
0 INT_0 Externe interrupt0
1 INT_1 Externe interrupt1
2 INT_2 Externe interrupt2
3 INT_TIM1CAPT Timer1 Capture
4 INT_TIM1CMPA Timer1 CompareA
5 INT_TIM1CMPB Timer1 CompareB
6 INT_TIM1OVF Timer1 Overflow
7 INT_TIM0COMP Timer0 Compare
8 INT_TIM0OVF Timer0 Overflow
9 INT_ANA_COMP Analoge comparator
10
INT_ADC ADC
11
INT_TIM2COMP Timer2 Compare
12
INT_TIM2OVF Timer2 Overflow
5.3.9.9 IRQ voorbeeld
Voorbeeld: gebruik van interrupt routines
// Timer 2 loopt normaalgesproken in de 10msa maat. In dit
// voorbeeld wordt daarom de variabele cnt elke 10ms met 1 verhoogd
int cnt;
void ISR(void)
{
int irqcnt;
cnt=cnt+1;
irqcnt=Irq_GetCountg(INT_TIM2COMP);
}
void main(void)
{
cnt=0;
Irq_SetVect(INT_TIM2COMP,ISR);
while (true); // Eindeloze lus
}