??? 07/01/06 10:52 Read: times |
#119509 - check this code. Responding to: ???'s previous message |
I didnot understand what u say about bouncing,my eng.is also poor and knowledge too.
i have written this code. we i a decimal no. and when i press * key it outputs at P3. can anyone tell how i can input values from 0--255. my program just reads 1 key.. after pressing another it overwrites the 1st . should i use arrays??? actually i want to input values from 0-255 and after pressing * key on keypad. LEDs turn ON at port 3, according to input . e.g input 255... 7 LEDs On. tell me what is pullup resistance. and now how can i made keypad.is keypad is simple arrangement of rows or columns or i need some resistances to make a keypad/ #include <ATMEL/AT89X51.H> sbit column1=P2^0; sbit column2=P2^1; sbit column3=P2^2; sbit row1=P1^0; sbit row2=P1^1; sbit row3=P1^2; sbit row4=P1^3; void keyscan(void); void main(void) { while(1) { P2=0x00; P1=0x0F; //1 to each row if (P1!=0x0F) { keyscan(); } } } void keyscan(void) { int key; P2=0x03; //00000011 1st column 0 if (row1==0) { key=1; while(row1==0) {} } if (row2==0) { key=4; while(row2==0) {} } if (row3==0) { key=7; while(row3==0) {} } if (row4==0) { key=0; while(row4==0) {} } P2=0x05; //0000101 2nd column 0 if (row1==0) { key=2; while(row1==0) {} } if (row2==0) { key=5; while(row2==0) {} } if (row3==0) { key=8; while(row3==0) {} } if (row4==0) { key=0; while(row4==0) {} } P2=0x06; //00000110 3rd column 0. if (row1==0) { key=3; while(row1==0) {} } if (row2==0) { key=6; while(row2==0) {} } if (row3==0) { key=9; while(row3==0) {} } if (row4==0) { P3=key; while(row4==0) {} } } |