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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/29/06 19:27
Read: times


 
#119366 - 2
Responding to: ???'s previous message
//I alos tried it...but u know i am beginner...this code is not logically write.i dont understand what to do knwo.....


#include <ATMEL/AT89X51.H>
void wait(void);
sbit column1=P1^4;
sbit column2=P1^5;
sbit column3=P1^6;
sbit row1=P1^0;
sbit row2=P1^1;
sbit row3=P1^2;
sbit row4=P1^3;
void rowscan(void);

void main(void)
{

while(1)
{

P1=0x0F;
if (row1==0||row2==0 ||row3==0 || row4==0)
{
rowscan();
}


}
}
void rowscan(void)
{
int a[4]={0,0,0,0},t=0,k,r,m=100;
static int sum=0;
if (column1==0 && row1==0)
{
a[t]=1;
}
if (column2==0 && row1==0)
{
a[t]=2;
}
if (column3==0 && row1==0)
{
a[t]=3;
}
if (column1==0 && row2==0)
{
a[t]=4;
}
if (column2==0 && row2==0)
{
a[t]=5;
}
if (column3==0 && row2==0)
{
a[t]=6;
}
if (column1==0 && row3==0)
{
a[t]=7;
}
if (column2==0 && row3==0)
{
a[t]=8;
}
if (column3==0 && row3==0)
{
a[t]=9;
}

if (column1==0 && row4==0)
{
a[t]=15;
}
if (column2==0 && row4==0)
{
a[t]=0;
}
if (column3==0 && row4==0)
{
a[t]=16;
}
t++;
for (k=0;k<3;k++)
{

if (a[k]==15)
{
r=0;
while (a[r]!=15 && r<4)
{
P2=0;
sum=sum+m*a[k];
m=m/10;
r++;
}


}
}

if (sum>0)
{
P2=sum;
}
wait();
}


void wait(void)
{
int f =0;
while (f<33000)
{
f++;

}

}

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