DM163045 Microchip Technology, DM163045 Datasheet - Page 44
DM163045
Manufacturer Part Number
DM163045
Description
PICDEM Lab Development Kit (with PICkit 3) General Purpose
Manufacturer
Microchip Technology
Series
PICDEM™r
Type
MCUr
Datasheet
1.DM163035.pdf
(96 pages)
Specifications of DM163045
Contents
Board, PIC kit 3
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
For Use With/related Products
PIC Micro® MCU
Available stocks
Company
Part Number
Manufacturer
Quantity
Price
Company:
Part Number:
DM163045
Manufacturer:
MICROCHIP
Quantity:
12 000
PICDEM
DS41369A-page 40
TM
of uncorrected switch bounce can range from being just annoying to catastrophic. The
classic solution involves filtering, such as through a resistor-capacitor circuit, or through
resettable shift registers. These methods are still effective but they involve additional
cost in material, installation and board real estate. Debouncing in software eliminates
these additional costs.
One of the simplest ways to switch debounce is to sample the switch until the signal is
stable or continue to sample the signal until no more bounces are detected. How long
to continue sampling requires some investigation. However, 5 mS is usually adequate,
while still reacting fast enough that the user won't notice it.
The software flowchart for this application is shown in Figure 3-19.
FIGURE 3-19:
The Initialize() now configures the following:
• PORTC
• PORTA
• Timer0 will be configured to implement the 5mS delay as follows:
• Initialize the LED_Output variable to ‘0’
• Initialize the direction bit variable to ‘0’
Lab Development Board User’s Guide
Global Variables:
• 8-bit variable LED_Output will be used to
• 1-bit variable direction used to deter-
- Configure PORTC pins as per the previous labs
- Clear PORTA register.
- Configure RA2 as a digital input pin
- Use the internal instruction clock F
- Increment TMR0 on the low-to-high transition of F
- Assign the prescaler to TMR0 and configure 1:64.
- This is a global variable that will be manipulated by the new Get_Inputs()
light the LEDs connected to PORTC
mine the direction of the sequential LED
flashing
0 = shift PORTC bits right-to-left
1 = shift PORTC bits left-to-right
(see Registers 4-1 and 4-2 in Section 4.1 of the PIC16F690 Data Sheet).
and used to determine PORTC shift direction by the Decide().
MAIN() SOFTWARE CONTROL LOOP FLOWCHART FOR
LAB 5
Loop Forever
OSC
/4 as the TMR0 clock source.
Initialize()
Do_Outputs()
Get_Inputs()
Decide()
Timing()
main()
OSC
/4.
© 2009 Microchip Technology Inc.