C Control PRO UNIT MEGA 32 198206 Benutzerhandbuch

Produktcode
198206
Seite von 134
83
C-Control Pro Mega 32
© 2005 Conrad Electronic
Tabelle Interrupt Vektoren:
Nr
Interrupt Name
Beschreibung
0
INT_0
externer Interrupt0
1
INT_1
externer Interrupt1
2
INT_2
externer 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
Analog Comparator
10
INT_ADC
ADC
11
INT_TIM2COMP
Timer2 Compare
12
INT_TIM2OVF
Timer2 Overflow
5.3.9.9 IRQ Beispiel
Beispiel: Verwendung von Interrupt Routinen
// Timer 2 läuft normalerweise im 10ms Takt. In diesem
// Beispiel wird daher die Variable cnt alle 10ms um 1 erhöht
int cnt;
void ISR(void)
{
    int irqcnt;
    cnt=cnt+
1
;
    irqcnt=Irq_GetCount(INT_TIM2COMP);
}
void main(void)
{
    cnt=
0
;
    Irq_SetVect(INT_TIM2COMP,ISR);
    while(true);  // Endlosschleife
}