|
Navigation: Bibliotheken > Interrupt > 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
}