基于单片机的无线温度采集开发报告含原理图PCB图程序Word文档格式.docx
《基于单片机的无线温度采集开发报告含原理图PCB图程序Word文档格式.docx》由会员分享,可在线阅读,更多相关《基于单片机的无线温度采集开发报告含原理图PCB图程序Word文档格式.docx(13页珍藏版)》请在冰点文库上搜索。
![基于单片机的无线温度采集开发报告含原理图PCB图程序Word文档格式.docx](https://file1.bingdoc.com/fileroot1/2023-5/1/18c91e29-c507-4a2e-82de-0fb713bc898a/18c91e29-c507-4a2e-82de-0fb713bc898a1.gif)
#defineucharunsignedchar
sbitpin_1820=P1^7;
bitflag,f;
uchartemp,tempdf,tempint;
voiddelay(unsignedinti)
{
unsignedintj;
for(;
i>
0;
i--)
for(j=0;
j<
125;
j++);
}
voidinit_scom()
SCON=0x50;
TMOD|=0x20;
PCON|=0x80;
TH1=0xFA;
IE=0x90;
TR1=1;
voidsend_char(uchartempint)
SBUF=tempint;
while(TI==0);
TI=0;
voidset_ds1820()
while
(1)
uchardelay;
flag=0;
pin_1820=1;
delay=1;
while(--delay);
pin_1820=0;
delay=250;
delay=30;
while(!
pin_1820)
delay=120;
if(pin_1820)
flag=1;
break;
if(flag)
delay=240;
voidwrite_ds1820(ucharcommand)
uchardelay,i;
for(i=8;
delay=6;
pin_1820=command&
0x01;
delay=25;
command=command>
>
1;
voidread_ds1820()
uchardelay,i,j,k,temp,temph,templ;
j=2;
do
temp>
=1;
delay=4;
if(pin_1820)temp|=0x80;
if(j==2)templ=temp;
elsetemph=temp;
}while(--j);
f=0;
if((temph&
0xf8)!
=0x00)
f=1;
temph=~temph;
templ=~templ;
k=templ+1;
templ=k;
if(k>
255)
temph++;
tempdf=templ&
0x0f;
templ>
=4;
temph<
<
tempint=temph|templ;
voidget_temperature()
set_ds1820();
write_ds1820(0xcc);
write_ds1820(0x44);
write_ds1820(0xbe);
read_ds1820();
voidmain()
init_scom();
get_temperature();
send_char(tempint);
delay(50000);
接收芯片U2:
#include<
ucharread_flag;
ucharTemp[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x39,0x40};
uchartempint;
voidduan_lock(ucharduan)
uinti;
P0=Temp[duan];
for(i=7100;
i--);
voidrecv_char()interrupt4using3
{
if(RI)
RI=0;
tempint=SBUF;
read_flag=1;
voiddisp_temp()
uchartempinth,tempintl;
tempinth=tempint/10;
tempintl=tempint%10;
P2=0xfe;
duan_lock(tempinth);
P2=0xfd;
duan_lock(tempintl);
if(read_flag)
read_flag=0;
disp_temp();
电路原理图(15分):
元器件明细表(10分):
器件名称
编号
规格
数量
备注
单片机
U1
AT89C51
2
电阻
R9,R10
10K
排阻
R1
1
电解电容
C3,C6
10uF
瓷片电容
C1,C2,C4,C5
30pF
4
晶振
X1,X2
12MHz
温度传感器
U5
DS18B20
数码管
接收模块
315MHz
发射模块
PCB线路板图(10分):
实物正面照片图(5分):
实物反面照片图(5分):
调试中遇到的问题(5分):
无线接收模块引脚功能混淆接错。
无线发射接收模块不能正常通信,接收模块接收到乱码。
如何解决了调试中的问题(5分):
重新焊接无线接收模块。
更换无线发射接收模块,使用自带编码解码的无线发射接收模块。
谈谈提升作品价值,实现创业的设想(10分)。
通过此次设计课程,初步了解了单片机的无线通信,这次的作品可以再增加多个发射模块及模块选择芯片,选择测量更多点的温度,还可以在测温模块上加入温度控制装置,实现无线测温控温功能,加上报警设置等许多功能,由于价格低廉,可广泛应用在日常生活和工业生产中。