|
基于51單片機(jī)的萬(wàn)年歷小項(xiàng)目,內(nèi)容比較簡(jiǎn)單就不給大伙丟人細(xì)講了。程序和仿真包含在附件中
仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)
51hei.gif (93.56 KB, 下載次數(shù): 44)
下載附件
2023-7-10 15:39 上傳
單片機(jī)源程序如下:
- #include <absacc.h>
- #include <intrins.h>
- #include <reg51.h>
- #include "HZcode.h"
- #include "LCD.h"
- #include "1302.h"
- #include "key.h"
- #include "adc0831.h"
- uchar time0_count; //time0計(jì)數(shù)器
- //time0初始化
- void time0_init(void)
- {
- EA = 1;
- ET0 = 1;
- TMOD = 0x01;
- PT0 = 1;
- TH0 = 0x3C;
- TL0 = 0xB0;
- TR0 = 1;
- }
- void main(void)
- {
-
- I_init();
- InitLCD();
- time0_init();
- show_hz();
- show_date_time();
- while(1)
- {
- judge_key();
- }
-
- }
- void time0_interrupt(void)interrupt 1
- {
- TH0 = 0x3c;
- TL0 = 0xb0;
- time0_count++;
- if(time0_count==20)
- {
- time0_count=0;
- show_date_time();
- a = readadc();
- b1 = a/100;
- b2 = (a%100)/10;
- b3 = (a%100)%10;
- r_show_ad();
- P3 = a; //進(jìn)行數(shù)模轉(zhuǎn)換
- }
- }
復(fù)制代碼
Keil代碼與Proteus仿真下載:
萬(wàn)年歷程序+仿真.7z
(189.36 KB, 下載次數(shù): 32)
2023-7-10 15:41 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
|
評(píng)分
-
查看全部評(píng)分
|