標(biāo)題:
流水燈c程序設(shè)計(jì) 求幫助
[打印本頁(yè)]
作者:
小雞快跑8090
時(shí)間:
2018-1-14 16:32
標(biāo)題:
流水燈c程序設(shè)計(jì) 求幫助
(2)對(duì)整個(gè)口進(jìn)行賦值操作,如P0= ~ 0x01; P0= ~ 0x02; P0= ~ 0x04; 實(shí)現(xiàn)8位的LED流水燈。
例2:LED1:亮0.5S,暗0.5S—LED2:亮0.5S,暗0.5S。。。。。LED8:亮0.5S,暗0.5S—LED1:亮0.5S,暗0.5S—循環(huán)往復(fù)。
IMG_1269.PNG
(72.47 KB, 下載次數(shù): 28)
下載附件
2018-1-14 16:32 上傳
作者:
lhl139679
時(shí)間:
2018-1-14 17:49
#include <stdio.h>
作者:
lhl139679
時(shí)間:
2018-1-14 18:35
#include <stdio.h>
int count = 0;
void main()
{
P2 = 0xFF;
TMOD = 0x01;
TH0 =(-50000)/256 ;
TL0 = (-50000)%256;
ET0 = 1;
EA = 1;
TR0 = 1;
while(1);
}
void dingshiqi() interrupt 1
{
TH0 =(-50000)/256;
TL0 = (-50000)%256;
count++;
if(count == 10)
{
P2 = ~P2;
count = 0;
}
}
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1