Parallel Input/Output Control
MCF51CN128 Reference Manual, Rev. 6
9-11
Freescale Semiconductor
9.5.1.2
Edge and Level Sensitivity
A valid edge or level on an enabled port pin sets the KBI
x
SC[KBF] bit. If KBI
x
SC[KBIE] is set, an
interrupt request is generated to the CPU. Write a 1 to KBI
x
SC[KBACK] to clear KBF, provided all
enabled port inputs are at their deasserted levels. KBF remains set if any enabled port pin is asserted while
attempting to clear by writing a 1 to KBACK.
9.5.1.3
Pull-up/Pull-down Resistors
The keyboard interrupt pins can be configured to use an internal pull-up/pull-down resistor using the
associated I/O port pull-up enable register. If an internal resistor is enabled, the KBI
x
ES register is used to
select whether the resistor is a pull-up (KBEDG[n] = 0) or a pull-down (KBEDG[n] = 1).
9.5.1.4
Keyboard Interrupt Initialization
When an interrupt pin is first enabled, it is possible to get a false interrupt flag. To prevent a false interrupt
request during pin interrupt initialization, do the following:
1. Mask interrupts by clearing KBI
x
SC[KBIE].
2. Select the pin polarity by setting the appropriate KBI
x
ES[n] bits.
3. If using internal pull-up/pull-down device, configure the associated pull enable bits in PT
x
PE.
4. Enable the interrupt pins by setting the appropriate KBI
x
PE[n] bits.
5. Write 1 to KBI
x
SC[KBACK] to clear any false interrupts.
6. Set KBI
x
SC[KBIE] to enable interrupts.
9.5.2
Keyboard Programming Model
Refer to tables in
,” for the absolute address assignments for all registers. This section
refers to registers and control bits only by their names.
NOTE
A Freescale Semiconductor-provided equate or header file normally is used
to translate these names into the appropriate absolute addresses.
Table 9-14. Register Set Summary
Register
Description
Access
KBIxSC
Keyboard Interrupt Status & Control Register
read/write
KBIxPE
Keyboard Interrupt Pin Select Register
read/write
KBIxES
KBIx Interrupt Edge Select Register
read/write