On Timer( interval ) GoSub label
interval | Interrupt interval 1=10ms, 2=20ms……65535=655350ms |
On Timer can be used to repeatedly execute an interrupt routine on a specified interval. Set the desired interval in increments of 10 milliseconds, and a label to jump to when interrupt occurs.
On Timer(100) GoSub TIMERTN Dim i As Integer I = 0 Do Loop TIMERTN: Incr i ' i is incremented by 1 every second. Return
Be aware that the interrupt service routine (ISR) must require less time to execute than the interval itself.
If the interval is set to 10ms, the ISR must execute within 10 ms; otherwise collisions can occur.