Keypad data reception

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View

I am doing a project which needs to interface a AT compatible keypad.
I find somethimes the keys returned is wrong. I used external
interrupt to obtain serial data from the PS2 interface. I suspect that
during reception timer interrupt or other interruptes make the data
conrrupted as some edges are missed.

What could I do? What is the usual method to do PS2-interface data
reception? Use another delicated MCU to do the PS2 data reception?


Re: Keypad data reception
We'd need more info like which processor you used,language,power supply,etc.

I've used the PIC16F84 for years as 'keyboard convertors'. Gads, showing my


Re: Keypad data reception
Quoted text here. Click to load it

The problem still exists after I have disabled all interrupts except
the external interrupt 0. The MCU used is ATMega32. The code is
modified from appnote AVR313 to GCC. The following is the code:

    static unsigned char data;//Holds the received scan code
  if(edge)//Routine entered at falling edge
        MCUCR=2;//Set interrupt on falling edge
    if(--bitcount==0)//All bits received
        //Routine entered at rising edge
        if(bitcount<11&&bitcount>2)//Bit 3 to 10 is data. Parity bit,
            //start and stop bits are ignored.
                data|=0x80;//Store a '1'
    MCUCR=3;//Set interrupt on rising edge

I found the problem happens more frequently when I typed fast.

Re: Keypad data reception
Quoted text here. Click to load it

Hi, your method should work ok, you are useing the clock edge as the interrupt
souce? If you have other higher priority interrups running that coould cause a
problem if they are long routines, try to shorten them.

Re: Keypad data reception (CBarn24050) wrote in message
Quoted text here. Click to load it

I have disabled all other interrupts and found the code runs without problem.


Re: Keypad data reception
Quoted text here. Click to load it

A cynic is a man who knows the price of everything and the value of

Lady Chatterly

"Can a robot even be gay?" -- Starshine Moonbeam

Site Timeline