|
//編碼器中斷,下降沿觸發(fā)
void INT1_interrupt(void) interrupt 2 using 0
{
DelayUS(10);
if(P3^3 == 0) //INT1引腳
{
DelayUS(10);
if(P3^3 == 0)
{
DelayUS(10);
if(P3^3 == 0)
{
DelayUS(10);
if((CS_KEY2 & 0x10) == 0x00)//第5引腳低電平
{
DelayUS(10);
if((CS_KEY2 & 0x10) == 0x00)
{
DelayUS(10);
if((CS_KEY2 & 0x10) == 0x00)
{
if(g_bLeft_Rigth_flg == 0)
{
g_bLeft_Rigth_flg = 1;
}
else
{
//編碼器向右旋轉(zhuǎn),+
EX1 = 0;
INC_Function();
}
}
}
}
else
{
DelayUS(10);
if((CS_KEY2 & 0x10) == 0x10) //第5引腳高電平
{
DelayUS(10);
if((CS_KEY2 & 0x10) == 0x10)
{
if(g_bLeft_Rigth_flg == 1)
{
g_bLeft_Rigth_flg = 0;
}
else
{
//編碼器向左旋轉(zhuǎn),-
EX1 = 0;
DEC_Function();
}
}
}
}
}
}
}
|
|