導航:首頁 > 操作系統 > 單片機的數字萬年歷系統設計摘要

單片機的數字萬年歷系統設計摘要

發布時間:2022-07-22 04:25:22

❶ C51單片機的萬年歷程序設計

我這有個數碼管顯示的程序
以前做的,。。
你可以在我這個程序上修改修改
包括鍵盤掃描,還有動態顯示



【。。。】
#include
//常量參數
#define TMODW 0x01;
#define SCONW 0x00;
#define xplay 0x04;//顯示分頻系數
//顯示位選
unsigned char data stb;
//鍵值緩存,0xFF無鍵命令
unsigned char data keynum;
//顯示字型變數
unsigned char data play[8];
//工作參數
unsigned char data l,m;
//字型碼
unsigned char code BCDPC[10]=
{0x3F,0x06,0x5B,0x4F,0x66,
0x6D,0x7D,0x07,0x7F,0x6F};
//字位碼
unsigned char code STBCODE[8]=
{0x01,0x02,0x04,0x08,
0x10,0x20,0x40,0x80 };
//400Hz xplay分頻計數
unsigned char data cttime;
//時鍾參數
unsigned char data hr,min,sec,sec100;
//調整時鍾參數(時鍾「走」)
void ct1()
{sec100++;
if (sec100==100)
{sec100=0;sec++;
if (sec==60)
{sec=0;min++;
if (min==60)
{min=0;hr++;
if (hr==24) hr=0;
}
}
}
}
//時鍾參數→LED 顯示緩存7段參數轉換函數;
void xcplay()
{play[0]=BCDPC[hr/10];
play[1]=BCDPC[hr%10];
play[2]=BCDPC[min/10];
play[3]=BCDPC[min%10];
play[4]=BCDPC[sec/10];
play[5]=BCDPC[sec%10];
play[6]=BCDPC[sec100/10];
play[7]=BCDPC[sec100%10];
}
//顯示掃描
void cplay()
{T0=1;//T0-高電平消隱
T1=0;//T1-低電平準備發脈沖前沿
TI=0;//?
P1=0;//?
SBUF=STBCODE[stb];
while (TI==0)
{
};
TI=0;
SBUF=play[stb];
while (TI==0)
{
};
T1=1;
T0=0;
stb=++stb&0x07;
}

extern void cthl0();
//定時器0中斷處理程序
void ct0(void) interrupt 1 using 1
{cthl0();
cttime--;
if (cttime==0)
{cttime=xplay;
ct1();//調用時鍾「走」函數
xcplay();//調用時鍾參數→Led顯示緩存轉換函數
};
cplay();
}
void w20ms()
{for (l=0;l<41;l++)
{for (m=0;m<81;m++)
{
}
}
}
void tkey()
{P1=0xF0;
keynum=0xFF;
if (P1!=0xF0)
{w20ms();
P1=0xF0;
if (P1!=0xF0)
{P1=0xFE;
switch (P1)
{case 0xEE:keynum=0;break;
case 0xDE:keynum=1;break;
case 0xBE:keynum=2;break;
case 0x7E:keynum=3;break;
}
P1=0xFD;
switch (P1)
{case 0xED:keynum=4;break;
case 0xDD:keynum=5;break;
case 0xBD:keynum=6;break;
case 0x7B:keynum=7;break;
}
P1=0xFB;
switch (P1)
{
case 0xEB:keynum=8;break;
}
};
};
P1=0x00;
}
void command()
{switch (keynum)
{
case 0:{hr=hr+1;
if (hr==24)
hr=0;
}
break;

case 1:{min=min+1;
if (min==60)
min=0;
}
break;

case 2:{sec=sec+1;
if (sec==60)
sec=0;
}
break;

case 3:{sec100=0;
}
break;

case 4:{
while(!(P1=0xED))
{
hr=0;
min=0;
sec=0;
}
}
break;

case 5:{hr=hr-1;
if (hr==00)
hr=24;
}
break;
case 6:{min=min-1;
if (min==00)
min=59;
}
break;

case 7:{sec=sec-1;
if (sec==00)
sec=0;
}
break;

case 0xFF:break;
}
keynum=0xFF;
}
main ()
{ hr=8;
min=5;
sec=8;
sec100=0;
TMOD=TMODW;
SCON=SCONW;
ET0=1;
TR0=1;
EA=1;
cttime=xplay;
while (1)
{w20ms();
tkey();
command();

};
}

❷ 跪求 基於單片機的萬年歷的設計與製作

緒 論 1
§第一章 方案論證 3
1.1 單片機晶元的選擇方案和論證 3
1.2 顯示模塊選擇方案和論證 3
1.3 時鍾晶元的選擇方案和論證 4
1.4 鬧鍾語音方案方案和論證 4
1.5 溫度感測器方案和論證 4
1.6 電路設計最終方案決定 5
§第二章 系統的硬體設計與實現 6
2.1 電路設計框圖 6
2.2 主要單元電路的設計 6
§第三章 軟體設計 18
3.1 主程序模塊設計 18
3.2 鍵盤掃描模塊設計 19
3.3 系統設置模塊設計 20
3.4 溫度採集模塊設計 28
3.5 時鍾模塊設計 28
3.6 星期轉換集模塊設計 29
3.7 陰歷轉換模塊設計 30
§第四章 測試與結果分析 32
4.1 硬體測試 32
4.2 軟體測試 32
4.4 測試結果分析與結論 35
§第五章 使用說明書 37
參考文獻 39
謝 辭 40
附錄一 英文及譯文 41
附錄二 系統源程序 62
附錄三 系統原理圖 122
附錄四 系統PCB圖 123
附錄五 實物圖片 124

有原理圖,pcb圖,設計說明書,模擬圖等完整畢業論文資料
需要可以找我

本設計以單片機為核心,實現了2001至2099年的陰(陽)歷的年、月、日、時、分、秒、星期、鬧鍾、天干、地支、生肖、節假日的計算與准確顯示。系統設計使用C語言編寫源程序,進行了模塊化設計;以Keil uVision3 為編譯軟體,Proteus 7.5為模擬軟體 [email protected]

❸ 51單片機設計一個數字萬年歷電子系統

要實物嗎
我做單片機設計的

❹ 急求一片基於單片機的電子鍾 或者萬年歷的英文文獻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音頻信號產生及驅動電路
本電路的功能是接收控制電路發送來的整點報時及定時信號,根據系統設定產生不同頻率的音頻信號,由驅動電路加以放大驅動揚聲器發出聲音,從而實現整點報時及鬧鍾的功能。

希望可以幫到你!!!

❺ 電子萬年歷設計

您好,我看到您的問題很久沒有人來回答,但是問題過期無人回答會被扣分的並且你的懸賞分也會被沒收!所以我給你提幾條建議:
一,你可以選擇在正確的分類下去提問,這樣知道你問題答案的人才會多一些,回答的人也會多些。
二,您可以到與您問題相關專業網站論壇里去看看,那裡聚集了許多專業人才,一定可以為你解決問題的。
三,你可以向你的網上好友問友打聽,他們會更加真誠熱心為你尋找答案的,甚至可以到相關網站直接搜索.
四,網上很多專業論壇以及知識平台,上面也有很多資料,我遇到專業性的問題總是上論壇求解決辦法的。
五,將你的問題問的細一些,清楚一些!讓人更加容易看懂明白是什麼意思!
謝謝採納我的建議!

❻ 基於stc89c52單片機的萬年歷的設計

你好!

1、不用 ds1302 ,那麼計時精度和年月日的計時就會復雜一些

2、你採用什麼顯示,LED 還是 液晶呢

3、是採用 c語言 嗎

4、具體要求私信說明一下

❼ 單片機萬年歷設計

#include<reg52.h>#define uint unsigned int#define uchar unsigned charsbit DS1302_CLK = P3^1;sbit DS1302_IO = P3^2;sbit DS1302_RST = P3^0;uchar a,b,c,d,e,f,g,h;uchar code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};uchar wr_data[8]={0x11,0x12,0x06,0x02,0x10,0x53,0x10};uchar readtimeR[8];void delays(uint n){while(n--);}/*****************************************************************************函數功能:寫DS1302一個位元組子程序入口參數:出口參數:*****************************************************************************/void sendbyte(uchar a){uchar i,temp;temp=a;for(i=8;i>0;i--) { if(temp&0x01) //先發低位DS1302_IO=1;elseDS1302_IO=0;temp=temp>>1;DS1302_CLK=1;delays(5);DS1302_CLK=0;delays(5); }}/*****************************************************************************函數功能:讀DS1302一個位元組子程序入口參數:出口參數:*****************************************************************************/uchar readbyte(void){uchar i,dat=0;for(i=8;i>0;i--) {DS1302_IO=1;dat>>=1; if(DS1302_IO) dat|=0x80; DS1302_CLK=1;delays(5);DS1302_CLK=0;}return dat;} /*****************************************************************************函數功能:寫DS1302地址子程序入口參數:add入口數據:dat*****************************************************************************/void write_DS1302(uchar address,uchar dat){DS1302_RST=0;delays(10);DS1302_CLK=0;delays(10);DS1302_RST=1;delays(5);sendbyte(address);delays(5);sendbyte(dat);DS1302_RST=0;DS1302_CLK=0;}/*****************************************************************************函數功能:讀DS1302地址子程序入口參數:add出口參數:readtimeR[]*****************************************************************************/uchar read_DS1302(uchar address){ uchar timer;DS1302_RST=0;delays(2);DS1302_CLK=0;delays(2);DS1302_RST=1;sendbyte(address); timer=readbyte();DS1302_RST=0;DS1302_CLK=0;return timer;}/*****************************************************************************函數功能:初始化DS1302子程序入口參數:wr_data[](全局變數)出口參數:*****************************************************************************/void DS1302_init(){write_DS1302(0xbe,0x00);write_DS1302(0x8e,0x00); //關閉保護,若寫0x80,則開啟保護write_DS1302(0x8c,wr_data[0]); //年write_DS1302(0x88,wr_data[1]); //月write_DS1302(0x86,wr_data[2]); //日 write_DS1302(0x8A,wr_data[3]); //星期write_DS1302(0x84,wr_data[4]); //時write_DS1302(0x82,wr_data[5]); //分write_DS1302(0x80,wr_data[6]); //秒 write_DS1302(0x8e,0x80);}/*****************************************************************************函數功能:讀DS1302時間子程序入口參數:出口參數:全局變數(year,mouth,data,day,hour,minute,second)*****************************************************************************/void read_time(void){readtimeR[0]=read_DS1302(0x8d); //年readtimeR[1]=read_DS1302(0x89); //月readtimeR[2]=read_DS1302(0x87); //日readtimeR[3]=read_DS1302(0x8b); //周readtimeR[4]=read_DS1302(0x85); //時readtimeR[5]=read_DS1302(0x83); //分readtimeR[6]=read_DS1302(0x81); //秒}void ms(){ e=readtimeR[5]>>4;f=readtimeR[5]&0x0f;g=readtimeR[6]>>4;h=readtimeR[6]&0x0f;P2=0xfc;P0=table[e];delays(500);P2=0xfd;P0=table[f];delays(500);P2=0xfB;P0=table[g];delays(500);P2=0xf7;P0=table[h];delays(500);}void hm(){ c=readtimeR[4]>>4;d=readtimeR[4]&0x0f; e=readtimeR[5]>>4;f=readtimeR[5]&0x0f; P2=0xfc;P0=table[c];delays(500);P2=0xfd;P0=table[d];delays(500); P2=0xfb;P0=table[e];delays(500);P2=0xf7;P0=table[f];delays(500);}void main(){DS1302_init();while(1){read_time();// a=readtimeR[3]>>4;// b=readtimeR[3]&0x0f;/* P2=0xf8;P0=table[a];delays(500);P2=0xf9;P0=table[b];delays(500);*/// ms();hm();}}

閱讀全文

與單片機的數字萬年歷系統設計摘要相關的資料

熱點內容
上士命令 瀏覽:488
股市中帶星號的app是什麼 瀏覽:707
什麼路由可以刷機做列印機伺服器 瀏覽:5
電腦怎麼找到雲伺服器 瀏覽:871
微信怎麼發應用app 瀏覽:776
花生殼dns伺服器地址 瀏覽:648
squad伺服器一般什麼時候人多 瀏覽:479
程序員戰門課 瀏覽:474
config保存伺服器地址 瀏覽:317
預訂網吧座位的app叫什麼 瀏覽:416
香港伺服器主機地址 瀏覽:640
網店美工pdf 瀏覽:447
一堆文件夾怎麼弄出來 瀏覽:743
博途如何編譯硬體 瀏覽:418
fortran程序pdf 瀏覽:504
電池消耗演算法 瀏覽:394
伺服器中斷連接怎麼處理 瀏覽:222
上世紀互聯網不發達程序員很難 瀏覽:841
語音識別android開源 瀏覽:762
地埋式垃圾壓縮中轉站 瀏覽:902