导航:首页 > 操作系统 > 单片机万年历英文版

单片机万年历英文版

发布时间:2022-12-10 23:55:48

单片机万年历

今天碰到了N个白痴问题。万年历是能够显示年月日、二十四节气、农历之类的东西,单片机是一块芯片。万年历可以用单片机来做,但是我真不知道“万年历单片机”怎么做。我想你应该想问的是怎么用单片机来做万年历,我提供思路。 1、单片机最小系统一块。可以用STC89C52芯片+外围电路。可以烧入用户编写的程序,实现万年历所需的逻辑。 2、实时时钟电路一块,可以用DS1302芯片。提供年月日、时分秒数据给单片机。 3、显示器电路一块。用来显示这些数据。 4、一些必要的按键,用来调整数据。

② 急求一片基于单片机的电子钟 或者万年历的英文文献5000字左右的!!!! 急求!!

Design of the digital Perpetual Calendar based on
real-time clock chip
Abstract:This Electronic calendar uses the AT89S52 microcontroller as the core for the control. Time Circuit which is constituted by Dallas's DS1302 real-time clock chip achieved a time and date display, it increased functionality for the temperature display and the whole point timekeeping. This paper discusses the hardware circuit of the system, principle in detail,and gives the flow chart of the software design and the major source code. keywords:microcontroller; real-time clock; Temperature measurement
1 Introction
E-calendar-bedroom at home,schools,stations and more and more extensive use of plaza for people's lives,study,work great convenience. Electronics calendar for the past need to re-adjust after power-off time and date,and time is a big error. Designed the system using real-time clock chip (DS1302) as a timer parts,the chip comes with an internal crystal oscillator,so that effectively guarantee the accuracy of the time and hang own internal battery power makes the situation will continue to update the time information . This design uses AT89S52 as the main controller,in order to improve the practicality of the circuit add temperature measurement circuit,timekeeping and alarm functions.
2 System hardware design
Schematic circuit shown in Figure 2:

System architecture diagram
2.1 Power Supply Circuit
In order to rece circuit costs,the system power supply circuit by the transformer transformer,three-terminal integrated regulator (L7805> circuit 5V, has a simple,reliable, inexpensive and so on.
2.2 Host Controller
Host controller using ATMEL's latest MCU Procts AT89S52. Apart from the single-chip microcomputer has a MCS-51 series single-chip all the benefits of things,also has 8KB of internal in-system programmable FLASH memory,free and low-power brown-out mode, greatly recing the power circuit . In addition,also has a watchdog circuit,a reliable job for the circuit provides greater assurance.
2.3 digital tube display circuit
Show circuit with a high brightness,long life,low cost features such as the LED digital tube. Throughout the show circuit by the digital control and display LED drive circuit and decoding circuit. Because of the system to display the contents of more,a total of 16 digital tube, respectively,with eight shows year,month,day,four show time,show that 22 weeks,2 show the temperature. Controller in order to save resources,between the controller and displays add a decoding circuit 16 so that would have required the line of control into the circuit only 4 control lines,a great save system resources. The decoder by the decoder constitute both 3-8.
2.4 Real-time clock chip
This design uses the United States Dallas company DS1302, the chip can automatically generate century,year,month,day,hour,minute,second,such as time information. Century the use of internal registers with the software will be able to resolve the 'Millennium', the problem. The chip has its own internal battery-keng,external brown-out,the internal time information also be able to maintain for 10 years. Time for a single day record of 12 hours and there is a 24-hour mode. Time Table
Ways that also has two kinds of binary numbers,and the other with BCD code express. The chip with 128 bytes of internal RAM,one of 11 bytes used to store time information,4 bytes of memory chips used to control information,known as the control register,113-byte general-purpose RAM for users to store temporary information. In addition,users can also program the chip to control a variety of square-wave output,and its internal three-way through the software interrupt shielding.
2.5 Buttons and temperature measurements and circuit
The system in order to make the circuit more easy,button circuit design only three keys, which are 'set','+','-', three keys to adjust the calendar and clock. The system in order to improve the practicality of the circuit,an increase of a temperature display. The system temperature measurement circuit using Dallas's DS18B20. The device because of its low price,easy circuits,measurement precision,etc..
2.6 audio signal generator and driver circuit
The circuit's function is to receive control circuit to send to the entire point of time and timing signal,according to system settings proce different frequencies of audio signals,amplification by the drive circuit to drive speakers to voice their opinions in order to realize the whole point timekeeping and alarm functions.

中文译文:
基于实时钟芯片的电子万年历的设计
摘要:电子万年历以AT89S52单片机为控制核心,采用Dallas公司的DS1302实时钟芯片构成计时电路,实现了时间和日期的显示,还增加了温度显示和整点报时的功能。文章对该系统的硬件电路、工作原理做了详细介绍,同时给出了软件设计的流程图及主要程序源代码。
关键词:单片机,实时钟.温度测量
1引言
电子万年历在家庭居室、学校、车站和广场使用越来越广泛,给人们的生活、学习、工作带来极大的方便。针对以往的电子万年历断电后需重新调整时间与日期,且计时误差大的现象。本系统设计采用实时钟芯片(DS1302)作为计时器件,该芯片内部自带晶体振荡器,这样就有效的保证了计时的精确性,并且内部自带铿电池使得在断电情况能继续更新时间信息。本设计采用AT89S52作为主控制器,为了提高电路的实用性加入温度测量电路、报时和闹钟功能。
2系统硬件的设计
电路原理图如图所示:

该系统的结构框图
系统的工作原理是:主控制器每隔一段时间(小于一秒钟)读一次时钟芯片的内部寄存器的值,将读出的日历、时间信息实时的显示在LED数码显示器一上。同时,主控制器不断的扫描按键电路和温度测量电路,当有键按下时,识别出按键的值并调整相应的时间或日历的值再写入时钟芯片内部。温度数据由测量电路(DS18B20)获得的温度值送入显示电路显示。
2. 1电源电路
为了减少电路成本,本系统电源电路由变压器变压、三端集成稳压(L7805>电路产生5V,具有简单、可靠、价格低廉等特点。
2. 2主控制器
主控制器采用ATMEL公司的最新系列单片机产品AT89S52。该单片机除了拥有MCS-51系列单片机的所有优点外,内部还具有8KB的在系统可编程FLASH存储器,低功耗的空闲和掉电模式,极大的降低了电路的功耗。另外,还具有一个看门狗电路,为电路的可靠工作提供了更大的保证。
2. 3数码管显示电路
显示电路采用具有高亮度、使用寿命长、价格低廉等特点的LED数码管。整个显示电路由LED数码管和显示驱动电路和译码电路构成。由于本系统中显示的内容较多,共需要16个数码管,分别用八位显示年、月、日,四位显示时间,二二位显示星期,二位显示温度。为了节省控制器的资源,在控制器和显示器之间加入一个译码电路使本来需要16根控制线的电路变成只需四根控制线,极大的节省了系统资源。该译码器由两个3-8译码器构成。
2. 4实时钟芯片
本设计采用美国Dallas公司的DS12C887A,该芯片能够自动产生世纪、年、月、日、时、分、秒等时间信息。利用内部的世纪寄存器,配合软件就能解决’千年’,的问题。该芯片内部自带有铿电池,外部掉电时,其内部的时间信息还能够保持10年之久。对于一天内的时间记录有 12小时制和24小时制两种模式。时间的表示方法也有两种,一种用二进制数表示,另一种用BCD码表示。该芯片内部带有128字节的RAM,其中11字节用来存储时间信息,4字节用来存储芯片的控制信息,称为控制寄存器,113字节通用RAM可供用户存储临时信息。此外,用户还可以对芯片进行编程控制输出各种方波,并可对其内部的三路中断通过软件进行屏蔽。
2. 5按键与温度测且电路
本系统为了使电路更简单,按键电路只设计了三个按键,分别是’设置’、’+’、’-’,三个键用来调整日历以及时钟。本系统为了提高电路的实用性,增加了一个温度显示功能。该系统的温度测量电路采用Dallas公司的DS1280。该器件由于其具有价格低廉、电路简单、测量精确等优点。
2. 6音频信号产生及驱动电路
本电路的功能是接收控制电路发送来的整点报时及定时信号,根据系统设定产生不同频率的音频信号,由驱动电路加以放大驱动扬声器发出声音,从而实现整点报时及闹钟的功能。

希望可以帮到你!!!

③ AT89C52+DS1302单片机万年历程序

参考程序,可以调节时间,设置闹钟,音乐闹铃

#include<reg52.h>
#include<INTRINS.H>
/************************************************************/
#define uchar unsigned char
#define uint unsigned int
#define TIME (0X10000-50000)
#define FLAG 0XEF //闹钟标志
/************************************************************/
//引脚连接图
sbit CLK=P1^2;
sbit RST=P1^4;
sbit DAT=P1^3;
sbit RS=P1^5;
sbit RW=P1^6;
sbit E=P1^7;
sbit P32=P3^2;

sbit KEY1 = P2^7;
sbit KEY2 = P2^6;
sbit KEY3 = P2^5;
sbit KEY4 = P2^4;

sbit ACC_7=ACC^7;
/************************************************************/
//全局变量及常量定义
uchar i=20,j;
uchar DataBuf[16] = {};//日期
uchar TimeBuf[16] = {};//时间
uchar alarm[2],time[3];
uchar code Day[]={31,28,31,30,31,30,31,31,30,31,30,31};//12个月的最大日期(非闰年)

//闰年月星期表
const unsigned char WeekTab[] = {

(3 << 5) + 31,///1月
(6 << 5) + 29,///2月
(0 << 5) + 31,///3月
(3 << 5) + 30,///4月
(5 << 5) + 31,//5月
(1 << 5) + 30,//6月
(3 << 5) + 31,//7月
(6 << 5) + 31,//8月
(1 << 5) + 30,//9月
(4 << 5) + 31,//10月
(0 << 5) + 30,//11月
(2 << 5) + 31 //12月
};

//音律表
uint code table1[]={64260,64400,64524,64580,64684,64777,
64820,64898,64968,65030,65058,65110,65157,65178,65217};
//发声部分的延时时间
uchar code table2[]={0x82,1,0x81,0xf4,0xd4,0xb4,0xa4,
0x94,0xe2,1,0xe1,0xd4,0xb4,0xc4,0xb4,4,0};

//闹钟中用的全局变量
uchar th1,tl1;

/************************************************************/
//延时1ms函数
delay1ms(uchar time)
{
uchar i,j;
for(i=0;i<time;i++)
{
for(j=0;j<250;j++);
}
}

/************************************************************/
//LCD控制函数
Enable()
{
RS=0;
RW=0;
E=0;
delay1ms(3);
E=1;
}

/************************************************************/
//LCD1602写入字符函数
LCD1602_WriteSChr(uchar i)
{
P0=i;
RS=1;
RW=0;
E=0;
delay1ms(2);
E=1;
}

/************************************************************/
//LCD1602写入字符串函数
//入口函数
//uchar data *address : 写入数据首地址
//ucharm:写入字节数
LCD1602_WriteStr(uchar *address,uchar m)
{
uchar i,j;
for(i=0;i<m;i++,address++)
{
j=*address;
LCD1602_WriteSChr(j);
}
}

/************************************************************/
//LCD显示
void LCDShow(void)
{
P0=0XC; //显示器开、光标关
Enable();
//P0=0x80; //写入显示起始地址
//Enable();
//LCD1602_WriteStr(DataBuf,16); //写入日期显示缓存
P0=0xc1; //写入显示起始地址
Enable();

LCD1602_WriteStr(TimeBuf,16); //写入时间显示缓存
}

/************************************************************/
//DS1302写入子程序
void DS1302_Write(uchar temp)
{
uchar i;
CLK=0; //将DS1320时钟脉冲拉低
_nop_();//延时一指令周期
RST=1; //RST置高电平
_nop_();//延时一指令周期
for(i=0;i<8;i++) //循环8次
{
DAT=temp&0x01; //向DS1302写入一字节数据
_nop_(); //延时一指令周期
CLK=1; //拉高时钟脉冲
temp>>=1; //右移一位
CLK=0; //拉低时钟脉冲
}
}

/************************************************************/
//DS1302读取子程序
uchar DS1302_Read()
{
uchar i,j=0;
for(i=0;i<8;i++)//循环8次
{
j>>=1; //右移一位
_nop_(); //延时一指令周期
CLK=0; //拉低时钟脉冲
_nop_(); //延时一指令周期
if(DAT) //判断接收该位数据是否为1
j|=0x80;//该位置1
_nop_(); //延时一指令周期
CLK=1; //拉高时钟脉冲
}
return(j); //返回数值
}

/************************************************************/
//部分显示数据初始化
TimeStart()
{
TimeBuf[0]=TimeBuf[8]=TimeBuf[9]=TimeBuf[10]=0x20; //不显示字符
TimeBuf[2]=TimeBuf[5]=':'; //时间分隔显示
DS1302_Write(0xc1);
alarm[0]=DS1302_Read();
RST=0;
DS1302_Write(0xc3);
alarm[1]=DS1302_Read();
RST=0;
DS1302_Write(0xc5);
DataBuf[0]=DS1302_Read();
RST=0;
}

/************************************************************/
//读取时间
ReadTime()
{
uchar i,m,n;
for(m=0,i=0,n=0x85;i<7;i+=3,n-=2,m++) //连续读取时,分,秒
{
DS1302_Write(n); //写入读取寄存器指令
time[m]=DS1302_Read(); //读取数据
RST=0; //将RST电平拉低,停止传输
TimeBuf[i]=time[m]/16+0x30; //将两位数据的十位转为字符格式
TimeBuf[i+1]=time[m]%16+0x30;//将两位数据的个位转为字符格式
}
}

/************************************************************/
//功能选择超时定时器
time0() interrupt 1 using 1
{
i--;
if(i==0)
{
if(j!=0)
j--;
i=20;
}
TH0=TIME/256,TL0=TIME%256;
}

/************************************************************/
//产生闹铃音调
intime1() interrupt 3
{
TH1=th1,TL1=tl1;
P32=!P32;
}

/************************************************************/
//闹钟显示
void AlarmShow(void)
{
uchar i,j,a,b,n;
ET1=1;
for(j=0;j<6;j++)
{
i=0;
while(1)
{
a=table2[i];
if(a==0)
break;
b=a&0xf;
a>>=4;
if(a==0)
{
TR1=0;
goto D1;
}
a=((--a)<<1)/2;
TH1=th1=table1[a]/256,TL1=tl1=table1[a]%256;
TR1=1;
D1: do
{
b--;
for(n=0;n<3;n++)
{
ReadTime();
LCDShow();
P2=0xff;
if(KEY4 == 1)
{
delay1ms(100);
if(KEY4 == 1)
{
TR1=0;
ET1=0;
P32 = 1;
return;
}
}
}
}while(b!=0);
i++;
}
TR1=0;
}
ET1=0;
}

/************************************************************/
//设置日期、时间
void SetTime(void)
{
uchar i=0xc2,year,month,day,n;
TimeBuf[6]=TimeBuf[7]=0x30;
DataBuf[14]=DataBuf[15]=0x20;
LCDShow();
while(1)
{
P0=0xe; //显示器开、光标开
Enable();
P0=i; //定光标
Enable();
P2=0xff;
if((KEY1 == 1)||(KEY2 == 1)||(KEY3 == 1)||(KEY4 == 1))
{
delay1ms(100); //延时0.1s去抖动
if((KEY1 == 1)||(KEY2 == 1)||(KEY3 == 1)||(KEY4 == 1))
{
j=7;
if(KEY1 == 1)
{
i+=3; //更改设置项目
if(i==0x8e)
i=0xc2;
else if(i>0xc5)
i=0xc2;
}
else if(KEY2 == 1)
{
year=(DataBuf[4]&0xf)*10+(DataBuf[5]&0xf); //将字符格式的年份转换为数值格式
month=(DataBuf[7]&0xf)*10+(DataBuf[8]&0xf); //将字符格式的月份转换为数值格式
day=(DataBuf[10]&0xf)*10+(DataBuf[11]&0xf); //将字符格式的日数转换为数值格式
if(i==0x85) //设置年份
{
year++;
if(year>99)
year=0;
if((year%4)!=0)
if(month==2&&day==29)
day=28;
}
else if(i==0x88) //设置月份
{
month++;
if(month>12)
month=1;
if(day>Day[month-1])
{
day=Day[month-1];
if(month==2&&(year%4)==0) //计算是否闰年
day=29;
}
}
else if(i==0x8b) //设置日期
{
day++;
if(day>Day[month-1])
{
if(month==2&&(year%4)==0) //计算是否闰年
{
if(day>29)
day=1;
}
if(month!=2)
day=1;
}
}
else if(i==0xc2) //设置小时
{
n=(TimeBuf[0]&0xf)*10+(TimeBuf[1]&0xf);
n++;
if(n>23)
n=0;
TimeBuf[0]=n/10+0x30;
TimeBuf[1]=n%10+0x30;
}
else //设置分钟
{
n=(TimeBuf[3]&0xf)*10+(TimeBuf[4]&0xf);
n++;
if(n>59)
n=0;
TimeBuf[3]=n/10+0x30;
TimeBuf[4]=n%10+0x30;
}
DataBuf[4]=year/10+0x30; //将数值格式的日期转换为字符形式
DataBuf[5]=year%10+0x30;
DataBuf[7]=month/10+0x30;
DataBuf[8]=month%10+0x30;
DataBuf[10]=day/10+0x30;
DataBuf[11]=day%10+0x30;
LCDShow();
}
else if(KEY3 == 1) //按保存退出键后,向DS1302写入设置后的日期时间
{
DS1302_Write(0x8c);
DS1302_Write((DataBuf[4]&0xf)*16+(DataBuf[5]&0xf));
RST=0;
DS1302_Write(0x8a);
DS1302_Write(SetWeek());
RST=0;
for(i=7,n=0x88;i<11;i+=3,n-=2)
{
DS1302_Write(n);
DS1302_Write((DataBuf[i]&0xf)*16+(DataBuf[i+1]&0xf));
RST=0;
}
for(i=0;i<7;i+=3,n-=2)
{
DS1302_Write(n);
DS1302_Write((TimeBuf[i]&0xf)*16+(TimeBuf[i+1]&0xf));
RST=0;
}
TR0=0;
return;
}
else
{
TR0=0;
return;
}
}
}
if(j==0)
{
TR0=0;
return;
}
}
}

/************************************************************/
//设置闹钟
void SetAlarm(void)
{
uchar i,n;
for(i=1;i<16;i++)
{
DataBuf[i]=0x20;
}
TimeBuf[0]=alarm[0]/16+0x30;
TimeBuf[1]=(alarm[0]&0xf)+0x30;
TimeBuf[3]=alarm[1]/16+0x30;
TimeBuf[4]=(alarm[1]&0xf)+0x30;
TimeBuf[6]=TimeBuf[7]=0x30;
LCDShow();
i=0xc2;
while(1)
{
P0=0xe; //显示器开、光标开
Enable();
P0=i; //定光标
Enable();
P2=0xff;
if((KEY1 == 1)||(KEY2 == 1)||(KEY3 == 1)||(KEY4 == 1))
{
delay1ms(100); //延时0.1s去抖动
if((KEY1 == 1)||(KEY2 == 1)||(KEY3 == 1)||(KEY4 == 1))
{
j=7;
if(KEY1 == 1)
{
i+=3;
if(i>0xc5)
i=0xc2;
}
else if(KEY2 == 1)
{
if(i==0xc2)
{
n=(TimeBuf[0]&0xf)*10+(TimeBuf[1]&0xf);
n++;
if(n>23)
n=0;
TimeBuf[0]=n/10+0x30;
TimeBuf[1]=n%10+0x30;
}
else
{
n=(TimeBuf[3]&0xf)*10+(TimeBuf[4]&0xf);
n++;
if(n>59)
n=0;
TimeBuf[3]=n/10+0x30;
TimeBuf[4]=n%10+0x30;
}
LCDShow();
}
else if(KEY3 == 1)
{
DS1302_Write(0xc0);
DS1302_Write((TimeBuf[0]&0xf)*16+(TimeBuf[1]&0xf));
RST=0;
DS1302_Write(0xc2);
DS1302_Write((TimeBuf[3]&0xf)*16+(TimeBuf[4]&0xf));
RST=0;
DataBuf[0]=FLAG;
DS1302_Write(0xc4);
DS1302_Write(DataBuf[0]);
RST=0;
TR0=0;
TimeStart();
return;
}
else
{
TR0=0;
TimeStart();
return;
}
}
}
if(j==0)
{
TR0=0;
TimeStart();
return;
}
}
}

/************************************************************/
//DS1302初始化程序
void DS1302_Init(void)
{
uchar i,n;

DS1302_Write(0x8c);
DS1302_Write((DataBuf[4]&0xf)*16+(DataBuf[5]&0xf));
RST=0;
DS1302_Write(0x8a);
DS1302_Write(SetWeek());
RST=0;
for(i=7,n=0x88;i<11;i+=3,n-=2)
{
DS1302_Write(n);
DS1302_Write((DataBuf[i]&0xf)*16+(DataBuf[i+1]&0xf));
RST=0;
}
for(i=0;i<7;i+=3,n-=2)
{
DS1302_Write(n);
DS1302_Write((TimeBuf[i]&0xf)*16+(TimeBuf[i+1]&0xf));
RST=0;
}
}

/************************************************************/
//主函数
main()
{
IE=0x82;
TMOD=0x11;
DS1302_Write(0x8E); //禁止写保护
DS1302_Write(0);
RST=0;
P0=1; //清屏并光标复位
Enable();
P0=0x38; //设置显示模式:8位2行5x7点阵
Enable();
P0=6; //文字不动,光标自动右移
Enable();
DS1302_Init();
TimeStart();

while(1)
{
ReadTime(); //读取时间
LCDShow(); //显示时间

if(DataBuf[0]!=0x20)
if(time[0]==alarm[0])
if(time[1]==alarm[1])
if(time[2]==0)
AlarmShow();

P2=0xff;
if((KEY1 == 1)||(KEY2 == 1)||(KEY3 == 1))
{
delay1ms(100); //延时0.1s去抖动
if((KEY1 == 1)||(KEY2 == 1)||(KEY3 == 1))
{
j=7;
TH0=TIME/256,TL0=TIME%256;
TR0=1;
if(KEY1 == 1)
{
SetTime();
}
else if(KEY2 == 1)
{
SetAlarm();
}
else if(KEY3 == 1)
{
TR0=0;
if(DataBuf[0]==FLAG)
DataBuf[0]=0x20;
else
DataBuf[0]=FLAG;
DS1302_Write(0xc4);
DS1302_Write(DataBuf[0]);
RST=0;
}
}
}
delay1ms(100);
}
}

④ 急求PROTUES实现万年历 单片机C语言程序做的 HEX文件 源程序和仿真图

#include <reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit db=P2^7;
char i,sec,min,h,date,month,year,flag;
uchar j,k,m,n,o,p;
sbit la=P2^0;
sbit wela1=P2^1;
sbit wela2=P2^2;
sbit key_ch=P3^5;
sbit key_add=P3^6;
sbit key_minus=P3^7;
uchar code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
void init();
void delay(uint);
void second_display();
void minute_display();
void hour_display();
void date_display();
void month_display();
void year_display();
void control();
void time();
void main()
{
init();
while(1)
{
second_display();
minute_display();
hour_display();
date_display();
month_display();
year_display();
control();
}
}
void init()
{
db=0;
i=0;
sec=0;
min=0;
h=0;
date=1;
month=1;
year=1;
flag=0;
wela1=0;
wela2=0;
EA=1;
ET0=1;
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
TR0=1;
}
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void second_display()
{
int sec_shi,sec_ge;
sec_shi=sec/10;
sec_ge=sec%10;

if(flag==1&&j!=1)
j++;
else
{
j=0;
la=1;
P0=~table[sec_ge];
la=0;
wela1=1;
P1=0x00;
wela1=0;
wela2=1;
P1=0x20;
wela2=0;
delay(1);
la=1;
P0=0xff;
la=0;

la=1;
P0=~table[sec_shi];
la=0;
wela1=1;
P1=0x00;
wela1=0;
wela2=1;
P1=0x10;
wela2=0;
delay(1);
la=1;
P0=0xff;
la=0;
}
}
void minute_display()
{
int min_shi,min_ge;
min_shi=min/10;
min_ge=min%10;

if(flag==2&&k!=1)
k++;
else
{
k=0;
la=1;
P0=~table[min_ge];
la=0;
wela1=1;
P1=0x00;
wela1=0;
wela2=1;
P1=0x08;
wela2=0;
delay(1);
la=1;
P0=0xff;
la=0;

la=1;
P0=~table[min_shi];
la=0;
wela1=1;
P1=0x00;
wela1=0;
wela2=1;
P1=0x04;
wela2=0;
delay(1);
la=1;
P0=0xff;
la=0;
}
}
void hour_display()
{
int h_shi,h_ge;
h_shi=h/10;
h_ge=h%10;

if(flag==3&&m!=1)
m++;
else
{
m=0;
la=1;
P0=~table[h_ge];
la=0;
wela1=1;
P1=0x00;
wela1=0;
wela2=1;
P1=0x02;
wela2=0;
delay(1);
la=1;
P0=0xff;
la=0;
delay(1);

la=1;
P0=~table[h_shi];
la=0;
wela1=1;
P1=0x00;
wela1=1;
P1=0x00;
wela1=0;
wela2=1;
P1=0x01;
wela2=0;
delay(1);
la=1;
P0=0xff;
la=0;
wela2=0;
delay(1);
}

}
void date_display()
{
int date_shi,date_ge;
date_shi=date/10;
date_ge=date%10;

if(flag==4&&n!=1)
n++;
else
{
n=0;
la=1;
P0=~table[date_ge];
la=0;
wela2=1;
P1=0x00;
wela2=0;
wela1=1;
P1=0x80;
wela1=0;
delay(1);
la=1;
P0=0xff;
la=0;

la=1;
P0=~table[date_shi];
la=0;
wela2=1;
P1=0x00;
wela2=0;
wela1=1;
P1=0x40;
wela1=0;
delay(1);
la=1;
P0=0xff;
la=0;
}
}
void month_display()
{
int month_shi,month_ge;
month_shi=month/10;
month_ge=month%10;

if(flag==5&&o!=1)
o++;
else
{
o=0;
la=1;
P0=~table[month_ge];
la=0;
wela2=1;
P1=0x00;
wela2=0;
wela1=1;
P1=0x20;
wela1=0;
delay(1);
la=1;
P0=0xff;
la=0;

la=1;
P0=~table[month_shi];
la=0;
wela2=1;
P1=0x00;
wela2=0;
wela1=1;
P1=0x10;
wela1=0;
delay(1);
la=1;
P0=0xff;
la=0;
}
}
void year_display()
{
int year_qian,year_,year_shi,year_ge;
year_qian=year/1000;
year_=year%1000/100;
year_shi=year%1000%100/10;
year_ge=year%10;

if(flag==6&&p!=1)
p++;
else
{
p=0;
la=1;
P0=~table[year_ge];
la=0;
wela2=1;
P1=0x00;
wela2=0;
wela1=1;
P1=0x08;
wela1=0;
delay(1);
la=1;
P0=0xff;
la=0;

la=1;
P0=~table[year_shi];
la=0;
wela2=1;
P1=0x00;
wela2=0;
wela1=1;
P1=0x04;
wela1=0;
delay(1);
la=1;
P0=0xff;
la=0;

la=1;
P0=~table[year_];
la=0;
wela2=1;
P1=0x00;
wela2=0;
wela1=1;
P1=0x02;
wela1=0;
delay(1);
la=1;
P0=0xff;
la=0;

la=1;
P0=~table[2];
la=0;
wela2=1;
P1=0x00;
wela2=0;
wela1=1;
P1=0x01;
wela1=0;
delay(1);
la=1;
P0=0xff;
la=0;
wela1=0;
}
}
void control()
{
if(!key_ch)
{
delay(5);
if(!key_ch)
{
flag++;
if(flag==7)
flag=0;
}
}
while(!key_ch);
if(flag==1&&key_add==0)
{
while(!key_add);
sec++;
if(sec==60)
sec=0;
}
if(flag==1&&key_minus==0)
{
while(!key_minus);
sec--;
if(sec==-1)
sec=59;
}

if(flag==2&&key_add==0)
{
while(!key_add);
min++;
if(min==60)
min=0;
}
if(flag==2&&key_minus==0)
{
while(!key_minus);
min--;
if(min==-1)
min=59;
}

if(flag==3&&key_add==0)
{
while(!key_add);
h++;
if(h==24)
h=0;
}
if(flag==3&&key_minus==0)
{
while(!key_minus);
h--;
if(h==-1)
h=23;
}

if(flag==4&&key_add==0)
{
while(!key_add);
date++;
if(date==29)
if((year%4!=0)&&(month==2))
date=1;
if(date==30)
if((year%4==0)&&(month==2))
date=1;
if(date==31)
if((month==4)||(month==6)||(month==9)||(month==11))
date=1;
if(date==32)
if((month==1)||(month==3)||(month==5)||(month==7)||(month==8)||(month==10)||(month==12))
date=1;
}

if(flag==5&&key_add==0)
{
while(!key_add);
month++;
if(month==13)
month=1;
}
if(flag==5&&key_minus==0)
{
while(!key_minus);
month--;
if(month==0)
month=12;
}

if(flag==6&&key_add==0)
{
while(!key_add);
year++;
if(year==99)
year=1;
}
if(flag==6&&key_minus==0)
{
while(!key_minus);
year--;
if(year==0)
year=99;
}
}

void T0_rpt() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
i++;
time();
}

void time()
{
if(i==20)
{
i=0;
sec++;
if(sec==60)
{
sec=0;
min++;
if(min==60)
{
min=0;
h++;
if(h==24)
{
h=0;
min=0;
sec=0;
date++;
if(date==29)
if((year%4!=0)&&(month==2))
{
date=1;
month++;
if(month==13)
{
month=1;
year++;
}
}
if(date==30)
if((year%4==0)&&(month==2))
{
date=1;
month++;
if(month==13)
{
month=1;
year++;
}
}
if(date==31)
if((month==4)||(month==6)||(month==9)||(month==11))
{
date=1;
month++;
if(month==13)
{
month=1;
year++;
}
}
if(date==32)
if((month==1)||(month==3)||(month==5)||(month==7)||(month==8)||(month==10)||(month==12))
{
date=1;
month++;
if(month==13)
{
month=1;
year++;
}
}
}
}
}
}
}

⑤ 求基于单片机的电子万年历设计的英文文献

S.M.T.AlModarresi,N.M.White.

Calendarconversionforreal-timesystems[J].AdvancesinEngineeringSoftware,

2004,35(8):511–516

pdf" wealth="0" />

⑥ 带农历的万年历,英文显示

我有2011年英文台历,显示了中国,欧洲,美国的各大小假期的。

⑦ 单片机万年历c语言

#include<stdio.h>

//判断是否是闰年
int leapYear(int year)
{
if((year%4==0 && year%100!=0) || !(year%400))
return 1;
else
return 0;
}

//返回星期几
int weekday(int year,int day_sum)
{
if(year<2012)
return (7-day_sum%7+1);
else
return (day_sum%7+1);
}

//年份之间相隔的天数
int year_sum(int year)
{
int yearSum=0;
if(year<=2011)
for(int i=year;i<2012;i++)
{
if(leapYear(i))
yearSum+=366;
else
yearSum+=365;
}
else if(year==2012 || year==2013)
return 0;
else if(year>2013)
for(int i=year;i>2013;i--)
{
if(leapYear(i-1))
yearSum+=366;
else
yearSum+=365;
}
return yearSum;
}

//某月的天数
int month_sum(int year,int month)
{
if(month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12)
return 31;
else if(month==2)
{
if(leapYear(year))
return 29;
else
return 28;
}
else
return 30;
}

//打印日历
void print(int year)
{
FILE *p;
p=fopen("calendar.txt","a+");
fprintf(p,"输入要打印日历的年份:%d\n",year);
int cal[31];
int initWeek;
int totalDay=0;
int count=0;
if(year<2012)
totalDay=year_sum(year)+64;
else if(year==2012)
totalDay=year_sum(year)+62;
else
totalDay=year_sum(year)+302;

initWeek=weekday(year,totalDay);

for(int j=1;j<=12;j++)
{
printf("%d年%d月\n",year,j);
fprintf(p,"%d年%d月\n",year,j);
printf("星期日\t星期一\t星期二\t星期三\t星期四\t星期五\t星期六\n");
fprintf(p,"星期日\t星期一\t星期二\t星期三\t星期四\t星期五\t星期六\n");
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
fprintf(p,"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
int limit=month_sum(year,j);
if(j>=2)
{
initWeek=count%7;
count=0;
}
if(initWeek!=7)
{
for(int n=0;n<initWeek;n++)
{
printf("\t");
fprintf(p,"\t");
count++;
}
}

for(int i=0;i<limit;i++)
cal[i]=i+1;

for(i=0;i<limit;i++)
{
printf("%4d\t",cal[i]);
fprintf(p,"%4d\t",cal[i]);
count++;
if(count%7==0)
{
printf("\n");
fprintf(p,"\n");
}
}
printf("\n\n\n");
fprintf(p,"\n\n\n");
}
fclose(p);
}

int main()
{
int year;
printf("输入要打印日历的年份:");
while(scanf("%d",&year)!=EOF){
print(year);
}
return 0;
}

⑧ 设计一个基于单片机的万年历程序

#include<reg51.h>
#include"lcd.h"
#include"ds1302.h"

sbitK1=P3^1;
sbitK2=P3^0;
sbitK3=P3^2;
sbitK4=P3^3; //管脚接线
unsignedcharcharacter0[24]={0x08,0x0f,0x12,0x0f,0x0a,0x1f,0x02,0x02 ,
0x0F,0x09,0x0F,0x09,0x0F,0x09,0x13,0x00,//"月"代码0x01
0x0F,0x09,0x09,0x0F,0x09,0x09,0x0F,0x00,//"日"代码0x02
};//年
voidInt0Configuration();
voidLcdDisplay();
unsignedcharSetState,SetPlace;
voidDelay10ms(void);//误差0us
/*******************************************************************************
*函数名:main
*函数功能 :主函数
*输入:无
*输出 :无
*******************************************************************************/

voidmain()
{
unsignedchari,h;
Int0Configuration();
LcdInit();
LcdWriteCom(0x40);
for(h=0;h<24;h++)
{
LcdWriteData(character0[h]);
}
LcdWriteCom(0x80);

// Ds1302Init();
while(1)
{
if(SetState==0)
{
Ds1302ReadTime();
}
else
{
if(K1==0) //检测按键K1是否按下
{
Delay10ms(); //消除抖动
if(K1==0)
{
SetPlace++;
if(SetPlace>=7)
SetPlace=0;
}

while((i<50)&&(K1==0)) //检测按键是否松开
{
Delay10ms();
i++;
}
i=0;
}
if(K2==0) //检测按键K2是否按下
{
Delay10ms(); //消除抖动
if(K2==0)
{
TIME[SetPlace]++;
if((TIME[SetPlace]&0x0f)>9) //换成BCD码。
{
TIME[SetPlace]=TIME[SetPlace]+6;
}
if((TIME[SetPlace]>=0x60)&&(SetPlace<2)) //分秒只能到59
{
TIME[SetPlace]=0;
}
if((TIME[SetPlace]>=0x24)&&(SetPlace==2)) //小时只能到23
{
TIME[SetPlace]=0;
}
if((TIME[SetPlace]>=0x32)&&(SetPlace==3)) //日只能到31
{
TIME[SetPlace]=0;
}
if((TIME[SetPlace]>=0x13)&&(SetPlace==4)) //月只能到12
{
TIME[SetPlace]=0;
}
if((TIME[SetPlace]>=0x7)&&(SetPlace==5)) //周只能到7
{
TIME[SetPlace]=1;
}
// if(SetPlace==5) //月只能到12
// {
// TIME[SetPlace]=;
// }
}

while((i<50)&&(K2==0)) //检测按键是否松开
{
Delay10ms();
i++;
}
i=0;

}
}
LcdDisplay();


}

}
/*******************************************************************************
*函数名:LcdDisplay()
*函数功能 :显示函数
*输入:无
*输出 :无
*******************************************************************************/

voidLcdDisplay()
{
LcdWriteCom(0x80+0X40);

LcdWriteCom(0x0f);
LcdWriteCom(0xc0|(2-0x40));
LcdWriteCom(0x0c);
Delay10ms();
LcdWriteData('0'+TIME[2]/16); //时
LcdWriteData('0'+(TIME[2]&0x0f));
LcdWriteData(':');
LcdWriteData('0'+TIME[1]/16); //分
LcdWriteData('0'+(TIME[1]&0x0f));
LcdWriteData(':');
LcdWriteData('0'+TIME[0]/16); //秒
LcdWriteData('0'+(TIME[0]&0x0f));

LcdWriteCom(0x80);
LcdWriteData('2');
LcdWriteData('0');
LcdWriteData('0'+TIME[6]/16); //年
LcdWriteData('0'+(TIME[6]&0x0f));
LcdWriteData(0x00);
LcdWriteData('0'+TIME[4]/16); //月
LcdWriteData('0'+(TIME[4]&0x0f));
LcdWriteData(0x01);
LcdWriteData('0'+TIME[3]/16); //日
LcdWriteData('0'+(TIME[3]&0x0f));
LcdWriteData(0x02);
LcdWriteCom(0x8D);
LcdWriteData('0'+(TIME[5]&0x07)-1); //星期
}
/*******************************************************************************
*函数名:Int0Configuration()
*函数功能 :配置外部中断0
*输入:无
*输出 :无
*******************************************************************************/

voidInt0Configuration()
{
//设置INT0
IT0=1;//跳变沿出发方式(下降沿)
EX0=1;//打开INT0的中断允许。
EA=1;//打开总中断
}
/*******************************************************************************
*函数名:Int0()
*函数功能 :外部中断0中断函数
*输入:无
*输出 :无
*******************************************************************************/

voidInt0()interrupt0
{
Delay10ms();
if(K3==0)
{
SetState=~SetState;
SetPlace=0;
Ds1302Init();
}
}
/*******************************************************************************
*函数名:Delay10ms
*函数功能 :延时函数,延时10ms
*输入:无
*输出 :无
*******************************************************************************/
voidDelay10ms(void)//误差0us
{
unsignedchara,b,c;
for(c=1;c>0;c--)
for(b=38;b>0;b--)
for(a=130;a>0;a--);
}

⑨ 基于51单片机,DS1302,1602实现万年历(年月日时分秒)及闹钟功能的C程序,不要显示农历和温度,谢谢!!

【八】电子表、万年历系列
[1]单片机公交车环境监测及时间显示系统
功能描述:
1、按键调时间
2、带备用电池(断电继续走时)
3、监测噪声和温湿度并实时显示
4、超过报警值蜂鸣器会响
☆已作出的实物优酷视频演示地址:
http://v.youku.com/v_show/id_XMTQ3OTMxMDUwMA==.html
[2]单片机语音报时电子表

功能描述:
1、按键调试设置闹钟
2、带备用电池(断电继续走时)
3、整点语音报时
☆已作出的实物优酷视频演示地址:
http://v.youku.com/v_show/id_XMTQ3OTMwMjM0OA==.html
[3]单片机红外遥控电子表语音报时语音播报温湿度

功能描述:
1、红外遥控调时间设定闹钟
2、带备用电池(断电继续走时)
3、整点语音报时语音播报温湿度
4、按键遥控语音报时语音播报温湿度
☆已作出的实物优酷视频演示地址:
http://v.youku.com/v_show/id_XMTQ3OTMxMTUyOA==.html
[4]单片机红外遥控电子表语音报时格林威治时间双显示

功能描述:
1、红外遥控调时间设定闹钟
2、带备用电池(断电继续走时)
3、整点语音报时语音播报温湿度
4、按键遥控语音报时语音播报温湿度
☆已作出的实物优酷视频演示地址:
http://v.youku.com/v_show/id_XMTQ3OTMxMTUyOA==.html
[5]单片机多功能万年历电子表系统节日提醒温湿度显示

功能描述:
1、按键调时间,设置闹钟
2、带备用电池(断电继续走时)
3、阳历、农历节日提醒;可显示上午、中午、晚上、午夜、深夜等时间段
4、温湿度实时显示(可替换其他传感器数据显示)
5、功能扩展:语音播报万年历、温湿度等。(此项功能为扩展功能,需要需补差价)
☆已作出的实物优酷视频演示地址:
http://v.youku.com/v_show/id_XMTU0MjI4OTExNg==.html
【二十】GPS授时定位系统系列
[1]GPS自动授时系统 语音报时/播报温湿度
实现功能:
1.可设置授时模式为自动授时和手动更新
2.可脱离GPS数据利用本地时钟芯片准确走时
3.可设置静音模式、整点报时和自动语音播报温湿度及其混合模式等四种语音工作模式
4.可以切换显示本地时间和温湿度数据和GPS卫星时间数据和定位数据
5.经过分析GPS数据,利用算法缩短了解析时间在秒级时间内就能获取到GPS时间数据(正常情况下,完成定位需要几分钟以上)
6.(亮点)利用算法自动计算星期参数和农历参数,程序内部算法输入任何阳历日期数据即可得到准确的星期数据和农历数据
7.利用12864串口工作模式,节省了8个IO
8.可根据需求进行功能定制
☆已作出的实物优酷视频演示地址:
http://v.youku.com/v_show/id_XMjUzMzcyNTkyOA==.html

⑩ 52单片机的万年历语言,八位LED共阴数码管动态显示年月日 时分秒

你描述的不对
有些地方不很完善
什么叫
万年历
语言,或许你想表达,编写单片机的语言,一般用c语言啊
8个
数码管
你要显示“年月日时分秒”,这样是显示不够的,比如年月日如:“13-06-21”,时分秒如:“11-28-05”,是这样吗
一般显示用
lcd1602
的比较多
为什么你要用8个按键呢,是调整日期吗?其实三个就够了啊,一个选择要调整的对象,一个增加,一个减少
你说全部与p30连接,是什么与他连接呢
可以交流
myID

阅读全文

与单片机万年历英文版相关的资料

热点内容
dvd光盘存储汉子算法 浏览:757
苹果邮件无法连接服务器地址 浏览:962
phpffmpeg转码 浏览:671
长沙好玩的解压项目 浏览:142
专属学情分析报告是什么app 浏览:564
php工程部署 浏览:833
android全屏透明 浏览:732
阿里云服务器已开通怎么办 浏览:803
光遇为什么登录时服务器已满 浏览:301
PDF分析 浏览:484
h3c光纤全工半全工设置命令 浏览:141
公司法pdf下载 浏览:381
linuxmarkdown 浏览:350
华为手机怎么多选文件夹 浏览:683
如何取消命令方块指令 浏览:349
风翼app为什么进不去了 浏览:778
im4java压缩图片 浏览:362
数据查询网站源码 浏览:150
伊克塞尔文档怎么进行加密 浏览:890
app转账是什么 浏览:163