基于温度远程控制系统Word格式文档下载.docx

上传人:b****5 文档编号:16135512 上传时间:2022-11-20 格式:DOCX 页数:29 大小:205.16KB
下载 相关 举报
基于温度远程控制系统Word格式文档下载.docx_第1页
第1页 / 共29页
基于温度远程控制系统Word格式文档下载.docx_第2页
第2页 / 共29页
基于温度远程控制系统Word格式文档下载.docx_第3页
第3页 / 共29页
基于温度远程控制系统Word格式文档下载.docx_第4页
第4页 / 共29页
基于温度远程控制系统Word格式文档下载.docx_第5页
第5页 / 共29页
点击查看更多>>
下载资源
资源描述

基于温度远程控制系统Word格式文档下载.docx

《基于温度远程控制系统Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《基于温度远程控制系统Word格式文档下载.docx(29页珍藏版)》请在冰豆网上搜索。

基于温度远程控制系统Word格式文档下载.docx

【实验内容】

1、熟悉Protues绘制原理图的基本步骤。

2、学会可执行文件的加载以及程序仿真的方法。

3、验证数码管的动态显示效果。

4、验证DS1302写入和读取效果。

5、验证LCD1302显示效果。

6、验证DS18B20温度读取效果。

7、验证串口通信。

8、验证蜂鸣器,矩阵键盘,验证步进电机正反转。

9、验证外部中断,验证串口中断;

【实验步骤】

1、熟悉动态数码管显示的原理,LCD1602显示的原理。

2、熟悉DS1302芯片的写入和读取。

3、熟悉DS18B20芯片的读取。

4、熟悉蜂鸣器的控制;

5、熟悉步进电机的控制;

6、绘制Protues原理图。

7、在ISIS中加载可执行文件a.hex运行仿真,并调试。

【实现效果】

实验效果如图A2所示,完成实验目的所要求的内容。

【实验小结】

通过这次实验是我更加熟悉了LCD1602的显示和DS1302的写入和读取,步进电机的控制和蜂鸣器、矩阵键盘的工作原理,外部中断的使用,串口中断的使用,双机通信的原理,以及keil和Protues的应用。

【附录】

C51源程序

A机程序

#include<

reg51.h>

#definedjP0

#definelcdP1

sbitDQ=P3^7;

sbitRST=P2^2;

sbitSCLK=P2^3;

sbitIO=P2^4;

sbitfmq=P2^1;

sbitRS=P2^5;

sbitRW=P2^6;

sbitEN=P2^7;

sbitK3=P3^2;

sbitK4=P3^3;

unsignedcharsecond,minute,hour,week,day,month,year;

unsignedchart1302[7]={0x15,0x11,0x20,0x47,0x21,0x30,0x00};

unsignedcharcodeggsj[]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,

0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,

0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,

0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,

0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,

0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59};

unsignedcharzf0[5]="

Time:

"

;

unsignedcharzf1[5]="

Temp:

unsignedcharzf2[5]="

Data:

unsignedcharzf3[5]="

Week:

unsignedcharzf4[3]="

-"

unsignedchardjsz[8]={0xfe,0xfc,0xfd,0xf9,0xfb,0xf3,0xf7,0xf6};

unsignedcharxssj[]="

0123456789:

+-.CE>

unsignedcharjssj[8];

unsignedcharsjsj[8];

unsignedcharwdsj[8];

unsignedcharrqsj[11];

unsignedcharm,s,rq;

voidgszh();

voidinit1302();

voidlcdxs2();

voiddelay(unsignedchari)

{

intj;

for(i;

i>

0;

i--)

for(j=10;

j>

j--);

}

voidcktx()

SCON=0X50;

TMOD=0X20;

PCON=0X80;

TH1=0XF3;

TL1=0XF3;

ES=1;

EA=1;

TR1=1;

voidwbzd()

IT0=1;

EX0=1;

IT1=1;

EX1=1;

IP=0x01;

voidint0()interrupt0

if(K3==0)

{

rq=1;

}

voidint1()interrupt2

if(K4==0)

rq=0;

voidsend(unsignedchardat)

SBUF=dat;

while(TI==0);

TI=0;

unsignedcharreceive()

unsignedchardat;

while(RI==0);

RI=0;

dat=SBUF;

returndat;

voidzd()interrupt4

if(RI)

if(m>

=7)

{

m=0;

gszh();

init1302();

}

jssj[m++]=receive();

RI=0;

voidwritecom(unsignedcharcom)

lcd=com;

RS=0;

RW=0;

EN=1;

delay(10);

EN=0;

voidwritedat(unsignedchardat)

lcd=dat;

RS=1;

delay(20);

voidinit()

writecom(0x01);

writecom(0x38);

writecom(0x0c);

writecom(0x06);

unsignedcharread1302(unsignedcharadd)

unsignedcharn,dat,dat1;

RST=0;

SCLK=0;

RST=1;

for(n=0;

n<

8;

n++)

IO=add&

0x01;

add>

=1;

SCLK=1;

SCLK=0;

dat1=IO;

dat=(dat>

1)|(dat1<

7);

SCLK=1;

IO=0;

IO=1;

voidwrite1302(unsignedcharadd,unsignedchardat)

unsignedcharn;

for(n=0;

IO=dat&

dat>

}

voidread1302time()

second=read1302(0x81);

minute=read1302(0x83);

hour=read1302(0x85);

day=read1302(0x8b);

week=read1302(0x87);

month=read1302(0x89);

year=read1302(0x8d);

sjsj[0]=hour/16;

sjsj[1]=hour%16;

sjsj[2]=10;

sjsj[3]=minute/16;

sjsj[4]=minute%16;

sjsj[5]=10;

sjsj[6]=second/16;

sjsj[7]=second%16;

rqsj[0]=year/16;

rqsj[1]=year%16;

rqsj[2]=12;

rqsj[3]=month/16;

rqsj[4]=month%16;

rqsj[5]=12;

rqsj[6]=day/16;

rqsj[7]=day%16;

rqsj[8]=week/16;

rqsj[9]=week%16;

voidinit1302()

write1302(0x8e,0x00);

write1302(0x86,t1302[0]);

write1302(0x88,t1302[1]);

write1302(0x8c,t1302[2]);

write1302(0x89,t1302[3]);

write1302(0x84,t1302[4]);

write1302(0x82,t1302[5]);

write1302(0x80,t1302[6]);

write1302(0x8e,0x80);

intinit18b20()

inti;

DQ=0;

i=70;

while(i--);

DQ=1;

i=0;

while(DQ)

i++;

if(i>

50000)

return0;

return1;

voidwrite18b20(unsignedchardat)

inti,j;

for(i=0;

i<

i++)

DQ=0;

j++;

DQ=dat&

0x01;

j=6;

while(j--);

DQ=1;

dat>

=1;

unsignedcharread18b20()

unsignedchardat

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 小学教育 > 英语

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1