找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 1896|回復(fù): 1
打印 上一主題 下一主題
收起左側(cè)

單片機(jī)萬(wàn)年歷程序加仿真 DS1302+ADC0831+FM24C64F

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
基于51單片機(jī)的萬(wàn)年歷小項(xiàng)目,內(nèi)容比較簡(jiǎn)單就不給大伙丟人細(xì)講了。程序和仿真包含在附件中
仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)


單片機(jī)源程序如下:
  1. #include <absacc.h>
  2. #include <intrins.h>
  3. #include <reg51.h>
  4. #include "HZcode.h"
  5. #include "LCD.h"
  6. #include "1302.h"
  7. #include "key.h"
  8. #include "adc0831.h"

  9. uchar time0_count;         //time0計(jì)數(shù)器

  10. //time0初始化
  11. void time0_init(void)
  12. {
  13.         EA = 1;
  14.         ET0 = 1;
  15.         TMOD = 0x01;
  16.         PT0 = 1;
  17.         TH0 = 0x3C;
  18.         TL0 = 0xB0;
  19.         TR0 = 1;
  20. }

  21. void main(void)
  22. {
  23.        
  24.         I_init();
  25.         InitLCD();
  26.         time0_init();
  27.         show_hz();
  28.         show_date_time();
  29.         while(1)
  30.         {
  31.                 judge_key();
  32.         }
  33.                
  34. }
  35. void time0_interrupt(void)interrupt 1
  36. {
  37.         TH0 = 0x3c;
  38.         TL0 = 0xb0;
  39.         time0_count++;
  40.         if(time0_count==20)
  41.         {
  42.                 time0_count=0;
  43.                 show_date_time();
  44.                 a = readadc();
  45.                 b1 = a/100;
  46.                 b2 = (a%100)/10;
  47.                 b3 = (a%100)%10;
  48.                 r_show_ad();
  49.                 P3 = a;   //進(jìn)行數(shù)模轉(zhuǎn)換
  50.         }
  51. }
復(fù)制代碼

Keil代碼與Proteus仿真下載: 萬(wàn)年歷程序+仿真.7z (189.36 KB, 下載次數(shù): 32)

評(píng)分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎(jiǎng)勵(lì)!

查看全部評(píng)分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏1 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

沙發(fā)
ID:641483 發(fā)表于 2023-8-5 11:52 | 只看該作者
謝謝樓主分享,在正學(xué)習(xí)時(shí)間和溫度計(jì)顯示 收藏了
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表