National CP3BT26 Computer Hardware User Manual


 
www.national.com 66
CP3BT26
13.2 PROGRAMMING PROCEDURES
To set up and use the Multi-Input Wake-Up function, use the
following procedure. Performing the steps in the order
shown will prevent false triggering of a wake-up condition.
This same procedure should be used following a reset be-
cause the wake-up inputs are left floating, resulting in un-
known data on the input pins.
1. Clear the WK0ENA and WK1ENA registers to disable
the MIWU channels.
2. Write the WK0EDG and WK1EDG registers to select
the desired type of edge sensitivity (clear for rising
edge, set for falling edge).
3. Set all bits in the WK0PCL and WK0PCL registers to
clear any pending bits in the WK0PND and WK1PND
registers.
4. Set up the WK0ICTL1, WK1ICTL1, WK0ICTL2, and
WK1ICTL2 registers to define the interrupt request sig-
nal used for each channel.
5. Set the bits in the WK0ENA and WK1ENA registers
corresponding to the wake-up channels to be activated.
To change the edge sensitivity of a wake-up channel, use
the following procedure. Performing the steps in the order
shown will prevent false triggering of a wake-up/interrupt
condition.
1. Clear the WK0ENA or WK1ENA bit associated with the
input to be reprogrammed.
2. Write the new value to the corresponding bit position in
the WK0EDG or WK1EDG register to reprogram the
edge sensitivity of the input.
3. Set the corresponding bit in the WK0PCL or WK1PCL
register to clear the pending bit in the WK0PND or
WK1PND register.
4. Set the same WK0ENA or WK1ENA bit to re-enable the
wake-up function.