bit keyDown;
uchar keyEven;
void checkKey()
{
uchar i;
uchar temp="0x01";
P4|=0x0f;
if((P4&0x0f)!=0x0f)
{
if(keyDown)
{ mdelay(10);
if((P4&0x0f)!=0x0f)
{
keyDown=0;
for(i=0;i<4;i++)
{
if((P4&temp)==0)
{
keyEven=i+1;
break;
}
temp<<=1;
}
}
}
}
else
keyDown=1;
}
void Key_Set()
{
if(keyEven==1)
{
keyEven="0";
cData++;
}
if(keyEven==2)
{
keyEven="0";
cData--;
}
}
文章评论(0条评论)
登录后参与讨论