CPU: Altering SuperTimer 10mS timebase [D>=20]
In dialects 20 or later you can change the basic 10mS SuperTimer clock interval to some other value. Set U0 to the required value in mS and then execute a
Pause 100 ;pause for 100 * 10ms = 1 second
...
SetU 0,1 ;load U[0] with 1, representing 1ms
SPxCmd1 1,!CPU ;set the timer tick to 1ms
...
Pause 100 ;now pause for 100 * 1ms = 100ms
On an ARM based SPLat contrller (black PCB) this instruction only affects the multi-track task that executed it. All other tasks will continue to use the 10ms tick unless they also change their timebase too. However on a classic 8 bit SPLat controller (the green PCB) executing this instruction impacts every task as they all have the same tick timebase.
Regardless of the controller type, this instruction affects all timers that use the SuperTimer mechanism, which is any timer that can have a duration counter up to 16,777,215 (Pause
, fSTTimeSince
, WaitOnT
, etc). If you set the interval to 1, the timing will run on a 1ms tick, this being 10 times faster than normal. If you set it to 256, the timing will run a 256ms tick, being 25.6 times slower than normal and giving you a timing range of 49.7 days. If U0=0 it reverts to the default 10mS.
Due to the resolution of the internal math, the re-scaling will produce an error of up to 0.2% at the slow end of the scale. The actual error will be the error produced by rounding 65,536/U0 to the nearest integer.
Note that altering the SuperTimer timebase does not affect the Countdown timers.