Keyboard interface, Entering in power-down mode, Exiting from power-down mode – Rainbow Electronics AT89C5122 User Manual

Page 184: Watchdog timer during power-down and idle mode

Advertising
background image

184

AT8xC5122/23

4202E–SCR–06/06

Keyboard Interface

The keyboard interface applies only to AT8xC5122 version.

Entering in Power-down Mode

In order to reduce the power consumption, the microcontroller can be set in power-down
or idle mode by software (see Table 13, PCON register). Before activating these modes
the application will need to configure the keyboard interface as follows:

Set all keyboard’s ouputs pins KB Rx at low level by writing a 0 on the ports. This
operation has a double effect:

any key that is pressed generates an interrupt capable of waking-up the
microcontroller,

Set all bits KBE.x in KBE registers to enable interrupts.

Exiting from Power-down
Mode

The microcontroller will exit from Power-down Mode upon a reset or any interrupt gener-
ated by a key press. Note that 1024 clocks are necessary to exit from power-down mode
when a keyboard interrupt occurs. This means that there will be a delay between the
time at which the key is pressed and the time at which the application is able to identify
the key.

Watchdog Timer during
Power-down and Idle
Mode

In Power-down mode the oscillator stops, which means the WDT also stops. While in
Power-down mode the user does not need to service the WDT. There are 2 methods of
exiting Power-down mode : by a hardware reset or by a level activated external interrupt
which is enabled prior to entering power-down mode. When Power-down is exited with
hardware reset, servicing the WDT should occur as it normally does whenever
AT8xC5122D is reset. Exiting Power-down with an interrupt is significantly different. The
interrupt is held low long enough for the oscillator to stabilize. When the interrupt is
brought high, the interrupt is serviced. To prevent the WDT from resetting the device
while the interrupt pin is held low, the WDT is not started until the interrupt is pulled high.
It is suggested that the WDT be reset during the interrupt service for the interrupt used
to exit Power-down.
To ensure that the WDT does not overflow within a few states of exiting of powerdown, it
is best to reset the WDT just before entering powerdown.
In the Idle mode, the oscillator continues to run. To prevent the WDT from resetting
while the microcontroller is in Idle mode, the user should always set up a timer that will
periodically exit Idle, service the WDT, and re-enter Idle mode.

Advertising