Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
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)
{}
}
}




List of 36 messages in thread
TopicAuthorDate
4x3 keypad interfacing with At89c51            01/01/70 00:00      
   5 errors            01/01/70 00:00      
      Nice attitude!            01/01/70 00:00      
         If the approach is that anyone can get h            01/01/70 00:00      
            Do we know him?            01/01/70 00:00      
               Switch Depressed?            01/01/70 00:00      
                  continous and continous            01/01/70 00:00      
                     Thanks Erik!            01/01/70 00:00      
                  Taking samples            01/01/70 00:00      
                     debounce scheme.            01/01/70 00:00      
                        How to debounce without jumps and branch            01/01/70 00:00      
                           Thank you Kai...            01/01/70 00:00      
                           Having gone through your detailed descri            01/01/70 00:00      
                              Yes, I think so            01/01/70 00:00      
                                 Could you assist me to know that            01/01/70 00:00      
                                    Vertically incrementing            01/01/70 00:00      
                                       Thanks            01/01/70 00:00      
               Homework it is            01/01/70 00:00      
                  "Guilty"...            01/01/70 00:00      
   Post your code            01/01/70 00:00      
      2            01/01/70 00:00      
         There have been several threads            01/01/70 00:00      
         How to post code            01/01/70 00:00      
         why so complex            01/01/70 00:00      
         What Compiler ?            01/01/70 00:00      
            Compiler.KEIL            01/01/70 00:00      
         general idea            01/01/70 00:00      
            Diodes to prevent ghosting            01/01/70 00:00      
    Algorithm for Scanning 4*4 Keypad            01/01/70 00:00      
      thanks            01/01/70 00:00      
         If you'd searched, you'd have had this            01/01/70 00:00      
            Search term "4x4 keypad"            01/01/70 00:00      
   check this code.            01/01/70 00:00      
      Answers            01/01/70 00:00      
   Sorry kai.            01/01/70 00:00      
      keypad scanner in C            01/01/70 00:00      

Back to Subject List