字典翻译 问答 其它 单片机51的C程序谁给解释下?#include#includeunsignedcharcodedisplaybit[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};unsignedcharcodedisplaycode[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x00,0x
问题标题:
单片机51的C程序谁给解释下?#include#includeunsignedcharcodedisplaybit[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};unsignedcharcodedisplaycode[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x00,0x
问题描述:

单片机51的C程序谁给解释下?

#include

#include

unsignedcharcodedisplaybit[]={0xfe,0xfd,0xfb,0xf7,

0xef,0xdf,0xbf,0x7f};

unsignedcharcodedisplaycode[]={0x3f,0x06,0x5b,0x4f,

0x66,0x6d,0x7d,0x07,

0x7f,0x6f,0x77,0x7c,

0x39,0x5e,0x79,0x71,0x00,0x40};

unsignedcharcodedotcode[32]={0,3,6,9,12,16,19,22,

25,28,31,34,38,41,44,48,

50,53,56,59,63,66,69,72,

75,78,81,84,88,91,94,97};

unsignedchardisplaycount;

unsignedchardisplaybuf[8]={16,16,16,16,16,16,16,16};

unsignedchartimecount;

unsignedcharreaddata[8];

sbitDQ=P3^7;

bitsflag;

bitresetpulse(void)

{

unsignedchari;

DQ=0;

for(i=255;i>0;i--);

DQ=1;

for(i=60;i>0;i--);

return(DQ);

for(i=200;i>0;i--);

}

voidwritecommandtods18b20(unsignedcharcommand)

{

unsignedchari;

unsignedcharj;

for(i=0;i0;j--);

DQ=1;

}

else

{

DQ=0;

for(j=2;j>0;j--);

DQ=1;

for(j=33;j>0;j--);

}

command=_cror_(command,1);

}

}

unsignedcharreaddatafromds18b20(void)

{

unsignedchari;

unsignedcharj;

unsignedchartemp;

temp=0;

for(i=0;i0;j--);

if(DQ==1)

{

temp=temp|0x80;

}

else

{

temp=temp|0x00;

}

for(j=200;j>0;j--);

}

return(temp);

}

voidmain(void)

{

TMOD=0x01;

TH0=(65536-4000)/256;

TL0=(65536-4000)%256;

ET0=1;

EA=1;

while(resetpulse());

writecommandtods18b20(0xcc);

writecommandtods18b20(0x44);

TR0=1;

while(1)

{

;

}

}

voidt0(void)interrupt1using0

{

 

纪丰伟回答:
  unsignedcharcodedisplaybit[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};定义数码管显示位选数组unsignedcharcodedisplaycode[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,...
点击显示
其它推荐
热门其它推荐
  • 其它