C.3.2
Applications
Reliable, robust software requires debouncing of all mechanical switches. This
includes push buttons of all types, limit switches of all types and even X*Y matrix
keyboards. Matrix keyboards offer a new challenge to debouncing. Keyboards are not
a single line input level but a pattern on several inputs. One pattern represents all keys
released, or the stable state. All other patterns represent keys pressed, or the unstable
states. Reliable keyboards can be designed by debouncing to only the stable state, but
allowing new actions to occur immediately upon a change from one unstable state to
another. The solution is left to the interested student.
C.3.3
Running the Demos
There are three switch debounce demos: Debounce, SwchFltr and DbncFltr. The file
name suffix denotes the source code language for each demo. The suffix “.asm”
denotes assembly language. The suffix “.c” denotes C language. Use the Intel 32-bit
hex file output as the input file to the PICkit 1 Flash Starter Kit demo board. Intel hex
files are denoted by the “.hex” file suffix.
C.3.3.1
DEBOUNCE DEMO
Debounce is the Brute Force Debounce demo. Each button push in this demo causes
LED D0 to toggle on or off.
Perform the following steps to run the Debounce demo:
1. Connect the USB cable to the USB PC port and to the PICkit 1 Flash Starter Kit
demo board.
2. Execute the PICkit 1 Flash Starter Kit programming software.
3. From the toolbar menu, select File -> Import Hex . Browse to locate the hex file
named “Debounce.hex”. Select this file and click the Open button.
Note:
The Program Memory window displays the program code.
4. Click the Write Device button. The status of the program write is displayed in the
status bar located at the bottom of the interface window.
5. To run the demo, push the SW1 switch on the board and observe that LED D0
toggles as expected.
C.3.3.2
SwchFltr DEMO
SwchFltr is an abbreviation for the Switch Filter Debounce demo. In this demo, LED D1
lights up when SW1 is pushed. When SW1 is released, LED D0 lights up.
Repeat steps 1 through 5 above and load the SwchFltr.hex file to run this demo.
C.3.3.3
DbncFltr DEMO
DbncFltr is an abbreviation for Debounce Filter. This demo is a combination of the
Debounce and Switch Filter demos. DbncFltr also demonstrates timed expansion of
switch functions. This demo initializes in the Switch Filter mode. Holding the button
down for more than 1 second, while in the Switch Filter mode, causes the demo to
change to the Brute Force method. LED D0 will light as an indication of the change.
Holding the button down for more than 1 second, while in the Brute Force mode,
causes the demo to change to the Switch Filter method. LED D1 will light as an
indication of the change.
Repeat steps 1 through 5 above and load the DbncFltr.hex file to run this demo.
? 2004 Microchip Technology Inc.
DS40051D-page 45
相关PDF资料
DV164120 KIT STARTER PICKIT 2
DV164121 KIT PICKIT 2 DEBUG EXPRESS
DV164122 ANALYZER SRL PICKIT W/DEMO BOARD
DV164131 KIT STARTER PICKIT 3
DV164132 KIT EVAL F1 FOR PIC12F1/PIC16F1
DV243003 KIT STARTER FOR SRL MEM PRODUCTS
DVA1001 ADAPTER FOR PIC16F716 18DIP
DVA1004 DEVICE ADAPTER 8/14/20DIP
相关代理商/技术参数
DV164101 制造商:Microchip Technology Inc 功能描述:TOOLS: FLASH MICROCONTROLLER (
DV164102 功能描述:开发板和工具包 - 无线 rfPICkit RoHS:否 制造商:Arduino 产品:Evaluation Boards 工具用于评估:AT32UC3L 核心:AVR32 频率: 接口类型:USB 工作电源电压:5 V
DV164120 功能描述:电路内置调试器 PICkit 2 8/14/20P Flash RoHS:否 制造商:Microchip Technology 产品:In-Circuit Debugger Kits 工具用于评估:PIC MCUs, dsPIC DSCs 用于:07-00024, AC164113 核心:dsPIC, PIC 接口类型:USB 工作电源电压:3 V to 5 V
DV164121 功能描述:电路内置调试器 PICkit 2 Debug Express RoHS:否 制造商:Microchip Technology 产品:In-Circuit Debugger Kits 工具用于评估:PIC MCUs, dsPIC DSCs 用于:07-00024, AC164113 核心:dsPIC, PIC 接口类型:USB 工作电源电压:3 V to 5 V
DV164121 制造商:Microchip Technology Inc 功能描述:ICPICKIT2 PROGRAMMER/DEBUGGER ((NW))
DV164121+TEFLCST3 制造商:Microchip Technology Inc 功能描述:KIT PICKIT2+FLOWCODE-HOME BUNDLE 制造商:Microchip Technology Inc 功能描述:ICD, PICKIT 2, FLOW CODE, PIC, DSPIC 制造商:Microchip Technology Inc 功能描述:ICD, PICKIT 2, DEBUG EXP, FLOW CODE, PIC, DSPIC; Silicon Family Name:PIC12F6xx, PIC16F5xx; Core Architecture:PIC; Core Sub-Architecture:PIC12, PIC18, PIC24; IC Product Type:Debugger / Programmer; Series:PICkit 2 ;RoHS Compliant: Yes
DV164122 功能描述:界面开发工具 PICkit Ser Analyzer RoHS:否 制造商:Bourns 产品:Evaluation Boards 类型:RS-485 工具用于评估:ADM3485E 接口类型:RS-485 工作电源电压:3.3 V
DV164126 功能描述:开发板和工具包 - PIC / DSPIC USB Kit w/ PICkit LowPinCount RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压: