⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nokia 5110

📁 Nokia+5110多功能时钟(带温度等级)
💻
字号:
//重庆三峡学院电子与信息工程学院创新实验室唐老鸭
//原创----川流不息
#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)//数码管显示时间及温度
{
//显示温度
    a=0;
    b=1;
    c=1;	//数码管位选择
	duan=d[temperature/1000];
	input_595();
	output_595();
	delay(1);
	//消除阴影	    
	duan=d[10];  //数码管显示
    input_595();    
    output_595();

    a=1;
    b=1;
    c=1;	//数码管位选择
	duan=d[temperature%1000/100];
	input_595();
	output_595();
	delay(1);	 
    duan=d[10];  //数码管显示
    input_595();    
    output_595(); 
//显示时间	
    a=0;
    b=0;
    c=0;	//数码管位选择
    duan=d[shi/10];  //数码管显示
    input_595();    
    output_595(); 
    delay(1); 
//消除阴影	    
	duan=d[10];  //数码管显示
    input_595();    
    output_595(); 

    a=1;
    b=0;
    c=0;	//数码管位选择
    duan=d[shi%10];  //数码管显示
    input_595();    
    output_595(); 
    delay(1);	 
    duan=d[10];  //数码管显示
    input_595();    
    output_595(); 

    a=0;
    b=1;
    c=0;	//数码管位选择
    duan=d[fen/10];  //数码管显示
    input_595();    
    output_595(); 
    delay(1); 
	duan=d[10];  //数码管显示
    input_595();    
    output_595(); 

    a=1;
    b=1;
    c=0;	//数码管位选择
    duan=d[fen%10];  //数码管显示
    input_595();    
    output_595(); 
    delay(1); 
	duan=d[10];  //数码管显示
    input_595();    
    output_595(); 

    a=0;
    b=0;
    c=1;	//数码管位选择
    duan=d[miao/10];  //数码管显示
    input_595();    
    output_595(); 
    delay(1); 
	duan=d[10];  //数码管显示
    input_595();    
    output_595(); 

    a=1;
    b=0;
    c=1;	//数码管位选择
    duan=d[miao%10];  //数码管显示
    input_595();    
    output_595(); 
    delay(1); 
	duan=d[10];  //数码管显示
    input_595();    
    output_595();
}
void show1(uchar nian,uchar yue,uchar ri,uchar xingqi)//数码管显示时间及温度
{

    duan=d[10];  //数码管显示
    input_595();    
    output_595(); 

//显示时间	
    a=0;
    b=0;
    c=0;	//数码管位选择
    duan=d[nian/10];  //数码管显示
    input_595();    
    output_595(); 
    delay(1); 
//消除阴影	    
	duan=d[10];  //数码管显示
    input_595();    
    output_595(); 

    a=1;
    b=0;
    c=0;	//数码管位选择
    duan=d[nian%10];  //数码管显示
    input_595();    
    output_595(); 
    delay(1);	 
    duan=d[10];  //数码管显示
    input_595();    
    output_595(); 

    a=0;
    b=1;
    c=0;	//数码管位选择
    duan=d[yue/10];  //数码管显示
    input_595();    
    output_595(); 
    delay(1); 
	duan=d[10];  //数码管显示
    input_595();    
    output_595(); 

    a=1;
    b=1;
    c=0;	//数码管位选择
    duan=d[yue%10];  //数码管显示
    input_595();    
    output_595(); 
    delay(1); 
	duan=d[10];  //数码管显示
    input_595();    
    output_595(); 

    a=0;
    b=0;
    c=1;	//数码管位选择
    duan=d[ri/10];  //数码管显示
    input_595();    
    output_595(); 
    delay(1); 
	duan=d[10];  //数码管显示
    input_595();    
    output_595(); 

    a=1;
    b=0;
    c=1;	//数码管位选择
    duan=d[ri%10];  //数码管显示
    input_595();    
    output_595(); 
    delay(1); 
	duan=d[10];  //数码管显示
    input_595();    
    output_595(); 
//显示xingqi
 
    a=1;
    b=1;
    c=1;	//数码管位选择
    duan=d[xingqi];  //数码管显示
    input_595();    
    output_595(); 
    delay(1); 
	duan=d[10];  //数码管显示
    input_595();    
    output_595(); 
}
void show2()
{
//显示温度
    a=0;
    b=1;
    c=0;	//数码管位选择
	duan=d[temperature/1000];
	input_595();
	output_595();
	delay(1);
	//消除阴影	    
	duan=d[10];  //数码管显示
    input_595();    
    output_595();

    a=1;
    b=1;
    c=0;	//数码管位选择
	duan=d[temperature%1000/100];
	input_595();
	output_595();
	delay(1);	 
    duan=d[10];  //数码管显示
    input_595();    
    output_595(); 

    a=0;
    b=0;
    c=1;	//数码管位选择
	duan=d[temperature%100/10];
    input_595();    
    output_595(); 
    delay(1); 
	duan=d[10];  //数码管显示
    input_595();    
    output_595();

    a=1;
    b=0;
    c=1;	//数码管位选择
	duan=d[temperature%10];
    input_595();    
    output_595(); 
    delay(1); 
	duan=d[10];  //数码管显示
    input_595();    
    output_595();
			temperature=readtemperature();//读温度								
}
void main()
{	
	flag=0;
	flag1=0;
	flag2=0;
	num=0;
	num1=0;
	while(1)  //无限循环
	{
		
			temperature=readtemperature();//读温度
		if(flag==0)
			get_time();//读出时间
		rset_time();
		if(flag2==0)		
		show(shi,fen,miao);
 //整点报时
		if(fen==0&&miao==0&&nian!=0)
		{
		 	beep=0;
			 rjl();	 //渐亮
			beep=1;
			 rja();	 //渐暗	
			 flag2=1;			 		
		} 
//整点时闪烁显示日期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;		
		} 
//调日期时显示日期		 
		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); //延时0.3秒
		 rzmyy(); //走马右移
		 P0=0xff;
		 ys1ms(300);	 
		 rzmzy(); //走马左移
		 P0=0xff;
		 ys1ms(300);
		 rjl();	 //渐亮
		 rja();	 //渐暗
		 P0=0xff;
		 ys1ms(300);
		 rzmnwyd(); //走马内外移动
		 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(); //流水内外移动
	 	 P0=0xff;
		 ys1ms(300);
		 rtbyd(); //跳变7种模式
		 P0=0xff;
		 ys1ms(300);
		get_time();
	}
	 if(k4==0)
	 {
		 delay(5);
		 while(1)
		 {       
		 rdlszy(); //倒流水左移
		 rja();	   //渐暗
		 P0=0xff;
		 ys1ms(300); //延时0.3秒
		 rzmyy(); //走马右移
		 P0=0xff;
		 ys1ms(300);	 
		 rzmzy(); //走马左移
		 P0=0xff;
		 ys1ms(300);
		 rjl();	 //渐亮
		 rja();	 //渐暗
		 P0=0xff;
		 ys1ms(300);
		 rzmnwyd(); //走马内外移动
		 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(); //流水内外移动
	 	 P0=0xff;
		 ys1ms(300);
		 rtbyd(); //跳变7种模式
		 P0=0xff;
		 ys1ms(300);

	}
	}

	}
}		

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -