<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 設計應用 > 51單片機的中斷函數

51單片機的中斷函數

作者: 時(shí)間:2016-11-23 來(lái)源:網(wǎng)絡(luò ) 收藏
中斷使用interrupt 關(guān)鍵字和終端編號0-4來(lái)實(shí)現:
返回值 函數名 interrupt n
n對應中斷源的編號,中斷編號告訴中斷器中斷程序的入口地址,它對應著(zhù)IE寄存器中的使能位,即IE寄存器中的0位對應著(zhù)外部中斷0。
8051單片機的中斷源以及終端編號如下:

中斷編號中斷源入口地址
0外部中斷00003H
1定時(shí)器/計數器0 溢出000BH
2外部中斷10013H
3定時(shí)器/計數器1 溢出001BH
4串行口中斷0023H

在51系列單片機中,有的單片機多達32哥中斷源,所以終端編號是0-31.
當正在執行一個(gè)特定的任務(wù)時(shí),可能有更緊急的事情需要CPU處理,這就涉及到了中斷優(yōu)先級。高優(yōu)先級中斷可以中斷正在處理的低優(yōu)先級中斷程序,因而最好給每種優(yōu)先級程序分配不同的寄存器組。在C51中可使用using指定寄存器組,using后的變量為0-3的常整數,分別表示51單片機內的4哥寄存器組。中斷函數的完整語(yǔ)法如下:
返回值 函數名([參數])[模式][重入]interrupt n[usingn]
unsigned int interruptcnt;
unsigned char second;
void timer0(void) interrupt 1 using 2
if(++interruptcnt==4000) // 計數到4000
second++; //另一個(gè)計數器
interruptcnt=0; //計數器清零


關(guān)鍵詞: 51單片機中斷函

評論


技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>