TIMER
 
Syntax

TIMER
Description


TIMER is a free running timer that increments every microsecond.  Its it readable and writable using this keyword.  It is using the 32 bit TIMER0

Interrupts that are occurring for other time functions and serial input may make times using TIMER look longer than actual.  Interrupts can be disabled for short periods to do fine time measurements.

For Cortex parts with firmware version after 8.27, the SysTick timer is used, which is a 24 bit counter that is set to generate an interrupt every 65.536 milliseconds.  That interrupt increments a 16 counter that is combined with SysTick to generate the 32 bit TIMER value.   For finer resolution a WAITMICRO routine has been added.  And for these parts, disabling interrupts will keep the TIMER from incrementing past 65 msec.

Example

START = TIMER
WHILE (TIMER-START < 10)  ' wait for 10 micro-seconds
LOOP

Differences from other BASICs

See also