以文本方式查看主題 - 曙海教育集團(tuán)論壇 (http://www.hufushizhe.com/bbs/index.asp) -- FPGA初中級(jí) (http://www.hufushizhe.com/bbs/list.asp?boardid=25) ---- timer0的應(yīng)用問(wèn)題 (http://www.hufushizhe.com/bbs/dispbbs.asp?boardid=25&id=2774) |
-- 作者:wangxinxin -- 發(fā)布時(shí)間:2010-12-19 13:35:20 -- timer0的應(yīng)用問(wèn)題 #include<reg52.h> unsigned int tt; sbit LED=P1^1; void Init_Timer0(void) { TMOD = 0x01; TH0=0x3C; /* Init value */ TL0=0xB0; EA=1; /* interupt enable */ ET0=1; /* enable timer0 interrupt */ TR0=1; } main() { tt=0; Init_Timer0(); do{ TH0=0x3C; /* Init value */ TL0=0xB0; LED=~LED; tt++; if(tt==2000) { LED=~LED; tt=0; }//指示燈反相*/ } while(!TF0); 為什么燈不能閃爍呢,是程序出問(wèn)題了么,問(wèn)題在什么地方,請(qǐng)高人指點(diǎn)一下,軟件仿真可以通過(guò),但是到實(shí)驗(yàn)板上就沒(méi)有燈閃爍,為什么呢 |