Forum: Mikrocontroller und Digitale Elektronik Interrupt Code LPC21XX.H


von Manuel (Gast)


Lesenswert?

Hallo,

ich kann diese kleine Code nicht nachvollziehen ,ich bin neu in sachen 
mikrocontroller programmierung.
Können Sie mir bitte helfen und in kürze Sätze den Code erklären.

Danke
Manuel Forino


#include <LPC21XX.H>                     // LPC21XX Peripheral Registers
#include "Timer.h"

long volatile timeval;

/* Timer Counter 0 Interrupt executes each 10ms @ 60 MHz CPU Clock */
__irq void tc0 (void) {
  timeval++;
  T0IR = 1;                                    // Clear interrupt flag
  VICVectAddr = 0;                             // Acknowledge Interrupt
}

/* Setup the Timer Counter 0 Interrupt */
void init_timer (void) {
  T0MR0 = 149999;                       // 10mSec = 150.000-1 counts
  T0MCR = 3;                           // Interrupt and Reset on MR0
  T0TCR = 1;                           // Timer0 Enable
  VICVectAddr0 = (unsigned long)tc0;     // set interrupt vector in 0
  VICVectCntl0 = 0x20 | 4;              // use it for Timer 0 Interrupt
  VICIntEnable = 0x00000010;          // Enable Timer0 Interrup
}

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.