单片机51的C程序谁给解释下?#include #include unsigned char code displaybit[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};unsigned char code displaycode[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x00,0x

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/28 04:44:32
单片机51的C程序谁给解释下?#include #include unsigned char code displaybit[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};unsigned char code displaycode[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x00,0x

单片机51的C程序谁给解释下?#include #include unsigned char code displaybit[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};unsigned char code displaycode[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x00,0x
单片机51的C程序谁给解释下?
#include
#include
unsigned char code displaybit[]={0xfe,0xfd,0xfb,0xf7,
0xef,0xdf,0xbf,0x7f};
unsigned char code displaycode[]={0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71,0x00,0x40};
unsigned char code dotcode[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};
unsigned char displaycount;
unsigned char displaybuf[8]={16,16,16,16,16,16,16,16};
unsigned char timecount;
unsigned char readdata[8];
sbit DQ=P3^7;
bit sflag;
bit resetpulse(void)
{
unsigned char i;
DQ=0;
for(i=255;i>0;i--);
DQ=1;
for(i=60;i>0;i--);
return(DQ);
for(i=200;i>0;i--);
}
void writecommandtods18b20(unsigned char command)
{
unsigned char i;
unsigned char j;
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);
}
}
unsigned char readdatafromds18b20(void)
{
unsigned char i;
unsigned char j;
unsigned char temp;
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);
}
void main(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)
{
;
}
}
void t0(void) interrupt 1 using 0
{
unsigned char x;
unsigned int result;
TH0=(65536-4000)/256;
TL0=(65536-4000)%256;
if(displaycount==2)
{
P0=displaycode[displaybuf[displaycount]] | 0x80;
}
else
{
P0=displaycode[displaybuf[displaycount]];
}
P2=displaybit[displaycount];
displaycount++;
if(displaycount==8)
{
displaycount=0;
}
timecount++;
if(timecount==150)
{
timecount=0;
while(resetpulse());
writecommandtods18b20(0xcc);
writecommandtods18b20(0xbe);
readdata[0]=readdatafromds18b20();
readdata[1]=readdatafromds18b20();
for(x=0;x255)
{
readdata[1]++;
}
}
readdata[1]=readdata[1]4;
x=x & 0x0f;
readdata[1]=readdata[1] | x;
x=2;
result=readdata[1];
while(result/10)
{
displaybuf[x]=result%10;
result=result/10;
x++;
}
displaybuf[x]=result;
if(sflag==1)
{
displaybuf[x+1]=17;
}
x=readdata[0] & 0x0f;
x=x
就是用DS18B20进行温度检测

单片机51的C程序谁给解释下?#include #include unsigned char code displaybit[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};unsigned char code displaycode[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x00,0x
unsigned char code displaybit[]={0xfe,0xfd,0xfb,0xf7,
0xef,0xdf,0xbf,0x7f};定义数码管显示位选数组
unsigned char code displaycode[]={0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71,0x00,0x40};定义共阴极数码管显示编码数组
unsigned char code dotcode[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};定义ds18b20表格数组
unsigned char displaycount;定义变量
unsigned char displaybuf[8]={16,16,16,16,16,16,16,16};定义显示缓冲
unsigned char timecount;定义变量(计数单元)
unsigned char readdata[8]; 定义变量
sbit DQ=P3^7;定义连接ds18b20端口
bit sflag;定义标致位
.
.

解释了你看不懂,不解释你也看不懂,解释和不解释你都看不懂。
因为你不懂C语言……

不好意思,可以请您把这段程序大致所要实现的功能说一下吗?这样看起来不太好看......

求给编一个51单片机的c程序,满足下列条件! 51单片机的程序是什么意思? 51单片机的程序是什么意思? 单片机51的C程序谁给解释下?#include #include unsigned char code displaybit[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};unsigned char code displaycode[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x00,0x 51单片机与DS18B20程序11.0592MHz的51单片机,Ds18b20检测温度,传给单片机,求C程序!保证时序的! 急求用51单片机和热敏电阻制作温度控制器的C程序及电路图 基于51单片机的led彩灯设计.9个灯(红绿蓝三色).按键控制 c语言程序要求:按下S1 9个闪烁按下S2 红绿灯闪烁按下S3 蓝绿闪烁按下S4 红蓝亮闪烁 求教:单片机C程序中,宏定义中的移位怎么解释?比如#define keyTask (U8)(1 51单片机控制继电器电的电路图和程序 51单片机控制步进电机用一块AD0832对光敏电阻进行数据采集,将数字信号给51单片机,单片机将此数据与自己设定的数据进行比较来控制步进电机转动,求电路图和程序 请问光敏电阻的光弱光强怎么在51单片机的数码管表示出来,C语言程序怎么写 C语言程序,要求两个数通过函数调用比较两个数的大小,并把大数返回给主调函数,输出这个数.要求两个变量的地址作为实参不知道为什么我这个不对,输出的总是先输入的数,无法判断大小.#incl 单片机STC89C52RC 40C-PDIP 0721CV4336…… 能不能解释下各个字母和数字的含义? 谁能给解释一下下面程序的解释是什么意思 求基于单片机直流电机转速检测电路图最好有c语言程序.单片机用89C52的 51单片机,写程序,if(P1_1==0) P2_6=0可是出现一个让我无语的现象,P2_6居然出现3V的电压,P2_6未有连接任何其他电气,谁能解释,感激 谁帮我解释下这个超声波发射器是怎么工作的.一端连接51单片机输出的40kHz的方波信号 加送(+++100分)解释并修改:单片机的C语言程序解决了一点,现在只要回答我unsigned char dispbuf[8]={18,16,16,16,16,16,16,16};是用来干嘛的?能回答上数码管是共阴极还是共阳极我就再给50分