標(biāo)題:
Nokia5110多功能時(shí)鐘(帶溫度等級(jí))
[打印本頁(yè)]
作者:
小娜子
時(shí)間:
2017-6-9 21:10
標(biāo)題:
Nokia5110多功能時(shí)鐘(帶溫度等級(jí))
這個(gè)時(shí)鐘采用Nokia5110顯示屏
0.png
(58.63 KB, 下載次數(shù): 38)
下載附件
2017-6-9 22:38 上傳
單片機(jī)源程序如下(帶溫度等級(jí)):
//重慶三峽學(xué)院電子與信息工程學(xué)院創(chuàng)新實(shí)驗(yàn)室唐老鴨
//原創(chuàng)----川流不息
#include<reg52.h>
#include "rset_time.h"
#include "ds18b02.h"
#include "yiwei595.h"
#include "liushuideng.h"
#define uchar unsigned char
#define uint unsigned int
sbit beep=P2^5;
uint aa,temperature=0; //溫度值
uchar num1,flag1,flag2;
uchar d[11]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x00};
void show(uchar shi,uchar fen,uchar miao)//數(shù)碼管顯示時(shí)間及溫度
{
//顯示溫度
a=0;
b=1;
c=1; //數(shù)碼管位選擇
duan=d[temperature/1000];
input_595();
output_595();
delay(1);
//消除陰影
duan=d[10]; //數(shù)碼管顯示
input_595();
output_595();
a=1;
b=1;
c=1; //數(shù)碼管位選擇
duan=d[temperature%1000/100];
input_595();
output_595();
delay(1);
duan=d[10]; //數(shù)碼管顯示
input_595();
output_595();
//顯示時(shí)間
a=0;
b=0;
c=0; //數(shù)碼管位選擇
duan=d[shi/10]; //數(shù)碼管顯示
input_595();
output_595();
delay(1);
//消除陰影
duan=d[10]; //數(shù)碼管顯示
input_595();
output_595();
a=1;
b=0;
c=0; //數(shù)碼管位選擇
duan=d[shi%10]; //數(shù)碼管顯示
input_595();
output_595();
delay(1);
duan=d[10]; //數(shù)碼管顯示
input_595();
output_595();
a=0;
b=1;
c=0; //數(shù)碼管位選擇
duan=d[fen/10]; //數(shù)碼管顯示
input_595();
output_595();
delay(1);
duan=d[10]; //數(shù)碼管顯示
input_595();
output_595();
a=1;
b=1;
c=0; //數(shù)碼管位選擇
duan=d[fen%10]; //數(shù)碼管顯示
input_595();
output_595();
delay(1);
duan=d[10]; //數(shù)碼管顯示
input_595();
output_595();
a=0;
b=0;
c=1; //數(shù)碼管位選擇
duan=d[miao/10]; //數(shù)碼管顯示
input_595();
output_595();
delay(1);
duan=d[10]; //數(shù)碼管顯示
input_595();
output_595();
a=1;
b=0;
c=1; //數(shù)碼管位選擇
duan=d[miao%10]; //數(shù)碼管顯示
input_595();
output_595();
delay(1);
duan=d[10]; //數(shù)碼管顯示
input_595();
output_595();
}
void show1(uchar nian,uchar yue,uchar ri,uchar xingqi)//數(shù)碼管顯示時(shí)間及溫度
{
duan=d[10]; //數(shù)碼管顯示
input_595();
output_595();
//顯示時(shí)間
a=0;
b=0;
c=0; //數(shù)碼管位選擇
duan=d[nian/10]; //數(shù)碼管顯示
input_595();
output_595();
delay(1);
//消除陰影
duan=d[10]; //數(shù)碼管顯示
input_595();
output_595();
a=1;
b=0;
c=0; //數(shù)碼管位選擇
duan=d[nian%10]; //數(shù)碼管顯示
input_595();
output_595();
delay(1);
duan=d[10]; //數(shù)碼管顯示
input_595();
output_595();
a=0;
b=1;
c=0; //數(shù)碼管位選擇
duan=d[yue/10]; //數(shù)碼管顯示
input_595();
output_595();
delay(1);
duan=d[10]; //數(shù)碼管顯示
input_595();
output_595();
a=1;
b=1;
c=0; //數(shù)碼管位選擇
duan=d[yue%10]; //數(shù)碼管顯示
input_595();
output_595();
delay(1);
duan=d[10]; //數(shù)碼管顯示
input_595();
output_595();
a=0;
b=0;
c=1; //數(shù)碼管位選擇
duan=d[ri/10]; //數(shù)碼管顯示
input_595();
output_595();
delay(1);
duan=d[10]; //數(shù)碼管顯示
input_595();
output_595();
a=1;
b=0;
c=1; //數(shù)碼管位選擇
duan=d[ri%10]; //數(shù)碼管顯示
input_595();
output_595();
delay(1);
duan=d[10]; //數(shù)碼管顯示
input_595();
output_595();
//顯示xingqi
a=1;
b=1;
c=1; //數(shù)碼管位選擇
duan=d[xingqi]; //數(shù)碼管顯示
input_595();
output_595();
delay(1);
duan=d[10]; //數(shù)碼管顯示
input_595();
output_595();
}
void show2()
{
//顯示溫度
a=0;
b=1;
c=0; //數(shù)碼管位選擇
duan=d[temperature/1000];
input_595();
output_595();
delay(1);
//消除陰影
duan=d[10]; //數(shù)碼管顯示
input_595();
output_595();
a=1;
b=1;
c=0; //數(shù)碼管位選擇
duan=d[temperature%1000/100];
input_595();
output_595();
delay(1);
duan=d[10]; //數(shù)碼管顯示
input_595();
output_595();
a=0;
b=0;
c=1; //數(shù)碼管位選擇
duan=d[temperature%100/10];
input_595();
output_595();
delay(1);
duan=d[10]; //數(shù)碼管顯示
input_595();
output_595();
a=1;
b=0;
c=1; //數(shù)碼管位選擇
duan=d[temperature%10];
input_595();
output_595();
delay(1);
duan=d[10]; //數(shù)碼管顯示
input_595();
output_595();
temperature=readtemperature();//讀溫度
}
void main()
{
flag=0;
flag1=0;
flag2=0;
num=0;
num1=0;
while(1) //無(wú)限循環(huán)
{
temperature=readtemperature();//讀溫度
if(flag==0)
get_time();//讀出時(shí)間
rset_time();
if(flag2==0)
show(shi,fen,miao);
//整點(diǎn)報(bào)時(shí)
if(fen==0&&miao==0&&nian!=0)
{
beep=0;
rjl(); //漸亮
beep=1;
rja(); //漸暗
flag2=1;
}
//整點(diǎn)時(shí)閃爍顯示日期5次
if(flag2==1)
{
get_time();
if((miao<=6&&miao>=4)||(miao<=11&&miao>=9)||(miao<=16&&miao>=14)||(miao<=21&&miao>=19)||(miao<=26&&miao>=24))
show1(nian,yue,ri,xingqi);
else
show(shi,fen,miao);
if(miao==27)
flag2=0;
}
//調(diào)日期時(shí)顯示日期
while(flag1)
{
show1(nian,yue,ri,xingqi);
rset_time();
}
//按上鍵顯示日期
if(key_up==0&&num==0)
{
delay(8);
while(!key_up)
show1(nian,yue,ri,xingqi);
};
//按下鍵顯示溫度
if(key_down==0&&num==0)
{
delay(8);
while(!key_down)
show2();
};
if(shi==12&&fen==0&&miao==28)
{
rdlszy(); //倒流水左移
rja(); //漸暗
P0=0xff;
ys1ms(300); //延時(shí)0.3秒
rzmyy(); //走馬右移
P0=0xff;
ys1ms(300);
rzmzy(); //走馬左移
P0=0xff;
ys1ms(300);
rjl(); //漸亮
rja(); //漸暗
P0=0xff;
ys1ms(300);
rzmnwyd(); //走馬內(nèi)外移動(dòng)
P0=0xff;
ys1ms(300);
rlszy(); //流水左移
rja(); //漸暗
ys1ms(300);
rlsyy(); //流水右移
rja(); //漸暗
ys1ms(300);
rsdzmyy(); //3燈走馬右移
P0=0xff;
ys1ms(300);
rsdzmzy(); //3燈走馬右移
P0=0xff;
ys1ms(300);
rlsnwyd(); //流水內(nèi)外移動(dòng)
P0=0xff;
ys1ms(300);
rtbyd(); //跳變7種模式
P0=0xff;
ys1ms(300);
get_time();
}
if(k4==0)
{
delay(5);
while(1)
{
rdlszy(); //倒流水左移
……………………
…………限于本文篇幅 余下代碼請(qǐng)從51黑下載附件…………
復(fù)制代碼
所有資料51hei提供下載:
Nokia 5110多功能時(shí)鐘(帶溫度等級(jí)).zip
(75.05 KB, 下載次數(shù): 33)
2017-6-9 21:10 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1