DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4 Armite F4 ArmiteH7 Picomite CMM2
CPU SLEEP [ sec [, abortpin]]
Set the clock speed of the processor. 'speed' is set in MHz and on the 28/44 pin Micromite it can be either 48, 40, 30, 20, 10, or 5.
On the Micromite Plus it can be 120, 100, 80, 60, 48, 40, 30, 20, 10 or 5.
Current drawn by the chip is proportional to the clock speed, so by halving the clock speed the current drain is roughly halved.
The default speed of the CPU when power is applied is 40 MHz on the 28/44 pin Micromite and 100MHz on the Micromite Plus.
When the speed is changed all timing functions in MMBasic will be automatically corrected to keep the correct time and the console baud rate will be unchanged.
The serial communications ports can remain open during the speed change and their speed will be adjusted accordingly.
Note that there may be a glitch while changing speed and some characters may be lost or corrupted.
The speed of any SPI, I2C and PWM functions open at the time will change with the clock speed. For this reason they should be closed before this command is used and reopened after.
CPU SLEEP [ sec [, abortpin]]
Put the CPU to sleep. In this mode the running program will be halted and the current drain reduced to about 40 uA.
In the first form the WAKEUP pin (see the pinout tables at the start of this manual) will be automatically configured as a digital input and any change
in its state (ie, from high to low or low to high) will wakeup the CPU. The time required to "wake up" in this mode is less than 1 ms.
The IR command shares the WAKEUP pin and if it is running the CPU will be awakened by the remote key press and MMBasic will immediately decode the signal and execute the IR interrupt.
In the second form (CPU SLEEP seconds) the command will put the CPU to sleep for the specified number of 'seconds' (accuracy is กำ20%). The TIMER function and the internal clock/calendar will be updated when the sleep finishes.
The timed sleep can be terminated early if 'abortpin' is specified. This can be any I/O pin and any change in its state (ie, from high to low or low to high) will abort the sleep. It can take up to a second for the abort signal to be recognised so the change of state must be maintained for at least this time.
The CPU will go to sleep in the middle of the SLEEP command and when awakened continue with normal program execution.
All communications (serial, SPI, I2C and 1-Wire) and PWM will be frozen during sleep. When the CPU comes out of sleep they will resume normal processing. It is recommended that they be closed before
entering sleep as they will add to the current drawn by the chip in sleep.
External circuitry and program features can cause extra current drain while in sleep. See the section Micromite Special Features in the Micromite manual for the steps that should be taken to minimise the current drawn during sleep.
All timing functions will freeze during the sleep, this includes the real time clock and background pulse commands.
CTRL-C on the console will not bring the chip out of sleep.
Also see CPU RESTART
Last edited: 28 January, 2021