Low-power modes and interrupts
One of the more useful features of a CPU chip, particularly
for embedded processors in battery powered sensors, is some
form of SLEEP or WAIT command that lets the CPU idle along
on low power until something happens to required the CPU to
take action. In many sensors, the need for action is
seconds to minutes or even hours apart. Meanwhile, the
battery loses charge ...
My first use of interrupts was on a 68HC11 card where I
needed to put the CPU to sleep for about 30 minutes. In
this sensor, I used a RealTimeClock chip to generate an IRQ
interrupt to wake the CPU. This interrupt occurred once per
minute; the CPU would check the time and decide if it was
time to take data. If not, it went back to sleep for
another minute. This process took a few milliseconds and
added very little to the current budget.
Most recently, I converted a 68HC12 sensor to use the Real
Time Interrupt to reduce the current draw roughly in half.
This sensor also checks the time on a RTC (this one in a
Dallas Semiconductor NVRAM chip) to decide if it is time to
take data. In this case, the CPU enters WAIT mode for
roughly 3 seconds and then checks for input on the serial
port and checks the time. Given neither, it re-enters WAIT
mode. Never could get a real SLEEP mode to work on this
chip, however.