This is an example for UNO32. It setup a 1ms interval interrupt routine for TIMER0 and provide a 1ms 32bits free running counter. With this free running counter, higher level program can do simple time measurement.

In this example, it used this free running counter to toggle the pin P0.31 once per second.

Source files

lpc2xxx_startup.s

MCU startup code, the first MCU instruction is start here.

mcu.c

Routine for MCU: interrupt handler, clock initialization

main.c

C main(), your code will start here

timer0.c

The routine for timer0.

 

Routines provided by timer0.c

void Timer0Init(void);

Initialization of TIMER0, please call it at the beginning of main().

unsigned long GetTick (void);

Return the value of 32bits free running counter.

unsigned long TickElapsed (unsigned long aTick);

Return the time (in ms) between aTick and current value of 32bits free running counter.

Donwload (IAR Project)

 

Please publish modules in offcanvas position.