K) Port H Key Wakeup Interrupt - Motorola 68HC12 User Manual

Table of Contents

Advertisement

Port H Key Wakeup Interrupt:
Operation
This is a new feature that was incorporated into the HC12.
interrupt when the appropriate edge is detected on the input to the port.
ideal for use with a keypad, or can be used as extra IRQ lines for the HC12.
Each bit of Port H can be used to generate a Key Wakeup interrupt when a falling
edge is detected.
an interrupt independently of the others, the same interrupt will be called
regardless of which bit triggered it.
bit is enabled using _H12KWIEH.
the corresponding bit of Port H to generate an interrupt when a falling edge is
detected.
The flag bits for the Key Wakeup interrupt are located in _H12KWIFH.
Multiple flags can be set at the same time, although software must be written in
order to determine which flags have been set.
one to the flag bits that have been set.
before the Key Wakeup Interrupt is enabled to prevent any false triggers.
_H12KWIEH:
bit 7
bit 6
bit 7
bit 6
_H12KWIFH:
bit 7
bit 6
bit 7
bit 6
Sample Code
This code will trigger a Port H Key Wakeup interrupt when a falling edge is
detected on any bit of Port H.
_ _mod2_ _ void KeyH(void);
void _ _main(void)
{
DB12->SetUserVector(PortHKey,KeyH); // Set Vector address
_H12KWIFH=0xFF;
_H12KWIEH=0xFF;
while(1)
{
}
}
_ _mod2_ _ void KeyH(void)
{
_H12KWIFH=_H12KWIFH;
}
It is important to note that even though each bit can generate
Writing a 1 to a bit in the register will enable
bit 5
bit 4
bit 5
bit 4
bit 5
bit 4
bit 5
bit 4
//function prototype
// make sure flags aren't set.
//Enable all key wakeups for port H
// Port H Key Wakeup ISR
// clear the flags
The Key Wakeup Interrupt for each individual
The flags are cleared by writing a
It is a good idea to clear the flags
bit 3
bit 2
bit 3
bit 2
bit 3
bit 2
bit 3
bit 2
27
This generates an
bit 1
bit 0
bit 1
bit 0
bit 1
bit 0
bit 1
bit 0
This is

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents