User manual

PIC18F87J72 Evaluation Board User’s Guide
DS51990A-page 24 © 2011 Microchip Technology Inc.
FIGURE 4-1: Main Routine
Initialize
Peripherals
SPI, UART
SW1
Press?
SW2
Press?
SW4
Press?
SW3
Press?
START
OSR
or
Read Time
Switch
CH0 Gain
Switch
Bits
Switch
CH1 Gain
Switch
Configure ADC,
RTCC, CTMU
Measure
Capacitor
Voltage
Charge CTMU
Pads of 4
Switches
16
SUM and
Average Voltage
Discharge CTMU
Pads of 4
Switches
Check for change
in Capacitance
Calibrate for Pad
Sensitivity (if
required)
Idle
YES YES
YES YES
NO
NO
NO
NO
Idle
1 2 3 4
High Priority
Interrupt
Service
Routine
Interrupt
Request?
5
YES
NO