Microchip PIC24FJ32GU202 Bedienungsanleitung


Lesen Sie kostenlos die đź“– deutsche Bedienungsanleitung fĂĽr Microchip PIC24FJ32GU202 (25 Seiten) in der Kategorie Nicht kategorisiert. Dieser Bedienungsanleitung war fĂĽr 3 Personen hilfreich und wurde von 2 Benutzern mit durchschnittlich 4.5 Sternen bewertet

Seite 1/25
AN2805
Robust Debouncing with Core-Independent Peripherals
Introduction
Author: Qubo Hu, Microchip Technology Inc.
Typical button debouncing approaches are often not sufficiently robust, and with slow setup and
response, which may lead to ghost or non-detected stimuli. This Tips and Tricks document presents two
more robust and quick debouncing solutions, which equally applies to rotary encoders, buttons, switches,
keypads, knobs, and the like. By using an internal timer to provide customized slower clock and
Configurable Logic Cells (CLCs), it is possible to filter out various kinds of button generated noise. One
solution requires two CLCs per button, which on PIC18F Q10 family devices with eight CLCs can support
the debouncing of four buttons. Another solution requires three CLCs per button, which is more robust
and addresses a timing corner case in the 2-CLCs solution. The debouncing is performed in hardware
peripherals with no CPU execution required, after a system initialization which contains the timer and
CLCs configuration. Both solutions require two CLC clock cycles as this gives a very fast debouncing.
An example creation in MPLAB and MCC configuration is described in this document. The example code
for replicating the results is also available from MPLAB Xpress code example: https://
mplabxpress.microchip.com/mplabcloud/example/details/799.
© 2019 Microchip Technology Inc. Other DS00002805A-page 1
Table of Contents
Introduction......................................................................................................................1
1. Background............................................................................................................... 3
1.1. Existing Solutions.........................................................................................................................3
2. Robust Debouncing with CLCs..................................................................................5
2.1. 2-CLCs Debouncing Solution....................................................................................................... 5
2.2. 3-CLCs Debouncing Solution....................................................................................................... 7
2.3. Further Discussions......................................................................................................................8
3. Project Creation and Configuration......................................................................... 10
3.1. Project Overview........................................................................................................................ 10
3.2. Hardware Prerequisites..............................................................................................................10
3.3. Software Prerequisites............................................................................................................... 10
3.4. Hardware Setup..........................................................................................................................11
3.5. 2-CLCs Solution Configuration in MPLAB..................................................................................12
3.6. Generate Code and Program Device.........................................................................................18
3.7. 3-CLCs Solution Configuration in MPLAB..................................................................................18
4. Revision History.......................................................................................................21
The Microchip Website..................................................................................................22
Product Change Notification Service.............................................................................22
Customer Support......................................................................................................... 22
Microchip Devices Code Protection Feature................................................................. 22
Legal Notice...................................................................................................................23
Trademarks................................................................................................................... 23
Quality Management System........................................................................................ 24
Worldwide Sales and Service........................................................................................25
AN2805
© 2019 Microchip Technology Inc. Other DS00002805A-page 2
1. Background
When physically rotating an encoder or pressing a button, two pieces of metal come into contact with
each other. The two pieces of metal can make and break contact intermittently before they are in full
contact. When the input signal crosses the digitization threshold, it could result in multiple pulses of
varying duration in the digitized signal, as illustrated in . Because of the high sample rate of theFigure 1-1
input signal line for the microcontroller to process, multiple pulses on the input signal line can result in
one press/release to be registered as multiple triggers. Ideally, short period pulses of the digitized input
signal are just noise, and these noisy pulses should be filtered out. Only a stable pulse with a long
enough period, which means the input signal is stable for a certain time, should trigger debounce. This
method is called “debouncing”.
Figure 1-1 also illustrates a number of scenarios associated with signal debouncing. In this figure:
• Scenario 1 refers to the case when the encoder is rotated to ON
• Scenario 2 refers to the case when the encoder is rotated to OFF
• Scenario 3 refers to the case when the encoder is mechanically loose or halfway rotated, making the
input signal very unstable
Debouncing is a type of low-pass filter. The debounce time is the delay between the occurrence of the
trigger and the registration of the trigger. This debounce time influences the accuracy of the timestamps.
For scenarios 1 and 2, the edge of a trigger indicating a stable pulse should be registered after the
debounce time, named debounce signal. For scenario 3, many short period pulses can occur in a very
short period on the digitized signal. The user should, in advance, define if these short period pulses are
noisy pulses to be ignored, or if it could be considered as a valid and stable pulse in a certain condition.
In this document, a rotary encoder has been used as an example for demonstration purposes. However,
the same technique applies to also buttons, switches, keypads, and knobs.
Figure 1-1. Debouncing Illustration
1.1 Existing Solutions
For debouncing of slow signals, the simplest hardware solution is to debounce with an external resistive-
capacitive (RC) filter component to filter out quick pulse changes in order to keep clean edges for the
AN2805
Background
© 2019 Microchip Technology Inc. Other DS00002805A-page 3


Produktspezifikationen

Marke: Microchip
Kategorie: Nicht kategorisiert
Modell: PIC24FJ32GU202

Brauchst du Hilfe?

Wenn Sie Hilfe mit Microchip PIC24FJ32GU202 benötigen, stellen Sie unten eine Frage und andere Benutzer werden Ihnen antworten




Bedienungsanleitung Nicht kategorisiert Microchip

Bedienungsanleitung Nicht kategorisiert

Neueste Bedienungsanleitung fĂĽr -Kategorien-