Sign in

username:

password:



Not a member?

Search Comp.Arch.Embedded



Search tips

embedded by Keywords

68HC11 | 68HC12 | 8051 | 8052 | ARM | ARM7 | Asic | AT91 | AT91RM9200 | Atmel | AVR | AVRStudio | Bootloader | CFP | CompactFlash | Cygnal | Cypress | Dataflash | DSP | eCos | EEPROM | Embedded Linux | Emulator | Endian | Ethernet | Firewire | FPGA | Freescale | GCC | GNUARM | GSM | H8 | HDLC | I2C | Infineon | Interrupts | Java | JTAG | LCD | LED | LPC2000 | MCU | Microchip | MMC | MPLAB | MSP430 | PC104 | PCB | PCI | PCMCIA | PowerPC | Rabbit | RS232 | RS485 | RTOS | SBC | SDRAM | Sensor | SPI | STK500 | UART | UML | USART | USB | Verilog | VHDL | VxWorks | Xilinx

Discussion Groups

Discussion Groups | Comp.Arch.Embedded | Looking for 4x4 keypad scan routine for 8052 family chip.

There are 3 messages in this thread.

You are currently looking at messages 0 to 3.

Looking for 4x4 keypad scan routine for 8052 family chip. - Art K6KFH - 21:23 12-04-04



Greetings,
 I'm looking for a basic 4x4 matrix keboard scan routine for the 8052
family of chips.  I want to use one port with 1 nibble as outputs and
the other as inputs and periodically scan for keypresses.  I've done
this many times in the past but it's waaaay past and there isn't much
need to reinvent the wheel.  If someone could point me to a source I'd
appreciate it.  I looked all over 8052.com but couldn't come up with
much.

Thanks,

Art 

Re: Looking for 4x4 keypad scan routine for 8052 family chip. - Gary Kato - 21:58 12-04-04

> I'm looking for a basic 4x4 matrix keboard scan routine for the 8052
>family of chips.  I want to use one port with 1 nibble as outputs and
>the other as inputs and periodically scan for keypresses.

Not much to it. Say your outputs are on the columns. Set all outputs to 1, set
one to 0, then read the inputs. Walk the 0 through the outputs, reading the
inputs (rows) each time. You get a 0 on the inputs if a key was pressed in that
column. You have to have pull-up resistors on the inputs. Don't know if the
8052 provides them built-in or not.

Then you get to do debouncing. Basically wait a few milliseconds then scan the
keypad again. If the results are the same, then take them as valid.

If not, start over again.


Re: Looking for 4x4 keypad scan routine for 8052 family chip. - Alan - 22:40 12-04-04

On 13 Apr 2004 01:58:49 GMT, g...@aol.com (Gary Kato) wrote:

>> I'm looking for a basic 4x4 matrix keboard scan routine for the 8052
>>family of chips.  I want to use one port with 1 nibble as outputs and
>>the other as inputs and periodically scan for keypresses.
>
>Not much to it. Say your outputs are on the columns. Set all outputs to 1, set
>one to 0, then read the inputs. Walk the 0 through the outputs, reading the
>inputs (rows) each time. You get a 0 on the inputs if a key was pressed in that
>column. You have to have pull-up resistors on the inputs. Don't know if the
>8052 provides them built-in or not.
>
>Then you get to do debouncing. Basically wait a few milliseconds then scan the
>keypad again. If the results are the same, then take them as valid.
>
>If not, start over again.

Easier to set all the outputs to 0 and check the inputs to see if any
is a 0 (or nibble is not 1111), then do the scanning if required.

Or, alternatively, use the "any 0" to trigger an interrupt (don't know
if you can do this with the 8052?) maybe even with an diode OR gate
tied onto the interrupt line.

Alan

++++++++++++++++++++++++++++++++++++++++++
Jenal Communications
Manufacturers and Suppliers of HF Selcall
P O Box 1108, Morley, WA, 6943
Tel: +61 8 9370 5533 Fax +61 8 9370 5106
Web Site: http://www.jenal.com 
e-mail: http://www.jenal.com/contact.php
++++++++++++++++++++++++++++++++++++++++++