小項目實踐:單片機做的半導體制冷小冰箱 原理圖和程序

最近天氣比較炎熱閒來無事,自己在家DIY了一個小冰箱,試了一下製冷效果還可以的,下面就把製作步驟和技術資料和大家共享一下:

這個冰冰可樂什麼的真的太適合不過了。。器材:一個電源模塊,220v轉12v,6A。以及一個封裝好的製冷器,元件清單都在原理圖上可以看出來,繼電器用的是繼電器模塊。

防水型的18B20,繼電器模塊,12c887時間芯片,12864液晶屏,蜂鳴器,89c58單片機芯片,接線子,什麼開關,按鍵,電阻電容的你也應該知道的,就是一個單片機模塊。。這些就是控制板的元件了,然後你還要去淘寶上買製冷器和製冷器血藥的配套的電源模塊。。然後你就可以自己DAY一個小冰箱了。。

廢話不多說先上圖:
這是系統控制板子需要自己DIY的板子散件,待焊接

在這裏插入圖片描述
焊接好的系統控制板成品
在這裏插入圖片描述
連接好的待測試品
在這裏插入圖片描述
接上顯示LCD後可以顯示的功能
在這裏插入圖片描述
在這裏插入圖片描述
系統完整演示圖
在這裏插入圖片描述
智能小冰箱的C語言參考源代碼:

#include
#include

#define uchar unsigned char
#define uint unsigned int
sbit ds=P2^2;
sbit rs=P3^5;
sbit rw=P3^6;
sbit en=P3^4;
sbit psb=P3^7;
sbit feng=P2^0;
sbit dscs=P1^4;
sbit dsas=P1^5;
sbit dsrw=P1^6;
sbit dsds=P1^7;
sbit dsirq=P3^3;
sbit jidianqi=P2^3;
bit flag1,flag_ri;
sbit xuanzhe=P1^0;
sbit queding=P1^1;
sbit fanhui=P1^2;
sbit tiaozheng=P1^3;
sbit zengjia=P3^0;
sbit jianxiao=P3^1;
uint temp;
int x1,x3;
uchar flog1,flog,count,count1,acount1,count2,acount2,s1num,flag,t0_num,ff,xh,xh1,xh2,xw,xw1,xw2,xx,xt,axt,xt1,axt1,hh,ahh;
char miao,shi,fen,year,month,day,week,amiao,afen,ashi;
float f_temp;
uchar code table00[]={" 系統初始化… “};
uchar code table01[]={” 以關閉"};
uchar code table02[]={" 以開啓"};

uchar code table0_0[]={“電氣與”};
uchar code table0_1[]={" 信息工程學院"};
uchar code table0_2[]={"–電氣1302唐小旺"};
uchar code table0_3[]={" 湖南工學院 "};

uchar code table11[]={“2015年00月00日”};
uchar code table12[]={" “};
uchar code table13[]={” 00: 00: 00"};
uchar code table14[]={“當前溫度:”};

uchar code table1[]={“菜 1:溫度調節”};
uchar code table2[]={“單 2:定時關閉”};
uchar code table3[]={“1 3:報警溫度調”};
uchar code table4[]={" 4:時間調節"};
uchar code table5[]={“菜 5:鬧鐘調節”};
uchar code table6[]={“單 6:小小遊戲”};
uchar code table7[]={“2 7:小小說明”};
uchar code table8[]={"–在按選擇鍵返回"};

uchar code table1_1[]={“設置溫度:”};
uchar code table1_2[]={" 00"};
uchar code table1_3[]={""};
uchar code table1_4[]={""};
uchar code table1_5[]={" 設置成功"};
uchar code table1_6[]={""};
uchar code table1_7[]={""};
uchar code table1_8[]={""};

uchar code table2_1[]={“設置定時開關:”};
uchar code table2_2[]={" 1:開啓定時關閉"};
uchar code table2_3[]={" 2:關閉定時關閉"};
uchar code table2_4[]={"~~~~~~~~~~~~~~~~"};
uchar code table2_5[]={“設置時間:”};
uchar code table2_6[]={" 00: 00: 00"};
uchar code table2_7[]={""};
uchar code table2_8[]={" 設置成功"};
uchar code table2_9[]={“正在計時關閉中”};
uchar code table2_a[]={""};
uchar code table2_b[]={""};
uchar code table2_c[]={" 設置成功"};
uchar code table2_d[]={“以關閉定時關閉”};
uchar code table2_e[]={""};

uchar code table3_1[]={“設置報警溫度:”};
uchar code table3_2[]={" 00"};
uchar code table3_3[]={""};
uchar code table3_4[]={""};
uchar code table3_5[]={" 設置成功"};
uchar code table3_6[]={" 滴滴滴滴"};
uchar code table3_7[]={“定時炸彈即將爆炸”};

uchar code table4_1[]={“設置時間:”};
uchar code table4_2[]={“2015年03月22日”};
uchar code table4_3[]={" Sun “};
uchar code table4_4[]={” 00: 00: 00 “};
uchar code table4_5[]={” 設置成功"};
uchar code table4_6[]={“春天到了!”};
uchar code table4_7[]={“I am coming”};
uchar code table4_8[]={" 師院"};

uchar code table5_1[]={“設置鬧鐘:”};
uchar code table5_2[]={" 1:開啓鬧鐘"};
uchar code table5_3[]={" 2:關閉鬧鐘"};
uchar code table5_4[]={" 00: 00: 00 “};
uchar code table5_7[]={” 設置成功"};
uchar code table5_8[]={" 小雞小雞"};
uchar code table5_9[]={“小雞小雞咕咕day”};
uchar code table5_a[]={"(咦,我的鬧鈴)~~"};
uchar code table5_5[]={“設置時間:”};
uchar code table5_6[]={" 00: 00: 00"};
uchar code table5_b[]={""};
uchar code table5_c[]={" 設置成功"};
uchar code table5_d[]={“鬧鐘以關閉”};
uchar code table5_e[]={""};

uchar code table6_1[]={" 咦!!!"};
uchar code table6_2[]={" 遊戲捏?"};

uchar code table7_1[]={“小慧是傻逼”};
uchar code table7_2[]={" 小慧是傻逼"};
uchar code table7_3[]={" 小慧是傻逼"};
uchar code table7_4[]={" 小慧是傻逼"};
uchar code table7_5[]={“當前溫度:”};
uchar code table7_6[]={" --’f i e r c e’"};
uchar code table7_7[]={" no way!!"};
uchar code table7_8[]={" 謝謝合作"};

void delay(uint z)
{
uint x,y;
for(x=z;x>0;x–)
for(y=110;y>0;y–);
}

void di()
{
feng=0;
delay(100);
feng=1;
}

void write_com(uchar com)
{
rs=0;
rw=0;
en=0;
P0=com;
delay(5);
en=1;
delay(5);
en=0;
}

void write_dat(uchar dat)
{
rs=1;
rw=0;
en=0;
P0=dat;
delay(5);
en=1;
delay(5);
en=0;
}

void dsreset(void)
{
uint i;
ds=0;
i=103;
while(i>0)i–;
ds=1;
i=4;
while(i>0)i–;
}

bit tempreadbit(void)
{
uint i;
bit dat;
ds=0;i++;
ds=1;i++;i++;
dat=ds;
i=8;while(i>0)i–;
return(dat);
}

uchar tempread(void)
{
uchar i,j,dat;
dat=0;
for(i=1;i<=8;i++)
{
j=tempreadbit();
dat=(j<<7)|(dat>>1);

}
return(dat);
}

void tempwritebyte(uchar dat)
{
uint i;
uchar j;
bit testb;
for(j=0;j<8;j++)
{
testb=dat&0x01;
dat=dat>>1;
if(testb)
{
ds=0;
i++;i++;
ds=1;
i=8;
while(i>0)i–;
}
else
{
ds=0;
i=8;
while(i>0)i–;
ds=1;
i++;
i++;
}
}
}

void tempchang(void)
{
dsreset();
delay(1);
tempwritebyte(0xcc);
tempwritebyte(0x44);
}
uint get_temp()
{
uchar a,b;
dsreset();
delay(1);
tempwritebyte(0xcc);
tempwritebyte(0xbe);
a=tempread();
b=tempread();
temp=b;
temp<<=8;
temp=temp|a;
f_temp=temp0.0625;
temp=f_temp
10+0.5;
f_temp=f_temp+0.05;
return temp;
}

void write_ds(uchar add,uchar dat)
{
dscs=0;
dsas=1;
dsds=1;
dsrw=1;
P0=add;
dsas=0;
dsrw=0;
P0=dat;
dsrw=1;
dsas=1;
dscs=1;
}

uchar read_ds(uchar add)
{
uchar ds_date;
dsas=1;
dsds=1;
dsrw=1;
dscs=0;
P0=add;
dsas=0;
dsds=0;
P0=0xff;
ds_date=P0;
dsds=1;
dsas=1;
dscs=1;
return ds_date;
}

/*void set_time()
{
write_ds(0,0);
write_ds(1,0);
write_ds(2,0);
write_ds(3,0);
write_ds(4,0);
write_ds(5,0);
write_ds(6,0);
write_ds(7,0);
write_ds(8,0);
write_ds(9,0);
} */

void init1()
{
EA=1;
EX1=1;
IT1=1;
t0_num=0;
s1num=0;
week=1;
// write_ds(0x0A,0x20);
// write_ds(0x0B,0x26);
// set_time();
}

void sfm_(uchar add,char dat)
{
uchar si,ge;
si=dat/10;
ge=dat%10;
write_com(add);
write_dat(0x30+si);
write_dat(0x30+ge);
}

void asfm_(uchar add,char dat)
{
uchar si,ge;
si=dat/10;
ge=dat%10;
write_com(add);
write_dat(0x30+si);
write_dat(0x30+ge);
}

void week_(uchar add,char week)
{
write_com(add);
if(week0)
{
write_dat(0x4D);
write_dat(0x6F);
write_dat(0x6E);
write_dat(0x20);
}
if(week
1)
{
write_dat(0x54);
write_dat(0x75);
write_dat(0x65);
write_dat(0x73);

}
if(week2)
{
write_dat(0x57);
write_dat(0x65);
write_dat(0x64);
write_dat(0x20);
}
if(week
3)
{
write_dat(0x54);
write_dat(0x68);
write_dat(0x75);
write_dat(0x72);
}
if(week4)
{
write_dat(0x46);
write_dat(0x72);
write_dat(0x69);
write_dat(0x20);
}
if(week
5)
{
write_dat(0x53);
write_dat(0x61);
write_dat(0x74);

鑑於篇幅限制,只能寫部分代碼

最後,如果需要 程序完整源代碼和 技術文件,請在下方留言或者私信我,看到後會第一時間回覆。

謝謝!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章