void Timer1Mode3Init()
{
TH1 = 0xF8; //(65536 - 2000) / 256; set 2ms interrupt
TL1 = 0x30; //(65536 - 2000) % 256;
ET1 = 1; //timer1 overflow interrupt
TMOD |= 0x10 ; // timer1,mode 3
TR1 = 1; // timer 1 start
}
//==================================================================================
//
// name : Timer1 Interrupt
//
// function :
// -
//
//==================================================================================
void timer1(void) interrupt 3 //Timer1 interrupt 3
{
ET1 = 0;
TH1 = 0xF8; //(65536 - 2000) / 256; set 2ms interrupt
TL1 = 0x30; //(65536 - 2000) % 256;
LEDCount++;
ET1 = 1;
}
在中斷里面沒(méi)有重新設(shè)置裝載TH1 TL1的值,在時(shí)間上進(jìn)入的中斷時(shí)間差33倍,為66ms,有點(diǎn)嚇人。
標(biāo)題名稱(chēng):單片機(jī)timer-創(chuàng)新互聯(lián)
URL鏈接:http://chinadenli.net/article2/cdgpoc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供虛擬主機(jī)、外貿(mào)建站、用戶(hù)體驗(yàn)、標(biāo)簽優(yōu)化、網(wǎng)頁(yè)設(shè)計(jì)公司、做網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容