Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4 Armite F4 ArmiteH7 CMM2

SETTICK period, target [, nbr]
SETTICK FAST frequency, interruptroutine


SETTICK period, target [, nbr]
This will setup a periodic interrupt (or "tick"). Four tick timers are available ('nbr' = 1, 2, 3 or 4). 
'nbr' is optional and defaults to timer number 1. 
The time between interrupts is ‘period’ milliseconds and ‘target' is the interrupt subroutine which will be called when the timed event occurs. 
The period can range from 1 to 2147483647 ms (about 24 days). 
These interrupts can be disabled by setting ‘period’ to zero (ie, SETTICK 0, 0, 3 will disable tick timer number 3).

SETTICK FAST frequency, interruptroutine (CMM2 only)
This allows you to exceed the current maximum rate of 1 interrupt per millisecond (1000HZ) and has been tested up to 50KHz. 
If the interrupt routine overruns the time available then interrupts will be lost. 
If the program is executing a statement that takes longer than the time between interrupts the interrupts will be stacked.

 SETTICK 1000, ticktock, 1
 PRINT "start "; TIME$
 PAUSE 10000 ' interrupts trigger during PAUSE
 PRINT "first pause ended  "; TIME$
 SETTICK 0,,1 ' interrupt disabled
 PAUSE 10000
 PRINT "second pause ended "; TIME$
 SETTICK 1000, ticktock, 1 ' interrupt re-enabled
 DO :LOOP until inkey$ <>""
SUB ticktock
 PRINT "tick "; TIME$

Last edited: 25 February, 2021