Execute a WFI instruction (Wait For Interrupt) which puts the CPU into a
low power state. That state requires an interupt to end it.
Added to version 8.20 of the ARMbasic compiler. The RTC.bas library had
a SUBroutine named SLEEP that has been renamed IDLE.
This function is not
available on LPC2103 or LPC2138 parts. (ARMmite, ARMweb, ARMexpress).
INTERRUPT SUB TIMER1IRQ
T1_IR = 1 ' Clear interrupt
SUB ON_TIMER ( msec,
TIMER1_ISR = dothis + 1 'set function of VIC -- need the +1
for Thumb operation
VICIntEnable or= (1<<2) 'Enable interrupt
T1_MR0 = msec-1 ' set up match number of ms
T1_MCR = 3 '
Interrupt and Reset on MR0
T1_IR = 1 ' clear interrupt
T1_TC = 0 ' clear timer counter
T1_TCR = 1 ' TIMER1 Enable
ON_TIMER(5000, ADDRESSOF TIMER1IRQ)
print "going to sleep"
wait(500) ' if we don't the messages don't
ever come out until we are wake up
Differences from other BASICs
- no equivalent in Visual BASIC
- no equivalent in PBASIC