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

Interfacing with a 4x4 keypad on same bus

Hey, i have a problem that i have been at for over a day now, and i can not solve this with my skills.
So the problem is as follows. I am trying to get an output from a 4x4 keypad, which would not be a problem but input and output are on the same pins. I know that the 74hc573 should keep the information after LE goes low, but i just can not figure out how to read output from 74hc541 without giving new information to the previous chip, because then the state changes again. At the moment i can only read the keys diagonally, because input and output match in that case.
The schematic of the whole circuit can be seen here

:http://i.imgur.com/FWcJRvP.png
and the problematic part here :http://i.imgur.com/i7vwFXs.jpg

Hope you guys can give a tip and help me understand this.
Thanks

Parents
  • I know, at that is what i have been trying to do

    while(1)
            {
                    for(i=0;i<4;i++)
            {
                            P3_7=0;
                            P3_6=1;
                            in=((0b11110111>>i)&0b00001111);
                            *keypad=in;
                            *led=*keypad;
                            vardelay(100);
                            P3_7=0;
                            P3_6=0;
                            *keypad=0xff;
                            P3_7=1;
                            out=(*keypad&0b00001111);
                            if (in==0b1101&&out==0b1101)
                            {
                                    P3_7=1;
                                    P3_6=1;
                                    lcd_senddata('5');
                            }
                            else if(in==0b1110&&out==0b1101)
                            {
                                    P3_7=1;
                                    P3_6=1;
                                    lcd_senddata('2');
                            }
            }
    

Reply
  • I know, at that is what i have been trying to do

    while(1)
            {
                    for(i=0;i<4;i++)
            {
                            P3_7=0;
                            P3_6=1;
                            in=((0b11110111>>i)&0b00001111);
                            *keypad=in;
                            *led=*keypad;
                            vardelay(100);
                            P3_7=0;
                            P3_6=0;
                            *keypad=0xff;
                            P3_7=1;
                            out=(*keypad&0b00001111);
                            if (in==0b1101&&out==0b1101)
                            {
                                    P3_7=1;
                                    P3_6=1;
                                    lcd_senddata('5');
                            }
                            else if(in==0b1110&&out==0b1101)
                            {
                                    P3_7=1;
                                    P3_6=1;
                                    lcd_senddata('2');
                            }
            }
    

Children