/*****************************************************
键扫函数 unsigned char Get_num(void)
******************************************************/
unsigned char Get_num(void)
{
unsigned char data_in,data_out,i,j,num;
data_out = 0xEF;
for(i=0;i<4;i++)
{
PTS=data_out; //我不懂pts 的意思,
Delay(5);
data_in = PTS; //这里的pts 和上面的pts 有什么区别没、或者就是data_out值
data_in &= 0x0F;
if(data_in != 0x0F)
{
Delay(5);
j = 0;
num = data_in;
while(num&0x01)
{
num>>=1;
j++;
} //end of while(num&0x01)
return(3-i+j*4);
} //end of if(data_in!=0x0F)
data_out<<=1;
} //end of for(i=0;i<4;i++)
return(255);
} //end of unsigned char Get_num(void) |