国产肉体XXXX裸体137大胆,国产成人久久精品流白浆,国产乱子伦视频在线观看,无码中文字幕免费一区二区三区 国产成人手机在线-午夜国产精品无套-swag国产精品-国产毛片久久国产

新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > 紅外線遙控碼單片機測試程序

紅外線遙控碼單片機測試程序

作者: 時間:2016-11-29 來源:網(wǎng)絡 收藏


void Timer0_ISR() interrupt 1 using 2
{
TR0=0;
TH0=0xff;
TL0=0x47;
TR0=1;
if(++uc1ms == 5)
{
uc1ms = 0;
b1msInt=1;
if(++uc3ms==8)
{
uc3ms=0;
b3msint=1;
SendDataToDispDevice();
}


}
}//void Timer0IntProg() interrupt 1 using 1

void Timer1_ISR() interrupt 3 using 3
{
TR1=0;
TH1=0x00;
TL1=0x00;
TR1=1;

}
void SendDataToDispDevice()
{
unsigned char n;
//watchdog();
if(++ucDispOrder >= 2) ucDispOrder = 0;

if(ucDispOrder==0)
{led1=0;
led2=1;
Nop();
Nop();

}
if(b3msint==1)
{if(ucDispOrder==1)
{led2=0;
led1=1;
Nop();
Nop();
}
}
n = LedData[ucDispData[ucDispOrder]];
P0=n;



} //void SendDataToDispDevice()

void main()
{

init();
beeping();
while(1)
{
TimeProg();
Ir_process();
display();

}

}

void Ir_process()

{

if(NewIRcode==1)
{
NewIRcode=0;
customcode=(Irdcode>>16);
Lcustomcode=customcode>>8;
datacode=(unsigned char)(customcode&0x00ff);


Rdatacode=Lcustomcode;

if(~Rdatacode!=datacode)
{ DataRight=0;
Irdcode=0;
datacode=Rdatacode=0;
}

else
{ DataRight=1;
IR_E=1;
mycode=datacode;}
if(DataRight==1) { bKeySound = 1;DataRight=0; }

}



}

void display()
{
/* unsigned char a[2];
a[0] = mycode & 0x0f;
mycode = mycode >> 4;
a[1] = mycode & 0x0f;
ET0 = 0;
ucDispData[0] = a[0];
ucDispData[1] = a[1];
ET0 = 1;*/
if(IR_E==1)
{
ET0 = 0;
ucDispData[0] = mycode & 0x0f;
mycode = mycode >> 4;
ucDispData[1] = mycode & 0x0f;
IR_E=0;
ET0 = 1;
}
}

void delay(unsigned char x) //x*0.14MS
{
unsigned char a;
while(x--)
{
for (a = 0; a<13; a++) {;}
}
}


/**********************************************************/
void beeping()
{
unsigned char i;

for (i=0;i<100;i++)
{
delay(4);
BEEP=!BEEP;
}
BEEP=1;
}

本文引用地址:http://m.ptau.cn/article/201611/323381.htm

上一頁 1 2 下一頁

評論


技術專區(qū)

關閉