
已解决问题
谷歌zhenghaili1022用户在2016.05.31提交了关于“张爱玲求51单片机的c语言程序”的提问,欢迎大家涌跃发表自己的观点。目前共有1个回答,最后更新于2025-02-14T21:28:04。希望大家能够帮助她。详细问题描述及疑问:期待您的答案,谢了,下次有事儿别忘了找我 !
详细问题描述及疑问:期待您的答案,谢了,下次有事儿别忘了找我 !
#include<s
#
#defineucha
#defineuin
ucharcodetable[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71,
0x00};
sbitadrd=
sbitadwr=P3^6;
sb
sbitwel
uchard
ucha
uchardate3=100;
u
uchardate5=200;
uchardate6=255;
u
voidinit();
v
ucharadchushihua();
voidshu
voidprocessing();
voidmain()
{
init();
while(1)
{
sz=adchushih
for(a=10;a>0;a--)
{
shumaguan(sz);
p
}
}
}
voidinit
{
P0=0x7f;
}
vo
{
uintx,y;
for(x=z;x>0;x--
for(y=110;y>0;y--);
}
uchar
{
ucharshuzhi;
adwr=1;
_n
adw
_nop_();
a
P1=0xff;
adrd=1;
_nop_();
adrd=0;
_nop_();
shuzhi=P1;
adrd=1;
returnshuzhi;
}
voidshumaguan
{
ucharbai,shi,g
bai=shu/100;
s
ge=s
**la=1;
P0=tabl
**la=0;
P0=0xff;
wela=1;
P0=0x7e;
wela=0;
delay(5);
**la=1;
P0=table[shi];
**la=0;
P0=0xff;
wela=1;
P0=0x7d;
wela=0;
delay(5);
**la=1;
P0=table[ge];
**la=0;
P0=0xff;
wela=1;
P0=0x7b;
wela=0;
delay(5);
}
voidprocessing()
{
if((sz>=date1)&&(sz<=date2))
{
P1=0xfe;
}
elseif((sz>=date2)&&(sz<=date3))
{
P1=0xfd;
}
elseif((sz>=date3)&&(sz<=date4))
{
P1=0xfb;
}
elseif((sz>=date4)&&(sz<=date5))
{
P1=0xf7;
}
elseif((sz>=date5)&&(sz<date6))
{
P1=0xef;
}
elseif(sz==date6)
{
P1=~P1;
delay(20);
}
}
这个是我刚刚写的根据你的需要反正闲来无事我写的比较笼统需要你自己根据自己的实际情况来判断确定我只是利用AD简单的处理成数码管显示的数字你要是转换成电压那就把里面的变量修改一下我写的那个控制LED灯亮就不要动了只是修改一下他前面定义的数字就可以最后那个是我自己加上去的有点趣味性希望对你有帮助