This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem with basic system keypad interface 4x3

Hi All,

I am trying to interface a simple 4x3 keypad i have never used 89C2051, i am using port 3.
The pins i am using are p3.0,p3.1,p3.2,p3.3,p3.4,p3.5,p3.7

this is the basic code i am using

unsigned int keyData()
{

        unsigned int i,j;
        P3=0xf0;
        i=P3;
        P3=0x0f;
        j=P3;
        return (i+j);
}

call

switch(keyData())
 {

case 55:                // Key 1
LEDR = 1;BUZZ = 1;
key_delay();key_delay();
goto start;
break;
.
.
.}

I am considering p3.6 =0;
i have put two pull ups to p1.1 and p1.0 i was told to do so when i asked my problem to a person i know.

i do not understand the working of the AIN pins may be that is where i am going wrong.

Please help.

Thanks,
Ajay

Parents Reply Children
  • hi Andy

    In the data sheet it says that

    P3.6 is hard-wired as an input to
    the output of the on-chip comparator and is not accessible
    as a general purpose I/O pin.

    I have tried doing both things using a pull-up and not using a pull-up.

    also assumed value of P3.6 as 1 or 0.

    I do not know if value of p3.6 can vary ie 0 or 1 between execution with the pull-ups in place.

    Thanks
    ajay