Electronic Design

  
Reprints     Printer-Friendly    Email this Article    RSS        Font Size     What's This?


[Ideas For Design]
Keyboard scanner provides system supervision

Contributing Author  |   ED Online ID #6335  |   January 26, 1998


The circuit shown scans a numeric keypad while also generating 16-ms timing interrupts, low-line resets, and power-fail warnings for a larger system (see the figure). The core of the circuit is a versatile PIC16C54 microcontroller augmented by a microprocessor supervisor (IC3).

In place of the microcontroller shown in the figure, most systems typically employ dedicated logic—a keyboard-interface IC such as the 74C922, a time-base generator such as the 74C4060, a 32-kHz crystal, and a microprocessor supervisor. The small and inexpensive PIC, however, offers design flexibility in exchange for some simple code development (see the listing part a and part b).

The microprocessor supervisor generates activehigh and active-low resets in response to a low VCC voltage. It comes in 5-V and 3.3-V versions; the one shown is a 5-V type with a trip threshold of 4.4 V. It also monitors the battery via the power-fail input (PFI), with a trip threshold of 6.4 V set by R1 and R2. Battery status is read by the PIC at IC3’s !PFO output, and encoded as the MSB (RB7) of an 8-bit data word returned to the main processor every 16 ms.

Other data bits in this byte pertain to the keypad—a 4-by-4 matrix-type such as the Grayhill 84S-BC series. The PIC scans the keypad for contact closures by issuing consecutive “1”s on the low nibble of the bidirectional RB port (RB0-RB3) and watching for a tell-tale “1” on the high nibble. It then converts this row-column information to a 4-bit code, issues it on RB1-RB4 (along with the rest of the byte), enables the latch (IC1), and issues an interrupt. If no key was pressed, the key code is all “0”s on RB0-RB4 (otherwise RB0 is a “1”).

The duration of each contact also is measured by the PIC. A minimum 32-ms interval (two scans or ticks) verifies a valid closure and debounces the contacts. Closure duration is encoded as 0 to 1 tick, 2 to 10 ticks (<0.16 seconds), 10 to 20 ticks (0.16 to 0.32 seconds), or >20 ticks (>0.32 seconds), and returned to the system as data bits RB5 and RB6. This data enables the main processor to provide an autorepeat function for the keypad.

Finally, the crystal-accurate 16-ms interrupts provide a time base for the processor that eliminates the need for a separate time-base generator and crystal. Other advantages (over the discrete CMOS MSI approach) include: flexibility—the software allows for easy changes in the keyboard code, auto-repeat time, debounce delay, interrupt rate, etc.. Board space⇓the PIC is available in a surface-mount package and IC3 comes in a tiny shrink SO-8 “µMax” package. Cost and reliability—the PIC uses a standard AT crystal instead of the fragile 32-kHz-type otherwise required.


Reprints   Printer-Friendly  Email this Article  RSS    Font Size   What's This?


  • In EDA, A Year Of Mergers, Failed And Otherwise
  • 2008 BEST Electronic Design Winners
  • Engineers Rely On Internet For Product Info
  • Rochester Electronics Establishes New Design and Technology Group
  • November 17, 2008
  • Custom Sources Light Way To 22-nm IC Lithography
  • Software Turns Scopes Into Vector RF Signal Analyzers
  • Couple’s $15 Million Gift Advances Rice Engineering Education
    1) Behind The Bright Lights, LED Drivers Evolve To Meet New Requirements
    (732 views today)
    2) Build A Smart Battery Charger Using A Single-Transistor Circuit
    (271 views today)
    3) Wi-Fi Chips Stand Out In A Sea Of Wireless Products
    (205 views today)
    4) What's All This "Adjustable Slew Rate Stuff," Anyhow?
    (187 views today)
    5) Ten Top Design Skills For Tough Times
    (184 views today)
    ALL TOP 20



    POST YOUR COMMENTS HERE
    Name:

    Email:
    Your Comments:

    Enter the text from the image below


    Please refresh the page if you have trouble reading this text.

    Search Electronic Design
         
      
     
    Web Seminar
    Sponsored By:
    Title: Read Pacing: A Performance Enhancing Feature of PCI Express Gen 2 Switch Devices
    Speakers: 
    Date: 07/01/08
    Register: 

    Electronic Design Europe Electronic Design China EEPN Power Electronics Auto Electronics Microwaves & RF
    Mobile Dev & Design Schematics Find Power Products Military Electronics EE Events Related Resources