单片机编程问题,急急急急急急!!!!!! 5
大哥大姐们,,谁会编这个程序啊,,或者修改下我编的程序,,谢谢了啊,很着急,在线等,,谢谢大哥大姐了,,,谢谢我就5分了,,谢谢了,,少了以后在补,,谢谢哥哥姐姐们,,祝...
大哥大姐们,,谁会编这个程序啊,,或者修改下我编的程序,,谢谢了啊,
很着急,在线等,,谢谢大哥大姐了,,,谢谢
我就5分了,,谢谢了,,少了以后在补,,谢谢哥哥姐姐们,,祝你们
天天开心
题目:
使用定时器1,工作方式2,间隔时间0.5秒,亮灯方式:全灭 依次亮P0.0,P0.1,P0.2,.....P0.7到依次亮P1.7,P1.6......
P1.0,到全灭,然后循环(亮灯保持直到全灭)
程序:
#include"reg51.h"
unsigned long neon = 1;
char count;
void init(void){
TMOD = 2;
TH1 = 6;
TL1 = 6;
TCON = 0x10;
IE = 0x82;
}
void T0INT() interrupt 1{
TH1 = 6;
TL1 = 6;
count++;
if(count == 100){
P0 = neon;
P1 = neon>>8;
neon = neon<<1;
if(neon == 0)neon = 1;
count = 0;
neon=neon|(neon>>1);
}
}
void main(void){
init();
P0 = 0;
P1 = 0;
count = 0;
while(1){if (neon==0x3FFFF)
{
P0 = 0;
P1 = 0;
count = 0;neon = 1;
}
}
} 展开
很着急,在线等,,谢谢大哥大姐了,,,谢谢
我就5分了,,谢谢了,,少了以后在补,,谢谢哥哥姐姐们,,祝你们
天天开心
题目:
使用定时器1,工作方式2,间隔时间0.5秒,亮灯方式:全灭 依次亮P0.0,P0.1,P0.2,.....P0.7到依次亮P1.7,P1.6......
P1.0,到全灭,然后循环(亮灯保持直到全灭)
程序:
#include"reg51.h"
unsigned long neon = 1;
char count;
void init(void){
TMOD = 2;
TH1 = 6;
TL1 = 6;
TCON = 0x10;
IE = 0x82;
}
void T0INT() interrupt 1{
TH1 = 6;
TL1 = 6;
count++;
if(count == 100){
P0 = neon;
P1 = neon>>8;
neon = neon<<1;
if(neon == 0)neon = 1;
count = 0;
neon=neon|(neon>>1);
}
}
void main(void){
init();
P0 = 0;
P1 = 0;
count = 0;
while(1){if (neon==0x3FFFF)
{
P0 = 0;
P1 = 0;
count = 0;neon = 1;
}
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询