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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/21/08 17:34
Read: times


 
#157639 - this code with correction
Responding to: ???'s previous message
#include<port.h>
#include"var_extern.h"
#include<intrins.h>
//p1=row
//p2=col
bdata unsigned char row_no,col_no;
sbit col_no0=col_no^0;
bit debounce=1;
void delay(unsigned int itime)
{
int i,j;
for(i=0;i<1275;i++)
{
for(j=0;j<itime;j++){}
}
}
void col_check()
{
unsigned char i;
for(i=0;i<8;i++)
{
if(col_no0==0)
{
break;
}
col_no=col_no>>1;
}
col_no=i;
}
unsigned char key_scan()
{
unsigned char temp,i,key=100;
col=0xff;
row=0x00;
while(col==0xff)
{
}
temp=col;
delay(20);
while(col==0xff)
{
}
if(temp!=col)
{
debounce=0;
key=100;
return key;
}
else
{
while(col==0xff)
{
}
temp=col;
delay(10);
while(col==0xff)
{
}
if(temp!=col)
{
debounce=0;
key=100;
return key;
}else
{

temp=0xfe;
for(i=0;i<8;i++)
{
row=_crol_(temp,i);
if(col!=0xff)
{
col_no=col;
col_check();
key=key_matrix[i][col_no];
col=0xff;
row=0x00;
while(col!=0xff)
{
}
return key;

}
}
}
}

}
void keypad_init()
{
col=0xff;
row=0x00;
}



List of 15 messages in thread
TopicAuthorDate
problem in 8x8 keypad            01/01/70 00:00      
   I see ...            01/01/70 00:00      
      this code with correction            01/01/70 00:00      
         Try the Insert Code button.            01/01/70 00:00      
            code with comment            01/01/70 00:00      
               Lots of things to look into            01/01/70 00:00      
                  reply            01/01/70 00:00      
                     One way to debounce            01/01/70 00:00      
               One Suggestion            01/01/70 00:00      
                  the easy way to do keypads            01/01/70 00:00      
   indent, indent, indent            01/01/70 00:00      
   problem in keypad            01/01/70 00:00      
      Where is the code?            01/01/70 00:00      
         code of 8x8 keypad            01/01/70 00:00      
            Simplify and think about debounce            01/01/70 00:00      

Back to Subject List