L) Port J Key Wakeup Interrupt - Motorola 68HC12 User Manual

Table of Contents

Advertisement

Port J Key Wakeup Interrupt:
Operation
The Port J key Wakeup Interrupt is a more powerful version of the Port H Key Wakeup
Interrupt.
Unlike the Port H Key Wakeup, Port J can be set to trigger on either a
rising edge or a falling edge input.
wakeup but also adds to the complexity.
The selection of which bits will be used to generate interrupts is controlled by
_H12KWIEJ.
As with port H, when a bit is set to 1, the Key Wakeup for that channel
is enabled.
Also as with the Port H Key Wakeup, while each bit can cause an
interrupt, they all call the same interrupt service routine.
_H12KWIEJ:
bit 7
bit 6
bit 7
bit 6
_H12KWIFJ:
bit 7
bit 6
bit 7
bit 6
Before enabling the Key Wakeup Interrupt it is necessary to set which edge will
trigger the interrupt and to select to use either the pull-up or pulldown resistors
on the input.
Which edge will be used to trigger an interrupt is determined by the setting of
_H12KPOLJ.
Writing a zero to a bit of _H12KPOLJ makes that channel falling edge
triggered.
Writing a one makes the channel rising edge triggered.
_H12KPOLJ:
bit 7
bit 6
bit 7
bit 6
The pull-up and pulldown resisters are controlled by _H12PUPSJ and _H12PULEJ.
_H12PUPSJ selects between using pull-up resisters and pulldown resisters.
bit in _H12PUPSJ is set to one, the channel has a pull-up resistor.
is zero, there is a pulldown resistor on the input.
pull-up/pulldown resistors are enabled.
pulldown resistor.
zero will disable it.
_H12PULEJ:
bit 7
bit 6
bit 7
bit 6
_H12PUPSJ:
bit 7
bit 6
bit 7
bit 6
As with the Port H Key Wakeup, the flags are cleared after a Port J Key Wakeup
Interrupt is triggered.
that have been set.
Sample Code
This code sets up the Port J Key Wakeup for falling edge operation on all 8
channels and enables the pull up resistors for all the bits.
_ _mod2_ _ void KeyJ(void);
bit 5
bit 4
bit 5
bit 4
bit 5
bit 4
bit 5
bit 4
bit 5
bit 4
bit 5
bit 4
Writing a one enables the pull-up or pulldown, while writing a
bit 5
bit 4
bit 5
bit 4
bit 5
bit 4
bit 5
bit 4
This is done by writing a one to the bits in _H12KWIFJ
// function prototype
This adds to the flexibility of the key
bit 3
bit 2
bit 3
bit 2
bit 3
bit 2
bit 3
bit 2
bit 3
bit 2
bit 3
bit 2
This MUST be set before the
_H12PULEJ is used to enable the pull-up or
bit 3
bit 2
bit 3
bit 2
bit 3
bit 2
bit 3
bit 2
28
bit 1
bit 0
bit 1
bit 0
bit 1
bit 0
bit 1
bit 0
bit 1
bit 0
bit 1
bit 0
When the bit
bit 1
bit 0
bit 1
bit 0
bit 1
bit 0
bit 1
bit 0
When a

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents