| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
SUMMARY PIC16CXXX ideally suited interface directly keypad applic
Top Searches for this datasheetAN552 SUMMARY PIC16CXXX ideally suited interface directly keypad application. Built pull-up resistors very current consumption during sleep make very good candidate battery powered remote operations applications. Appendix provides example code. Performance: Code Size Used words bytes Implementing Wake-up Stroke Stan D'Souza Microchip Technology Inc. INTRODUCTION Microchip's PIC16CXXX microcontroller family ideally suited directly interface keypad. high 4-bits PORTB (RB7:RB4) have internal pull-ups trigger "change state" interrupt. This interrupt, enabled, will wake microcontroller from SLEEP. most battery powered applications, microcontroller exercised when pressed (e.g., remote keyless entry system). life battery extended using PIC16CXXX microcontrollers. This done putting PIC16CXXX microcontroller into SLEEP mode most time wake-up only when pressed. FIGURE INTERFACE PIC16CXXX 4x1k LED1 LED2 LED3 LED4 4x100 PIC16CXXX IMPLEMENTATION Figure depicts application where four keys connected RB7:RB4. Internal pull-ups used maintain high level these inputs. this example, LEDs connected RB3:RB0. When pressed, LED1 turned when pressed, LED2 turned PIC16CXXX normally SLEEP mode with "change state" interrupt enabled. When pressed, goes triggers interrupt. Since PIC16CXXX SLEEP, first wakes starts executing code interrupt vector. Note that global interrupt enabled, program execution after interrupt interrupt vector, global interrupt enabled, program starts executing first line code right after SLEEP instruction. After waking de-bounce delay executed which checks port and, depending which hit, associated turned LEDs used purely demonstration purposes. remote keyless entry application, remote code would transmitted when appropriate hit. Figure depicts keypad interface PIC16CXXX microcontroller. When using PIC16CXXX keypad application, internal pull-ups RB7:RB4 enabled, eliminating need external pull-up resistors. series resistors used Electrostatic Discharge (ESD) protection, recommended keypad interface applications. Matrix FIGURE KEYPAD INTERFACE PIC16CXXX 8x100 PIC16CXXX 1997 Microchip Technology Inc. DS00552E-page AN552 Please check Microchip latest version source code. Microchip's Worldwide Address: www.microchip.com; Bulletin Board Support: MCHIPBBS using CompuServe® (CompuServe membership required). APPENDIX WAKUP.ASMPASM 01.40 Released WAKUP.ASM 1-16-1997 16:04:19 PAGE OBJECT CODE VALUE LINE SOURCE TEXT 00000002 00000007 00000010 00000001 00000001 0000 0000 2805 0004 0004 2808 0005 0005 2024 0006 0006 0000 0007 2806 0008 0008 0009 000A 000B 000C 180B 280D 128B 110B 0008 00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00001 00002 00142 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 ;This program demonstrates wake-up Keystroke feature ;the PIC16C71. Port pins configured inputs with ;internal pull resistors, also interrupt associated with ;change input wake chip from ;sleep. global interrupt enabled just before sleep, ;program will vector interrupt vector (0004). not, chip ;will continue execution just after next instruction following ;sleep. this example code, port initialized input ;push-buttons RB7. configured drive LEDs ;corresponding which pushbutton (LED when ;hit on). Sleep executed. When hit, ;processor wakes jumps interrupt vector. ;corresponding turned after released, ;whole process repeated. Program: WAKEUP.ASM Revision Date: 1-16-97 Compatibility with MPASMWIN 1.40 LIST P=16C71 RBPU temp OptionReg include "p16c71.inc" LIST ;P16C71.INC Standard Header File, Version 1.00 Microchip Technology LIST goto start goto ServiceInterrupt start call InitPortB ;initialize port loop sleep ;sleep till goto loop ServiceInterrupt btfsc INTCON,RBIF ;change int? goto ServiceWakup ;yes then service INTCON,T0IE ;clear TMR0 mask INTCON,T0IF ;clear flag return DS00552E-page 1997 Microchip Technology Inc. AN552 00052 00053 00054 00055 00056 000D 00057 000D 118B 00058 000E 0906 00059 000F 100B 00060 0010 2035 00061 0011 0906 00062 0012 39F0 00063 0013 0090 00064 0014 0E10 00065 0015 0086 00066 0016 2018 00067 0017 0009 00068 00069 00070 00071 00072 0018 00073 0018 2035 00074 0019 0906 00075 001A 100B 00076 001B 158B 00077 001C 39F0 00078 001D 1903 00079 001E 0008 00080 001F 0063 00081 0020 118B 00082 0021 0906 00083 0022 100B 00084 0023 2818 00085 00086 00087 00088 0024 00089 0024 1683 00090 0025 3003 00091 Message[302]: Register 0026 0088 00092 0027 3000 00093 0028 0085 00094 0029 30F0 00095 002A 0086 00096 002B 1381 00097 002C 1283 00098 002D 0186 00099 002E 0185 00100 002F 1405 00101 0030 118B 00102 0031 0806 00103 0032 100B 00104 0033 158B 00105 0034 0009 00106 00107 00108 00109 0035 00110 0035 1683 00111 0036 3007 00112 0037 0081 00113 0038 1283 00114 0039 0181 00115 003A 110B 00116 ;This routine checks which lights ;corresponding associated with RB0's when ;RB4's pressed. Finally waits till keys have ;been released before returning form service routine. ServiceWakup INTCON,RBIE ;clear mask comf PORTB,W ;read PORTB INTCON,RBIF ;clear flag call delay16 de-bounce 16mSecs comf PORTB,W ;read port again andlw B'11110000' ;mask outputs movwf temp ;save temp swapf temp,W ;switch high movwf PORTB ;send outputs. call KeyRelease ;check release retfie ;This sub-routine, waits till have been released order save power, chip sleep mode till ;all keys released. KeyRelease call delay16 debounce comf PORTB,W ;read PORTB INTCON,RBIF ;clear flag INTCON,RBIE ;enable mask andlw B'11110000' ;clear outputs btfsc STATUS,z ;key still pressed? return then return sleep ;else save power INTCON,RBIE wake clear mask comf PORTB,W INTCON,RBIF ;clear flag goto KeyRelease ;try again ;This sub-routine, initializes PortB. InitPortB STATUS,RP0 ;select bank1 movlw B'00000011' ;Port_A digital operand bank Ensure that bank bits correct. movwf ADCON1 movlw movwf PORTA ;set port outputs movlw B'11110000' ;RB0-RB3 outputs movwf PORTB ;RB4-RB7 inputs OptionReg,RBPU ;enable pull STATUS,RP0 ;select page clrf PORTB ;init port clrf PORTA ;make port PORTA,0 ;make first high INTCON,RBIE ;disable mask movf PORTB,W ;read port INTCON,RBIF ;clear flag INTCON,RBIE ;enable mask retfie ;enable global return ;delay16 waits approx 16.4mSecs using TMR0 interrupts ;fosc speed 4Mhz. delay16 STATUS,RP0 ;select Bank1 movlw B'00000111' ;fosc/256 TMR0 movwf OptionReg STATUS,RP0 ;select Bank0 clrf TMR0 INTCON,T0IF ;clear flag 1997 Microchip Technology Inc. DS00552E-page AN552 003B 003C 003C 003D 003E 003F 0040 00117 INTCON,T0IE 00118 CheckAgain 1D0B 00119 btfss INTCON,T0IF 283C 00120 goto CheckAgain 128B 00121 INTCON,T0IE 110B 00122 INTCON,T0IF 0008 00123 return 00124 00125 MEMORY USAGE ('X' Used, Unused) 168B ;enable mask ;timer overflowed? check again ;else clear mask ;clear flag 0000 X-XXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0040 -All other memory blocks unused. Program Memory Words Used: Program Memory Words Free: Errors Warnings Messages reported, reported, suppressed suppressed DS00552E-page 1997 Microchip Technology Inc. WORLDWIDE SALES SERVICE AMERICAS Corporate Office Microchip Technology Inc. 2355 West Chandler Blvd. Chandler, 85224-6199 Tel: 480-786-7200 Fax: 480-786-7277 Technical Support: 480-786-7627 Address: http://www.microchip.com AMERICAS (continued) Toronto Microchip Technology Inc. 5925 Airport Road, Suite Mississauga, Ontario 1W1, Canada Tel: 905-405-6279 Fax: 905-405-6253 ASIA/PACIFIC (continued) Singapore Microchip Technology Singapore Ltd. Middle Road #07-02 Prime Centre Singapore 188980 Tel: 65-334-8870 Fax: 65-334-8850 ASIA/PACIFIC Hong Kong Microchip Asia Pacific Unit 2101, Tower Metroplaza Hing Fong Road Kwai Fong, N.T., Hong Kong Tel: 852-2-401-1200 Fax: 852-2-401-3431 Taiwan, R.O.C Microchip Technology Taiwan 10F-1C Tung North Road Taipei, Taiwan, Tel: 886-2-2717-7175 Fax: 886-2-2545-0139 Atlanta Microchip Technology Inc. Sugar Mill Road, Suite 200B Atlanta, 30350 Tel: 770-640-0034 Fax: 770-640-0307 Boston Microchip Technology Inc. Mount Royal Avenue Marlborough, 01752 Tel: 508-480-9990 Fax: 508-480-8575 EUROPE United Kingdom Arizona Microchip Technology Ltd. Eskdale Road Winnersh Triangle Wokingham Berkshire, England RG41 Tel: 5858 Fax: 44-118 921-5835 Beijing Microchip Technology, Beijing Unit 915, Chaoyangmen Dajie Dong Erhuan Road, Dongcheng District China Hong Kong Manhattan Building Beijing 100027 Tel: 86-10-85282100 Fax: 86-10-85282104 Chicago Microchip Technology Inc. Pierce Road, Suite Itasca, 60143 Tel: 630-285-0071 Fax: 630-285-0075 India Microchip Technology Inc. India Liaison Office Legacy, Convent Road Bangalore 025, India Tel: 91-80-229-0061 Fax: 91-80-229-0062 Denmark Microchip Technology Denmark Regus Business Centre Lautrup Ballerup DK-2750 Denmark Tel: 4420 9895 Fax: 4420 9910 Dallas Microchip Technology Inc. 4570 Westgrove Drive, Suite Addison, 75248 Tel: 972-818-7423 Fax: 972-818-2924 Japan Microchip Technology Intl. Inc. Benex 3-18-20, Shinyokohama Kohoku-Ku, Yokohama-shi Kanagawa 222-0033 Japan Tel: 81-45-471- 6166 Fax: 81-45-471-6122 France Arizona Microchip Technology SARL Parc d'Activite Moulin Massy Saule Trapu Batiment Etage 91300 Massy, France Tel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79 Dayton Microchip Technology Inc. Prestige Place, Suite Miamisburg, 45342 Tel: 937-291-1654 Fax: 937-291-9175 Detroit Microchip Technology Inc. Tri-Atria Office Building 32255 Northwestern Highway, Suite Farmington Hills, 48334 Tel: 248-538-2250 Fax: 248-538-2260 Korea Microchip Technology Korea 168-1, Youngbo Bldg. Floor Samsung-Dong, Kangnam-Ku Seoul, Korea Tel: 82-2-554-7200 Fax: 82-2-558-5934 Germany Arizona Microchip Technology GmbH Gustav-Heinemann-Ring D-81739 Germany Tel: 49-89-627-144 Fax: 49-89-627-144-44 Angeles Microchip Technology Inc. 18201 Karman, Suite 1090 Irvine, 92612 Tel: 949-263-1888 Fax: 949-263-1338 Italy Arizona Microchip Technology Centro Direzionale Colleoni Palazzo Taurus Colleoni 20041 Agrate Brianza Milan, Italy Tel: 39-039-65791-1 Fax: 39-039-6899883 11/15/99 Shanghai Microchip Technology Shanghai Golden Bridge Bldg. 2077 Yan'an Road West, Hong Qiao District Shanghai, 200335 Tel: 86-21-6275-5700 Fax: 21-6275-5060 York Microchip Technology Inc. Motor Parkway, Suite Hauppauge, 11788 Tel: 631-273-5305 Fax: 631-273-5335 Jose Microchip Technology Inc. 2107 North First Street, Suite Jose, 95131 Tel: 408-436-7950 Fax: 408-436-7955 Microchip received QS-9000 quality system certification worldwide headquarters, design wafer fabrication facilities Chandler Tempe, Arizona July 1999. Company's quality system processes procedures QS-9000 compliant PICmicro® 8-bit MCUs, KEELOQ® code hopping devices, Serial EEPROMs microperipheral products. addition, Microchip's quality system design manufacture development systems 9001 certified. rights reserved. 1999 Microchip Technology Incorporated. Printed USA. 11/99 Printed recycled paper. Information contained this publication regarding device applications like intended suggestion only superseded updates. representation warranty given liability assumed Microchip Technology Incorporated with respect accuracy such information, infringement patents other intellectual property rights arising from such otherwise. Microchip's products critical components life support systems authorized except with express written approval Microchip. licenses conveyed, implicitly otherwise, under intellectual property rights. Microchip logo name registered trademarks Microchip Technology Inc. U.S.A. other countries. rights reserved. other trademarks mentioned herein property their respective companies. 1999 Microchip Technology Inc. Other recent searchesV581ME01 - V581ME01 V581ME01 Datasheet LT1510 - LT1510 LT1510 Datasheet LT1510-5 - LT1510-5 LT1510-5 Datasheet JW040A0G - JW040A0G JW040A0G Datasheet EN7738A - EN7738A EN7738A Datasheet LA6569 - LA6569 LA6569 Datasheet DS1251Y - DS1251Y DS1251Y Datasheet BG728 - BG728 BG728 Datasheet BGG728 - BGG728 BGG728 Datasheet PK045 - PK045 PK045 Datasheet 74V2G66 - 74V2G66 74V2G66 Datasheet
Privacy Policy | Disclaimer |