A simple demo showing use of SysTick to perform background tasks or
checks.
Assumes LED + Resistor on IO(1), DIP pin #24.
' Defs from LPC1114.bas
#define SYSTICK_ISR *&H1000003C ' 15: The SysTick handler
#define ST_BASE_ADDR &HE000E000
#define ST_CTRL *(ST_BASE_ADDR + &H10)' Control and Status
Register
#define ST_RELOAD *(ST_BASE_ADDR + &H14)' Reload Value Register
#define ST_CURR *(ST_BASE_ADDR + &H18)' Current Value Register
INTERRUPT SUB SYSTICK ' Called when Systick counter rolls over
OUT(1) = not IN(1) ' toggle the LED
ENDSUB
SUB SetSysTick
SYSTICK_ISR = (Addressof SYSTICK) + 1 ' set IRQ function -- need the
+1 for Thumb operation
ST_RELOAD = 12000000 ' 48000000/12000000 = 1/4
second
ST_CURR = 0 ' Clear Counter
ST_CTRL = &H7 ' Enable SysTick
ENDSUB
Main:
IO(1)=0 ' Configure output and turn LED On
SetSysTick ' Enable SysTick
While (1) ' Go do something useful!!
Loop
-cp