SETTICK

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

Syntax:
SETTICK period, target [, nbr]

Description:
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 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$ <>""
end
 
SUB ticktock
 PRINT "tick "; TIME$
END SUB

Last edited: 14 November, 2020