Hardware Reference
In-Depth Information
7.12.3 Considerations for the Key-Wake-Up Application
The main application of the key-wake-up feature is to support the power-saving modes of
the HCS12. Application software puts the microcontroller in low-power mode by executing a
stop or a wai instruction when the inactivity of the end user has exceeded the preset time.
Many applications are designed to be a wait loop that waits for the user to enter a request
for service. When a request is entered, the application calls an appropriate routine to provide the
service. After the service is done, the routine returns to the wait loop. After providing service
to a user request, the application software starts a timer. If the user enters another command
before the timer times out, the application software resets the timer and responds to the user
request. If the timer times out before the user makes another service request, the application
software puts the microcontroller in low-power mode to save power. As long as there is no user
request for service, the microcontroller will stay in the low-power mode. The timer timeout
interval could be a few minutes or longer depending on how much power the user wants to
save. Either the timer output compare or modulus down counter function can be used to imple-
ment the timeout interval. When the user presses the key, the microcontroller will exit the
low-power mode and continue to execute the instruction following the stop (or wai) instruction
and another cycle of the normal application loop is started.
In order to be used in a key-wake-up application, port pins must be configured for input.
Ports H, J, and P can be configured to use the rising or falling edge to wake up the micro-
controller. The choice of signal edge will dictate the choice of the pull-up or pull-down resis-
tive device. As shown in Figure 7.42, a rising edge results when a high voltage is applied to a
pull-down resistor; a falling edge results when a low voltage is connected to a pull-up resistor.
Therefore, the designer should enable the pull-down resistor when a rising edge is selected and
enable a pull-up resistor when a falling edge is chosen to wake up the microcontroller.
Since the purpose of the key-wake-up feature is to enable the microcontroller to resume
normal operation mode, the interrupt service routine need only perform minimal operation.
The minimal operation to be performed would be to clear the interrupt flag set by the wake-up
interrupt.
The logic flow of an embedded application that incorporates key-wake-up interrupt is
illustrated in Figure 7.43.
V DD
Current
flow
direction
Inside the chip
Pull-up
device
V IN
V DD )
(from key
switch)
V X (=
V X (= 0 V)
(from key
switch)
V IN
Pull-down
device
Current
flow
direction
Inside the
chip
Figure 7.42 (a) Pull-down resistor creates rising edge; (b) Pull-up resistor creates
falling edge
 
 
Search WWH ::




Custom Search