??? 05/10/07 07:39 Read: times |
#138964 - 4 *3 keypad interfacing |
Hi all,
i use 89c52 to interface with 4*3 keypad, this is my code char const columns[3] = {0xef, 0xdf,0xbf }; // var declaration char key_get(void) { //int NO =0; row =0; column=0; while(1) { // P0 = 0x0F; P0 =columns[column]; delayms(10); if( (P0&0x0F)!=0x0f ) { delayms(10); if( (P0&0x0F)== 0x0e) // row scan { row =0; delayms(10); // for debouncing return( KEYS[row][column]); } else if( (P0&0x0F)==0x0d) //scan row { row =1; delayms(10); lcd_data( KEYS[row][column]); return( KEYS[row][column]); } else if( (P0&0x0F)==0x0b) { row =2; delayms(10); lcd_data( KEYS[row][column]); return( KEYS[row][column]); } else if( (P0&0x0F)==0x07) { row =3; delayms(10); return( KEYS[row][column]); } } delayms(1); column++; delayms(1); if (column ==3) { column =0; } } compiler iam using is keilc problems i faced are 1. i used port 0 for keypad lsb for rows and msb for columns.all 1's when no keypressed 0 in row for key pressing, when i tried seeing the port0 using scope my port pins are 0 no change! 2. my crystal pin (xtal2 ) does not produce a sine wave of 5V amp it is only 2.5V. note : i am trying to interface lcd & keypad whatever keys iam pressing that shoulkd be displayed in lcd i also tried 8051 same problem exist kindly give ur valuable suggestion with thanks and regards syed saleem. N |
Topic | Author | Date |
4 *3 keypad interfacing | 01/01/70 00:00 | |
Details | 01/01/70 00:00 | |
Remember that P0 needs pullups? | 01/01/70 00:00 | |
here is schematic! | 01/01/70 00:00 | |
Not there! | 01/01/70 00:00 | |
under what name did you upload that? | 01/01/70 00:00 | |
89s52 instead of ds5000t | 01/01/70 00:00 | |
start a new thread![]() | 01/01/70 00:00 | |
not a big problem | 01/01/70 00:00 |