久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 12386|回復: 29
打印 上一主題 下一主題
收起左側

單片機lcd240*64萬年歷制作 t6963控制器

  [復制鏈接]
跳轉到指定樓層
樓主
ID:93961 發表于 2016-1-5 22:21 來自手機 | 只看該作者 |只看大圖 回帖獎勵 |倒序瀏覽 |閱讀模式
用廢棄的24064液晶屏做了個萬年歷,t6963控制器。         
Proteus仿真+程序在2樓下載。


評分

參與人數 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎勵!

查看全部評分

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

使用道具 舉報

沙發
ID:93961 發表于 2016-1-7 11:47 | 只看該作者

RE: 單片機lcd24064萬年歷制作 t6963控制器

最近得到一個以T6963位控制器的24064液晶屏,看著挺好,就折騰了一段時間,也參考了一些別人的程序,感覺挺好的,屏幕很大,可能程序方面還有一點點小的改進,慢慢來吧,整體上差不多了。望玩友們多多交流。

3.JPG (27.52 KB, 下載次數: 314)

3.JPG

4.JPG (97.84 KB, 下載次數: 261)

4.JPG

5.JPG (122.81 KB, 下載次數: 272)

5.JPG

實物圖1.jpg (2.91 MB, 下載次數: 234)

實物圖1.jpg

實物圖2.jpg (2.77 MB, 下載次數: 243)

實物圖2.jpg

總圖1.JPG (198.66 KB, 下載次數: 296)

總圖1.JPG

總圖2.JPG (183.25 KB, 下載次數: 257)

總圖2.JPG

C語言和proteus程序.zip

35.89 KB, 下載次數: 208, 下載積分: 黑幣 -5

評分

參與人數 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎勵!

查看全部評分

回復

使用道具 舉報

板凳
ID:54731 發表于 2016-1-7 16:46 | 只看該作者
樓主:資料不全呀?大家如何學習
回復

使用道具 舉報

地板
ID:93961 發表于 2016-1-8 10:49 來自手機 | 只看該作者
剩余的資料網上都有
回復

使用道具 舉報

5#
ID:1 發表于 2016-1-11 04:23 | 只看該作者
南天白云 發表于 2016-1-7 16:46
樓主:資料不全呀?大家如何學習

資料已經很全了,仿真,電路圖,程序都有,可以直接制作了,你還缺什么?

下面是樓主的程序:
  1.                           //此程序下載至單片機中不會因失電而錯亂,顯示任意字符和漢字
  2. #include <reg52.h>
  3. //#include <intrins.h>
  4. #include <math.h>

  5. //#define nop()  _nop_()       
  6. #define uchar unsigned char
  7. #define uint unsigned int
  8.        
  9. //1. FG:液晶邊框引出端,應該接地
  10. //2. VSS:邏輯電源地,接電源的負極
  11. //3. VDD:邏輯電源正,接電源的正極
  12. //4. V0:LCD驅動電壓輸入端,可通過滑動變阻器接到電源正極上,改變電阻大小來改變液晶對比度
  13. sbit LCDWR =P3^6;//5. /WR:寫數據信號,上升沿鎖存       
  14. sbit LCDRD =P3^7;//6. /RD:讀數據信號,上升沿鎖存       
  15. sbit LCDCE =P3^5;//7. /CE:LCD選通信號,低電平有效       
  16. sbit LCDCD =P2^0;//8. C/D:命令/數據:高電平為命令,低電平為數據       
  17. //9.:暫時沒用
  18. sbit LCDRST =P3^4;//10. /RST:復位信號,低電平有效
  19. #define lcd_bus        P0//11-18. DB0-DB7 :8位數據總線
  20. //19. FS:字體選擇,H:6X8點,L:8X8點
  21. //20. VEE
  22. //21. LEDA:背光電源正極
  23. //22. LEDK:背光電源負極

  24. sbit DQ18B20=P1^3;//ds18b20與單片機連接口

  25. sbit acc0=ACC^0;             //移位時的第0位
  26. sbit acc7=ACC^7;             //移位時用的第7位

  27. sbit DATA1302=P1^7;   //時鐘數據接口
  28. sbit RST1302=P1^5;     
  29. sbit SCLK1302=P1^6;   
  30. sbit menu=P3^0;              //菜單  
  31. sbit add=P3^1;               //加一
  32. sbit dec=P3^2;               //減一

  33. uchar second,minute,hour,day,month,year,week,count=0;     
  34. uchar ReadValue,num,time;     
  35. uint tvalue;//溫度值
  36. uchar tflag;
  37.                             
  38. //----  LCD PIXEL SETTING  ------------------------------------------------------
  39. #define PIXELH 64
  40. #define PIXELW 240

  41. //-------------------------------------------------------------------------------
  42.                           
  43. unsigned char code tab1[]=//16x16的漢字或者圖片
  44. {  
  45. 0x08,0x00,0x0F,0xFC,0x10,0x80,0x10,0x80,0x20,0x80,0x4F,0xF8,0x88,0x80,0x08,0x80,
  46. 0x08,0x80,0x08,0x80,0xFF,0xFE,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,//年",0
  47. 0x07,0xF0,0x04,0x10,0x04,0x10,0x04,0x10,0x07,0xF0,0x04,0x10,0x04,0x10,0x04,0x10,
  48. 0x07,0xF0,0x04,0x10,0x08,0x10,0x08,0x10,0x10,0x10,0x20,0x50,0x40,0x20,0x00,0x00,//月",1
  49. 0x00,0x00,0x1F,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1F,0xF0,0x10,0x10,
  50. 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1F,0xF0,0x10,0x10,0x00,0x00,0x00,0x00,//日",2
  51. 0x00,0x00,0x1F,0xF8,0x10,0x08,0x1F,0xF8,0x10,0x08,0x1F,0xF8,0x01,0x00,0x11,0x00,
  52. 0x1F,0xFC,0x21,0x00,0x21,0x00,0x4F,0xF8,0x01,0x00,0x01,0x00,0x7F,0xFE,0x00,0x00,//星",3
  53. 0x22,0x00,0x22,0x7C,0x7F,0x44,0x22,0x44,0x3E,0x44,0x22,0x7C,0x3E,0x44,0x22,0x44,
  54. 0x22,0x44,0xFF,0x7C,0x00,0x44,0x24,0x84,0x22,0x84,0x43,0x14,0x81,0x08,0x00,0x00,//期",4
  55. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x7F,0xFE,
  56. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//一",5
  57. 0x00,0x00,0x00,0x10,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  58. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x7F,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,//二",6
  59. 0x00,0x00,0x00,0x00,0x7F,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF8,
  60. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFE,0x00,0x00,0x00,0x00,//三",7
  61. 0x00,0x00,0x7F,0xFC,0x44,0x84,0x44,0x84,0x44,0x84,0x44,0x84,0x44,0x84,0x44,0x84,
  62. 0x48,0x84,0x48,0x7C,0x50,0x04,0x60,0x04,0x40,0x04,0x7F,0xFC,0x40,0x04,0x00,0x00,//四",8
  63. 0x00,0x00,0x7F,0xF8,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x20,0x3F,0xF0,
  64. 0x04,0x20,0x04,0x20,0x04,0x20,0x04,0x20,0x04,0x24,0xFF,0xFE,0x00,0x00,0x00,0x00,//五",9
  65. 0x04,0x00,0x03,0x00,0x01,0x80,0x01,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x04,0x80,
  66. 0x06,0x40,0x04,0x20,0x08,0x10,0x08,0x18,0x10,0x0C,0x20,0x0C,0x40,0x08,0x00,0x00,//六",10
  67. 0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0xFE,0x7F,0x00,0x01,0x00,
  68. 0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x04,0x01,0x04,0x01,0x04,0x00,0xF8,0x00,0x00,//七",11
  69. 0x00,0x00,0x00,0x40,0x04,0x60,0x06,0x40,0x04,0x40,0x04,0x40,0x04,0x40,0x08,0x20,
  70. 0x08,0x20,0x10,0x10,0x10,0x10,0x20,0x08,0x40,0x0E,0x80,0x04,0x00,0x00,0x00,0x00,//八",12
  71. 0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x20,0x7F,0xF0,0x02,0x20,0x02,0x20,0x04,0x20,
  72. 0x04,0x20,0x04,0x20,0x08,0x20,0x08,0x24,0x10,0x24,0x20,0x26,0x40,0x3C,0x00,0x00,//九",13
  73. 0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0xFF,0xFE,0x01,0x00,
  74. 0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x00,0x00,//十",14
  75. 0x00,0x00,0x7F,0xFE,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x10,0x80,0x10,0xFC,
  76. 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0xFF,0xFE,0x00,0x00,0x00,0x00,//正",15
  77. 0x00,0x90,0x78,0x90,0x4B,0xFE,0x48,0x90,0x78,0x90,0x48,0x90,0x4B,0xFE,0x48,0x00,
  78. 0x79,0xF8,0x49,0x08,0x49,0x08,0x49,0xF8,0x49,0x08,0x49,0x08,0xA9,0xF8,0x91,0x08,//臘",16

  79. 0x02,0x00,0x03,0x00,0x02,0x04,0x3F,0xFE,0x22,0x04,0x45,0x08,0x05,0x10,0x0C,0xB8,
  80. 0x18,0xA0,0x28,0x40,0x48,0x20,0x88,0x30,0x09,0x18,0x0A,0x0E,0x1C,0x08,0x08,0x00,//農",17
  81. 0x00,0x00,0x3F,0xFE,0x20,0x00,0x20,0x80,0x20,0x80,0x2F,0xF8,0x20,0x88,0x20,0x88,
  82. 0x20,0x88,0x21,0x08,0x21,0x08,0x22,0x08,0x42,0x08,0x44,0x38,0x88,0x10,0x00,0x00,//歷",18
  83. 0x08,0x20,0x04,0x30,0x02,0x40,0x3F,0xFC,0x01,0x00,0x01,0x00,0x1F,0xF8,0x01,0x00,
  84. 0x01,0x00,0x7F,0xFE,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,//羊",19
  85. 0x08,0x00,0x0F,0xFC,0x10,0x80,0x10,0x80,0x20,0x80,0x4F,0xF8,0x88,0x80,0x08,0x80,
  86. 0x08,0x80,0x08,0x80,0xFF,0xFE,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,//年",20

  87. 0x01,0xC0,0x02,0x20,0x02,0xE0,0x02,0x20,0x02,0xE0,0x02,0x20,0x02,0xE0,0x02,0x20,
  88. 0x02,0xE0,0x02,0x20,0x0F,0xF8,0x0F,0xF8,0x07,0xF0,0x03,0xE0,0x01,0xC0,0x00,0x00,//"溫度計符號",21

  89. 0x00,0x00,0x00,0x00,0x78,0x00,0x48,0xFC,0x49,0x04,0x79,0x04,0x02,0x00,0x02,0x00,
  90. 0x02,0x00,0x02,0x00,0x02,0x04,0x01,0x04,0x01,0x08,0x00,0xF0,0x00,0x00,0x00,0x00,//"℃,22

  91. 0x00,0x00,0x01,0x00,0x02,0x80,0x04,0x40,0x05,0xC0,0x04,0x40,0x05,0xC0,0x04,0x40,
  92. 0x05,0xC0,0x04,0x40,0x05,0xC0,0x04,0x40,0x0F,0xE0,0x07,0xC0,0x03,0x80,0x01,0x00,//溫度計的圖片,23

  93. };

  94. unsigned char code tab2[]=//8x16的字符
  95. {
  96. 0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18,0x00,0x00,//0",0
  97. 0x00,0x00,0x00,0x10,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,//1",1
  98. 0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x04,0x04,0x08,0x10,0x20,0x42,0x7E,0x00,0x00,//2",2
  99. 0x00,0x00,0x00,0x3C,0x42,0x42,0x04,0x18,0x04,0x02,0x02,0x42,0x44,0x38,0x00,0x00,//3",3
  100. 0x00,0x00,0x00,0x04,0x0C,0x14,0x24,0x24,0x44,0x44,0x7E,0x04,0x04,0x1E,0x00,0x00,//4",4
  101. 0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x58,0x64,0x02,0x02,0x42,0x44,0x38,0x00,0x00,//5",5
  102. 0x00,0x00,0x00,0x1C,0x24,0x40,0x40,0x58,0x64,0x42,0x42,0x42,0x24,0x18,0x00,0x00,//6",6
  103. 0x00,0x00,0x00,0x7E,0x44,0x44,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,//7",7
  104. 0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x24,0x18,0x24,0x42,0x42,0x42,0x3C,0x00,0x00,//8",8
  105. 0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x26,0x1A,0x02,0x02,0x24,0x38,0x00,0x00,//9",9
  106. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,//.",10
  107. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//負號,11
  108. 0x00,0x00,0x00,0x00,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x00,0x00,0x00,0x00,0x00,//正號,12
  109. };
  110. unsigned char code tab3[]=//24x48的手繪數字
  111. {
  112. 0x00,0x00,0x00,0x03,0xFF,0xC0,0x07,0xFF,0xE0,0x0F,0xFF,0xF0,0x1F,0xFF,0xF8,0x3E,
  113. 0x00,0x7C,0x7C,0x00,0x3E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,
  114. 0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,
  115. 0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,
  116. 0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,
  117. 0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,
  118. 0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,
  119. 0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x7C,0x00,0x3E,0x3E,0x00,
  120. 0x7C,0x1F,0xFF,0xF8,0x0F,0xFF,0xF0,0x07,0xFF,0xE0,0x03,0xFF,0xC0,0x00,0x00,0x00,//手繪0

  121. 0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x1C,0x00,0x00,0x3C,0x00,0x03,0xFC,0x00,0x03,
  122. 0xFC,0x00,0x03,0xFC,0x00,0x03,0xFC,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x3C,
  123. 0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,
  124. 0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,
  125. 0x3C,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x3C,
  126. 0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,
  127. 0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,
  128. 0x3C,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0xFF,
  129. 0x00,0x1F,0xFF,0xF8,0x1F,0xFF,0xF8,0x1F,0xFF,0xF8,0x1F,0xFF,0xF8,0x00,0x00,0x00,//手繪1

  130. 0x00,0x00,0x00,0x01,0xFE,0x00,0x07,0xFF,0xC0,0x1F,0xFF,0xF0,0x3F,0xFF,0xF8,0x3C,
  131. 0x00,0x7C,0x78,0x00,0x3E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,
  132. 0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x00,0x00,0x1E,0x00,0x00,0x1E,
  133. 0x00,0x00,0x1E,0x00,0x00,0x1E,0x00,0x00,0x1E,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,
  134. 0x00,0x78,0x00,0x00,0x78,0x00,0x00,0xF0,0x00,0x01,0xE0,0x00,0x03,0xC0,0x00,0x07,
  135. 0x80,0x00,0x0F,0x00,0x00,0x1E,0x00,0x00,0x3C,0x00,0x00,0x78,0x00,0x00,0xF0,0x00,
  136. 0x01,0xE0,0x00,0x03,0xC0,0x00,0x07,0x80,0x00,0x0F,0x00,0x00,0x1E,0x00,0x00,0x3C,
  137. 0x00,0x00,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,
  138. 0x1E,0x7F,0xFF,0xFE,0x7F,0xFF,0xFE,0x7F,0xFF,0xFE,0x7F,0xFF,0xFE,0x00,0x00,0x00,//手繪2

  139. 0x00,0x00,0x00,0x00,0xFF,0x80,0x03,0xFF,0xE0,0x0F,0xFF,0xF0,0x3F,0xFF,0xFC,0x3F,
  140. 0x00,0x3E,0x3C,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,
  141. 0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x00,0x00,0x1E,
  142. 0x00,0x00,0x1E,0x00,0x00,0x3E,0x00,0x00,0x7E,0x00,0x00,0xFC,0x00,0x01,0xF0,0x00,
  143. 0x03,0xC0,0x00,0x7F,0x80,0x00,0x7F,0x00,0x00,0x7F,0x80,0x00,0x7F,0xC0,0x00,0x03,
  144. 0xE0,0x00,0x01,0xF8,0x00,0x00,0x7C,0x00,0x00,0x3E,0x00,0x00,0x1E,0x00,0x00,0x1E,
  145. 0x00,0x00,0x1E,0x00,0x00,0x1E,0x00,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,
  146. 0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x3C,0x00,
  147. 0x7E,0x3F,0xFF,0xFC,0x1F,0xFF,0xF8,0x07,0xFF,0xE0,0x03,0xFF,0x80,0x00,0x00,0x00,//手繪3

  148. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x00,0x07,0xC0,0x00,0x07,0xC0,0x00,
  149. 0x0F,0xC0,0x00,0x0F,0xC0,0x00,0x1F,0xC0,0x00,0x1F,0xC0,0x00,0x3F,0xC0,0x00,0x3F,
  150. 0xC0,0x00,0x7B,0xC0,0x00,0x7B,0xC0,0x00,0xF3,0xC0,0x00,0xF3,0xC0,0x01,0xE3,0xC0,
  151. 0x01,0xE3,0xC0,0x03,0xC3,0xC0,0x03,0xC3,0xC0,0x07,0x83,0xC0,0x07,0x83,0xC0,0x0F,
  152. 0x03,0xC0,0x0F,0x03,0xC0,0x1E,0x03,0xC0,0x1E,0x03,0xC0,0x3C,0x03,0xC0,0x3C,0x03,
  153. 0xC0,0x78,0x03,0xC0,0x78,0x03,0xC0,0x78,0x03,0xC0,0x78,0x03,0xC0,0x78,0x03,0xC0,
  154. 0x7F,0xFF,0xFE,0x7F,0xFF,0xFE,0x7F,0xFF,0xFE,0x7F,0xFF,0xFE,0x00,0x03,0xC0,0x00,
  155. 0x03,0xC0,0x00,0x03,0xC0,0x00,0x03,0xC0,0x00,0x03,0xC0,0x00,0x03,0xC0,0x00,0x03,
  156. 0xC0,0x00,0xFF,0xFE,0x00,0xFF,0xFE,0x00,0xFF,0xFE,0x00,0xFF,0xFE,0x00,0x00,0x00,//手繪4

  157. 0x00,0x00,0x00,0x7F,0xFF,0xFE,0x7F,0xFF,0xFE,0x7F,0xFF,0xFE,0x7F,0xFF,0xFE,0x78,
  158. 0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,
  159. 0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,
  160. 0x78,0x00,0x00,0x78,0x3F,0xC0,0x78,0x7F,0xE0,0x7C,0xFF,0xF0,0x7F,0xFF,0xF8,0x7F,
  161. 0xC0,0x7C,0x7F,0x80,0x3E,0x7F,0x00,0x1E,0x00,0x00,0x1E,0x00,0x00,0x1E,0x00,0x00,
  162. 0x1E,0x00,0x00,0x1E,0x00,0x00,0x1E,0x00,0x00,0x1E,0x00,0x00,0x1E,0x00,0x00,0x1E,
  163. 0x00,0x00,0x1E,0x00,0x00,0x1E,0x00,0x00,0x1E,0x00,0x00,0x1E,0x78,0x00,0x1E,0x78,
  164. 0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x3C,0x78,0x00,0x3C,0x78,0x00,0x78,0x7C,0x00,
  165. 0xF8,0x3F,0xFF,0xF0,0x3F,0xFF,0xE0,0x1F,0xFF,0xC0,0x0F,0xFF,0x80,0x00,0x00,0x00,//手繪5

  166. 0x00,0x00,0x00,0x01,0xFF,0xC0,0x07,0xFF,0xF0,0x0F,0xFF,0xF8,0x1F,0xFF,0xFC,0x3F,
  167. 0x81,0xFC,0x7F,0x00,0xFC,0x7E,0x00,0x7C,0x7C,0x00,0x3C,0x78,0x00,0x3C,0x78,0x00,
  168. 0x3C,0x78,0x00,0x3C,0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,
  169. 0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,
  170. 0xFF,0x80,0x7B,0xFF,0xE0,0x7F,0xFF,0xF0,0x7F,0xFF,0xF8,0x7F,0x00,0x7C,0x7C,0x00,
  171. 0x3C,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,
  172. 0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,
  173. 0x00,0x1E,0x78,0x00,0x1E,0x3C,0x00,0x3C,0x3C,0x00,0x3C,0x1E,0x00,0x78,0x1F,0x00,
  174. 0xF8,0x0F,0xFF,0xF0,0x07,0xFF,0xF0,0x03,0xFF,0xE0,0x01,0xFF,0xC0,0x00,0x00,0x00,//手繪6

  175. 0x00,0x00,0x00,0x7F,0xFF,0xFE,0x7F,0xFF,0xFE,0x7F,0xFF,0xFE,0x7F,0xFF,0xFE,0x78,
  176. 0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x00,0x00,0x3C,0x00,0x00,
  177. 0x78,0x00,0x00,0xF0,0x00,0x01,0xE0,0x00,0x01,0xE0,0x00,0x03,0xC0,0x00,0x03,0xC0,
  178. 0x00,0x07,0x80,0x00,0x07,0x80,0x00,0x0F,0x00,0x00,0x0F,0x00,0x00,0x1E,0x00,0x00,
  179. 0x1E,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,
  180. 0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,
  181. 0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,
  182. 0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,
  183. 0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x78,0x00,0x00,0x00,0x00,//手繪7

  184. 0x00,0x00,0x00,0x03,0xFF,0xC0,0x07,0xFF,0xE0,0x0F,0xFF,0xF0,0x1F,0xFF,0xF8,0x3E,
  185. 0x00,0x7C,0x7C,0x00,0x3E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,
  186. 0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,
  187. 0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x3C,0x00,0x3C,0x1E,0x00,0x78,0x0F,
  188. 0x00,0xF0,0x07,0xFF,0xE0,0x03,0xFF,0xC0,0x03,0xFF,0xC0,0x07,0xFF,0xE0,0x0F,0x00,
  189. 0xF0,0x1E,0x00,0x78,0x3C,0x00,0x3C,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,
  190. 0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,
  191. 0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x7C,0x00,0x3E,0x3E,0x00,
  192. 0x7C,0x1F,0xFF,0xF8,0x0F,0xFF,0xF0,0x07,0xFF,0xE0,0x03,0xFF,0xC0,0x00,0x00,0x00,//手繪8

  193. 0x00,0x00,0x00,0x03,0xFF,0xC0,0x07,0xFF,0xE0,0x0F,0xFF,0xF0,0x1F,0xFF,0xF8,0x3E,
  194. 0x00,0x7C,0x7C,0x00,0x3E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,
  195. 0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,
  196. 0x78,0x00,0x1E,0x78,0x00,0x1E,0x78,0x00,0x1E,0x3C,0x00,0x3E,0x1F,0x00,0x7E,0x1F,
  197. 0x80,0xFE,0x0F,0xFF,0xFE,0x07,0xFF,0xDE,0x03,0xFF,0x9E,0x00,0xFF,0x1E,0x00,0x00,
  198. 0x1E,0x00,0x00,0x1E,0x00,0x00,0x1E,0x00,0x00,0x1E,0x00,0x00,0x1E,0x00,0x00,0x1E,
  199. 0x00,0x00,0x1E,0x00,0x00,0x1E,0x00,0x00,0x1E,0x00,0x00,0x1E,0x3C,0x00,0x1E,0x3C,
  200. 0x00,0x1E,0x3C,0x00,0x1E,0x3C,0x00,0x1E,0x3C,0x00,0x1E,0x3C,0x00,0x3E,0x3E,0x00,
  201. 0x7C,0x1F,0xFF,0xF8,0x0F,0xFF,0xF0,0x07,0xFF,0xE0,0x03,0xFF,0xC0,0x00,0x00,0x00,//手繪9
  202. };
  203. uchar code tab4[]= //8x48的字符:
  204. {
  205. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x7E,0xFF,0xFF,0xFF,0xFF,
  206. 0xFF,0xFF,0x7E,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x7E,0xFF,0xFF,
  207. 0xFF,0xFF,0xFF,0xFF,0x7E,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//
  208. };
  209. uchar code tab5[]= //16x16,星期用
  210. {
  211.         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x7F,0xFE,
  212.         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//一",0
  213.         0x00,0x00,0x00,0x10,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  214.         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x7F,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,//二",1
  215.         0x00,0x00,0x00,0x00,0x7F,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF8,
  216.         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFE,0x00,0x00,0x00,0x00,//三",2
  217.         0x00,0x00,0x7F,0xFC,0x44,0x84,0x44,0x84,0x44,0x84,0x44,0x84,0x44,0x84,0x44,0x84,
  218.         0x48,0x84,0x48,0x7C,0x50,0x04,0x60,0x04,0x40,0x04,0x7F,0xFC,0x40,0x04,0x00,0x00,//四",3
  219.         0x00,0x00,0x7F,0xF8,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x20,0x3F,0xF0,
  220.         0x04,0x20,0x04,0x20,0x04,0x20,0x04,0x20,0x04,0x24,0xFF,0xFE,0x00,0x00,0x00,0x00,//五",4
  221.         0x04,0x00,0x03,0x00,0x01,0x80,0x01,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x04,0x80,
  222.         0x06,0x40,0x04,0x20,0x08,0x10,0x08,0x18,0x10,0x0C,0x20,0x0C,0x40,0x08,0x00,0x00,//六",5
  223.         0x00,0x00,0x1F,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1F,0xF0,0x10,0x10,
  224.         0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1F,0xF0,0x10,0x10,0x00,0x00,0x00,0x00,//日",6       
  225. };
  226. /*****************1ms延時函數****************/
  227. void delay(uint z)
  228. {
  229.         uint x,y;
  230.         for(x=z;x>0;x--)
  231.                 for(y=110;y>0;y--);
  232. }
  233. void delay1(uint z) //微秒延時
  234. {
  235.         for(;z>0;z--);
  236. }
  237. unsigned char rd_cmd6963(void)
  238. {                    
  239.    unsigned char addr_st;
  240.    LCDCD = 1;
  241.    LCDWR = 1;
  242.    LCDCE = 0;
  243.    lcd_bus =0xff;
  244.    addr_st = lcd_bus;
  245.    LCDRD = 0;      
  246.    LCDRD = 1;
  247.    LCDCE = 1;
  248.    return(addr_st);
  249. }
  250. /*****************檢查忙狀態程序****************/
  251. void chkbusy6963(void)
  252. {
  253.    unsigned char busy;
  254.    do
  255.          {
  256.                  busy =!(rd_cmd6963() & 0x03);         
  257.          }while(busy);
  258. }
  259. /*****************寫數據****************/
  260. void wr_dat6963(unsigned char datax)
  261. {
  262.    chkbusy6963();
  263.    LCDCD = 0;
  264.    LCDRD = 1;
  265.    LCDCE = 0;
  266.    lcd_bus = datax;
  267.    LCDWR = 0;
  268.    LCDWR = 1;
  269.    LCDCE = 1;
  270. }
  271. /*****************寫命令****************/
  272. void wr_cmd6963(unsigned char cmdx)
  273. {
  274.    chkbusy6963();
  275.    LCDCD = 1;
  276.    LCDRD = 1;
  277.    LCDCE = 0;
  278.    lcd_bus = cmdx;
  279.    LCDWR = 0;
  280.    LCDWR = 1;
  281.    LCDCE = 1;
  282. }

  283. /*****************寫寄存器程序****************/
  284. void wr_reg6963(unsigned char cmd,unsigned char dat1,unsigned char dat2)
  285. {
  286.         wr_dat6963(dat1);
  287.         wr_dat6963(dat2);
  288.         wr_cmd6963(cmd);
  289. }

  290. //顯示指針,圖形模式graphics=1,文本模式graphics=0;X坐標x_axis,以8個像素為一個單位
  291. //Y坐標y_axis,圖形模式以1個像素為單位,文本模式以8個像素為單位
  292. void lcd_cursor6963(unsigned char graphics,unsigned char x_axis,unsigned char y_axis)
  293. {
  294.    unsigned int tmp;
  295.    if(graphics)tmp = y_axis*(PIXELW/8) + x_axis + 0x800;
  296.    else  tmp = y_axis*(PIXELW/8) + x_axis;
  297.    wr_reg6963(0x24,(unsigned char)(tmp),(unsigned char)(tmp>>8));
  298.    wr_cmd6963(0xb0);
  299. }
  300. /*****************液晶屏初始化程序****************/
  301. void init6963(void)
  302. {
  303.         LCDRST =0;
  304.         delay(100);
  305.         LCDRST =1;
  306.         wr_cmd6963(0xf0);                         //bit reset
  307.         wr_reg6963(0x21,0x00,0x00);    //光標地址設置  
  308.         wr_reg6963(0x22,0x00,0x00);           //CGRAM偏置地址設置
  309.         wr_reg6963(0x24,0x00,0x00);    //顯示地址設置
  310.         wr_reg6963(0x40,0x00,0x00);  //文本顯示區首地址  
  311.         wr_reg6963(0x41,(unsigned char)(PIXELW/8),0x00);  //文本顯示區寬度   
  312.         wr_reg6963(0x42,0x00,0x08);  //圖形顯示區首地址  
  313.         wr_reg6963(0x43,(unsigned char)(PIXELW/8),0x00);  //圖形顯示區寬度  
  314.         wr_cmd6963(0x80);               // OR mode   
  315.         wr_cmd6963(0x9c);               //文本圖形開
  316.         wr_cmd6963(0xa0);               //7line指針   
  317. }
  318. /*****************全屏顯示內容程序****************/
  319. void lcd_showfull(unsigned char datx)
  320. {
  321.         unsigned int i;
  322.         lcd_cursor6963(0,0,0);
  323.         for(i=0;i<((PIXELW/8)*(PIXELH/8));i++)wr_dat6963(0);
  324.         wr_cmd6963(0xb2);
  325.         lcd_cursor6963(1,0,0);
  326.         for(i=0;i<((PIXELW/8)*PIXELH);i++)wr_dat6963(datx);
  327.         wr_cmd6963(0xb2);                                   //屏刷完后需要補上這句
  328. }
  329. //顯示自定義16X16字符,x_axis為X軸,以8像素為單位,y_axis為Y軸,以1像素為單位
  330. void lcd_defcharacter16x16(unsigned char x_axis,unsigned char y_axis,unsigned char ctnchar,unsigned char startchar,unsigned char code *text)
  331. {//ctnchar為要顯示的總字符數,startchar為自定義內碼的第幾個啟動顯示字符(即表格中的漢字),text為自定義的字符內碼
  332.    unsigned char line,ctn;
  333.    text += startchar*32;
  334.    for(ctn=0;ctnchar>0;ctnchar--,ctn+=2)
  335.      {
  336.                  for(line=0;line<16;line++)
  337.                   {
  338.                            lcd_cursor6963(1,x_axis+ctn,y_axis+line);
  339.                          wr_dat6963(*(text++));
  340.                            wr_dat6963(*(text++));
  341.                          wr_cmd6963(0xb2);                         //屏刷完后需要補上這句
  342.                   }                                                   
  343.          }          
  344. }
  345. //顯示自定義8X16字符,x_axis為X軸,以8像素為單位,y_axis為Y軸,以1像素為單位
  346. void lcd_defcharacter8x16(unsigned char x_axis,unsigned char y_axis,unsigned char ctnchar,unsigned char startchar,unsigned char code *text)
  347. {//ctnchar為要顯示的總字符數,startchar為自定義內碼的第幾個啟動顯示字符(即表格中的漢字),text為自定義的字符內碼
  348.    unsigned char line,ctn;
  349.    text=text + startchar*16;
  350.    for(ctn=0;ctnchar>0;ctnchar--,ctn++)
  351.      {
  352.                  for(line=0;line<16;line++)
  353.                   {
  354.                            lcd_cursor6963(1,x_axis+ctn,y_axis+line);
  355.                            wr_dat6963(*(text++));
  356.                          wr_cmd6963(0xb2);                         //屏刷完后需要補上這句
  357.                   }                                                   
  358.          }          
  359. }         
  360. //顯示自定義24X48字符,x_axis為X軸,以8像素為單位,y_axis為Y軸,以1像素為單位
  361. void lcd_defcharacter24x48(uchar x_axis,uchar y_axis,uchar ctnchar,uchar startchar,uchar code *text)
  362. {//ctnchar為要顯示的總字符數,startchar為自定義內碼的第幾個啟動顯示字符(即表格中的漢字),text為自定義的字符內碼       
  363.    uchar line,ctn;
  364.    text=text+startchar*144; //
  365.    for(ctn=0;ctnchar>0;ctnchar--,ctn=ctn+3)
  366.      {
  367.                  for(line=0;line<48;line++)
  368.                   {
  369.                            lcd_cursor6963(1,x_axis+ctn,y_axis+line);//
  370.                          wr_dat6963(*(text++));
  371.                          wr_dat6963(*(text++));
  372.                          wr_dat6963(*(text++));
  373.                          wr_cmd6963(0xb2);                         //復位自動讀寫模式,屏刷完后需要補上這句
  374.                   }                                                   
  375.          }          
  376. }
  377. //顯示自定義8X48字符,x_axis為X軸,以8像素為單位,y_axis為Y軸,以1像素為單位
  378. void lcd_defcharacter8x48(uchar x_axis,uchar y_axis,uchar ctnchar,uchar startchar,uchar code *text)
  379. {
  380.         //ctnchar為要顯示的總字符數
  381.         //startchar為自定義內碼的第幾個啟動顯示字符(即表格中的漢字)
  382.         //text為自定義的字符內碼       
  383.    uchar line,ctn;
  384.   text=text+startchar*32; //
  385.    for(ctn=0;ctnchar>0;ctnchar--,ctn=ctn+2)
  386.      {
  387.                  for(line=0;line<48;line++)
  388.                   {
  389.                            lcd_cursor6963(1,x_axis+ctn,y_axis+line);//
  390.                          wr_dat6963(*(text++));
  391.                          wr_cmd6963(0xb2);                         //復位自動讀寫模式,屏刷完后需要補上這句
  392.                   }                                                   
  393.          }          
  394. }

  395. void Write1302(uchar dat) //1302寫
  396. {
  397.           uchar i;  
  398.           SCLK1302=0;           //拉低SCLK,為脈沖上升沿寫入數據做好準備
  399.           delay1(2);       //稍微等待,使硬件做好準備
  400.           for(i=0;i<8;i++)      //連續寫8個二進制位數據
  401.             {
  402.                    DATA1302=dat&0x01;    //取出dat的第0位數據寫入1302
  403.                    delay(2);       //稍微等待,使硬件做好準備
  404.                    SCLK1302=1;           //上升沿寫入數據
  405.                    delay1(2);      //稍微等待,使硬件做好準備
  406.                    SCLK1302=0;           //重新拉低SCLK,形成脈沖                   
  407.                    dat>>=1;          //將dat的各數據位右移1位,準備寫入下一個數據位
  408.            }
  409. }
  410. void WriteSet1302(uchar Cmd,uchar dat)
  411. {
  412.            RST1302=0;           //禁止數據傳遞
  413.            SCLK1302=0;          //確保寫數居前SCLK被拉低
  414.            RST1302=1;           //啟動數據傳輸
  415.            delay1(2);     //稍微等待,使硬件做好準備
  416.            Write1302(Cmd);  //寫入命令字
  417.            Write1302(dat);  //寫數據
  418.            SCLK1302=1;          //將時鐘電平置于已知狀態
  419.            RST1302=0;           //禁止數據傳遞
  420. }
  421. uchar Read1302(void)
  422. {
  423.            uchar i,dat;
  424.            delay(2);       //稍微等待,使硬件做好準備
  425.            for(i=0;i<8;i++)   //連續讀8個二進制位數據
  426.            {
  427.                     dat>>=1;       //將dat的各數據位右移1位,因為先讀出的是字節的最低位
  428.                     if(DATA1302==1)    //如果讀出的數據是1
  429.                     dat|=0x80;    //將1取出,寫在dat的最高位  
  430.                     SCLK1302=1;       //將SCLK置于高電平,為下降沿讀出
  431.                     delay1(2);  //稍微等待
  432.                     SCLK1302=0;       //拉低SCLK,形成脈沖下降沿
  433.                     delay1(2);  //稍微等待
  434.             }   
  435.           return dat;        //將讀出的數據返回
  436. }
  437. uchar  ReadSet1302(uchar Cmd)
  438. {
  439.           uchar dat;
  440.           RST1302=0;                 //拉低RST
  441.           SCLK1302=0;                //確保寫數居前SCLK被拉低
  442.           RST1302=1;                 //啟動數據傳輸
  443.           Write1302(Cmd);       //寫入命令字
  444.           dat=Read1302();       //讀出數據
  445.           SCLK1302=1;              //將時鐘電平置于已知狀態
  446.           RST1302=0;               //禁止數據傳遞
  447.           return dat;          //將讀出的數據返回
  448. }
  449. void Init_DS1302(void)
  450. {  
  451.          WriteSet1302(0x8E,0x00);//根據寫狀態寄存器命令字,寫入不保護指令
  452.          WriteSet1302(0x80,0x00);//根據寫秒寄存器命令字,寫入秒的初始值
  453.          WriteSet1302(0x82,0x20);//根據寫分寄存器命令字,寫入分的初始值
  454.          WriteSet1302(0x84,0x12);//根據寫小時寄存器命令字,寫入小時的初始值
  455.          WriteSet1302(0x86,0x01);//根據寫日寄存器命令字,寫入日的初始值
  456.          WriteSet1302(0x88,0x01);//根據寫月寄存器命令字,寫入月的初始值
  457.          WriteSet1302(0x8c,0x16);//根據寫年寄存器命令字,寫入年的初始值
  458.          WriteSet1302(0x8a,0x05);//根據寫星期寄存器命令字,寫入星期的初始值
  459. }
  460. void DisplaySecond(uchar x)
  461. {
  462.          uchar i,j;     
  463.          i=x/10;
  464.          j=x%10;
  465.          lcd_defcharacter24x48(14,16,1,i,tab3);//顯示秒的十位
  466.          lcd_defcharacter24x48(17,16,1,j,tab3);//顯示秒的個位   
  467. }
  468. void DisplayMinute(uchar x)
  469. {
  470.          uchar i,j;     
  471.          i=x/10;
  472.          j=x%10;  
  473.          lcd_defcharacter24x48(7,16,1,i,tab3);//顯示分鐘的十位
  474.          lcd_defcharacter24x48(10,16,1,j,tab3);//顯示分鐘的個位        
  475. }
  476. void DisplayHour(uchar x)
  477. {
  478.          uchar i,j;   
  479.          i=x/10;
  480.          j=x%10;  
  481.          lcd_defcharacter24x48(0,16,1,i,tab3);//顯示小時的十位
  482.          lcd_defcharacter24x48(3,16,1,j,tab3);//顯示小時的個位      
  483. }
  484. void DisplayDay(uchar x)
  485. {
  486.          uchar i,j;   
  487.          i=x/10;
  488.          j=x%10;     
  489.         lcd_defcharacter8x16(10,0,1,i,tab2);//顯示  日的十位
  490.         lcd_defcharacter8x16(11,0,1,j,tab2);//顯示   日的個位      
  491. }
  492. void DisplayMonth(uchar x)
  493. {  
  494.          uchar i,j;      
  495.          i=x/10;
  496.          j=x%10;   
  497.         lcd_defcharacter8x16(6,0,1,i,tab2);//顯示  月的十位  
  498.         lcd_defcharacter8x16(7,0,1,j,tab2);//顯示   月的個位  
  499. }
  500. void DisplayYear(uchar x)
  501. {
  502.          uchar i,j;   
  503.          i=x/10;
  504.          j=x%10;  
  505.         lcd_defcharacter8x16(2,0,1,i,tab2);//顯示 年的十位
  506.         lcd_defcharacter8x16(3,0,1,j,tab2);//顯示 年的個位
  507. }   
  508. void DisplayWeek(uchar x)
  509. {  
  510.         lcd_defcharacter16x16(19,0,1,x-1,tab5);//顯示
  511. }   
  512. void  read_date(void)
  513. {
  514.      ReadValue = ReadSet1302(0x81);   
  515.      second=((ReadValue&0x70)>>4)*10 + (ReadValue&0x0F);
  516.      ReadValue = ReadSet1302(0x83);   
  517.      minute=((ReadValue&0x70)>>4)*10 + (ReadValue&0x0F);  
  518.      ReadValue = ReadSet1302(0x85);   
  519.      hour=((ReadValue&0x70)>>4)*10 + (ReadValue&0x0F);  
  520.      ReadValue = ReadSet1302(0x87);   
  521.      day=((ReadValue&0x70)>>4)*10 + (ReadValue&0x0F);  
  522.      ReadValue = ReadSet1302(0x89);   
  523.      month=((ReadValue&0x70)>>4)*10 + (ReadValue&0x0F);  
  524.      ReadValue = ReadSet1302(0x8d);   
  525.      year=((ReadValue&0x70)>>4)*10 + (ReadValue&0x0F);  
  526.            ReadValue=ReadSet1302(0x8b);                     //讀星期
  527.      week=ReadValue&0x07;
  528.      DisplaySecond(second);            
  529.      DisplayMinute(minute);         
  530.      DisplayHour(hour);              
  531.      DisplayDay(day);                 
  532.      DisplayMonth(month);            
  533.      DisplayYear(year);            
  534.      DisplayWeek(week);   
  535. }
  536. void turn_val(char newval,uchar flag,uchar  newaddr,uchar s1num)
  537. {
  538.         newval=ReadSet1302(newaddr);                     //讀取當前時間
  539.     newval=((newval&0x70)>>4)*10+(newval&0x0f);    //將bcd碼轉換成十進制
  540.     if(flag)                  //判斷是加一還是減一
  541.     {  
  542.          newval++;
  543.          switch(s1num)
  544.           {
  545.                           case 1: if(newval>99) newval=0;
  546.                            DisplayYear(newval);      
  547.                                           break;
  548.                   case 2: if(newval>12) newval=1;
  549.                                            DisplayMonth(newval);  
  550.                                           break;
  551.                   case 3: if(newval>31) newval=1;
  552.                                 DisplayDay(newval);   
  553.                                           break;
  554.                   case 4: if(newval>6) newval=0;
  555.                                 DisplayWeek(newval);  
  556.                                           break;  
  557.                   case 5: if(newval>23) newval=0;
  558.                                 DisplayHour(newval);  
  559.                                           break;
  560.                   case 6: if(newval>59) newval=0;
  561.                                 DisplayMinute(newval);  
  562.                                           break;
  563.                   case 7: if(newval>59) newval=0;
  564.                                 DisplaySecond(newval);  
  565.                                           break;
  566.                   default:break;
  567.          }  
  568.       }   
  569.     else
  570.     {
  571.         newval--;
  572.              switch(s1num)
  573.         {
  574.                         case 1: if(newval==0) newval=99;
  575.                    DisplayYear(newval);  
  576.                                   break;
  577.                   case 2: if(newval==0) newval=12;
  578.                                    DisplayMonth(newval);  
  579.                         break;
  580.                   case 3: if(newval==0) newval=31;
  581.                                    DisplayDay(newval);  
  582.                         break;  
  583.                   case 4: if(newval<0) newval=6;
  584.                         DisplayWeek(newval);  
  585.                                   break;
  586.             case 5: if(newval<0) newval=23;
  587.                         DisplayHour(newval);  
  588.                                   break;
  589.             case 6: if(newval<0) newval=59;
  590.                         DisplayMinute(newval);  
  591.                                   break;
  592.             case 7: if(newval<0) newval=59;
  593.                         DisplaySecond(newval);
  594.                                   break;
  595.                        default:break;
  596.          }
  597.         }
  598.         WriteSet1302((newaddr-1),((newval/10)<<4)|(newval%10));  //將新數據寫入寄存器            
  599. }
  600. void delay_18B20(unsigned int i)//延時1微秒
  601. {
  602.         while(i--);
  603. }
  604. void ds1820rst()/*ds1820復位*/
  605. {  
  606.           unsigned char x=0;
  607.           DQ18B20 = 1;          //DQ復位
  608.           delay_18B20(4);  //延時
  609.           DQ18B20 = 0;          //DQ拉低
  610.           delay_18B20(100); //精確延時大于480us
  611.           DQ18B20 = 1;          //拉高
  612.           delay_18B20(40);   
  613. }
  614. uchar ds1820rd()/*讀數據*/  
  615. {
  616.   unsigned char i=0;
  617.   unsigned char dat = 0;
  618.   for (i=8;i>0;i--)
  619.   {   
  620.           DQ18B20 = 0; //給脈沖信號
  621.     dat>>=1;
  622.     DQ18B20 = 1; //給脈沖信號
  623.     if(DQ18B20)
  624.     dat|=0x80;
  625.     delay_18B20(10);
  626.   }
  627.   return(dat);
  628. }
  629. void ds1820wr(uchar wdata)/*寫數據*/
  630. {
  631.         unsigned char i=0;
  632.     for (i=8; i>0; i--)
  633.    {
  634.             DQ18B20 = 0;
  635.      DQ18B20 = wdata&0x01;
  636.      delay_18B20(10);
  637.      DQ18B20 = 1;
  638.      wdata>>=1;
  639.    }
  640. }
  641. read_temp()/*讀取溫度值并轉換*/
  642. {
  643.   uchar a,b;  
  644.   ds1820rst();     
  645.   ds1820wr(0xcc);//*跳過讀序列號*/
  646.   ds1820wr(0x44);//*啟動溫度轉換*/
  647.   ds1820rst();     
  648.   ds1820wr(0xcc);//*跳過讀序列號*/  
  649.   ds1820wr(0xbe);//*讀取溫度*/  
  650.   a=ds1820rd();
  651.   b=ds1820rd();
  652.   tvalue=b;
  653.   tvalue<<=8;
  654.   tvalue=tvalue|a;
  655.   if(tvalue<0x0fff)
  656.      tflag=0;
  657.   else
  658.    {
  659.                    tvalue=~tvalue+1;
  660.                   tflag=1;
  661.    }
  662.   tvalue=tvalue*(0.625);//溫度值擴大10倍,精確到1位小數
  663. return(tvalue);
  664. }
  665. void ds1820disp()//溫度值顯示
  666. {
  667.          lcd_defcharacter8x16(24,0,1,(tvalue%1000/100),tab2);//顯示 溫度的十位
  668.          lcd_defcharacter8x16(25,0,1,(tvalue%1000%100/10),tab2);//顯示 溫度的個位  
  669.          lcd_defcharacter8x16(27,0,1,(tvalue%1000%100%10),tab2);//顯示 溫度的小數     
  670.          if(tflag==0)
  671.                  lcd_defcharacter8x16(23,0,1,12,tab2);//顯示溫度的+號
  672.      else
  673.                 lcd_defcharacter8x16(23,0,1,11,tab2);//顯示溫度顯-號
  674. }         
  675. main()
  676. {
  677.         lcd_showfull(0);                                           //清屏
  678.         init6963(); //初始化
  679.         Init_DS1302();       //初始化1302
  680.         lcd_defcharacter8x16(0,0,1,2,tab2);//顯示    2-固定顯示
  681.         lcd_defcharacter8x16(1,0,1,0,tab2);//顯示    0-固定顯示  
  682.         lcd_defcharacter16x16(4,0,1,0,tab1);//顯示   年-固定顯示
  683.         lcd_defcharacter16x16(8,0,1,1,tab1);//顯示   月-固定顯示
  684.         lcd_defcharacter16x16(12,0,1,2,tab1);//顯示 日-固定顯示
  685.         lcd_defcharacter16x16(15,0,1,3,tab1);//顯示 星-固定顯示
  686.         lcd_defcharacter16x16(17,0,1,4,tab1);//顯示 期-固定顯示
  687.         lcd_defcharacter16x16(21,0,1,21,tab1);//顯示 -固定顯示溫度計圖片
  688.         lcd_defcharacter8x16(26,0,1,10,tab2);//顯示        -固定顯示小數點.
  689.         lcd_defcharacter16x16(28,0,1,22,tab1);//顯示 -固定顯示攝氏度圖片         
  690.         lcd_defcharacter8x48(6,16,1,0,tab4);//顯示-固定顯示:(前兩點)
  691.         lcd_defcharacter8x48(13,16,1,0,tab4);//顯示-固定顯示:(后兩點)

  692.         lcd_defcharacter16x16(21,16,2,17,tab1);//顯示農歷兩個字
  693.         lcd_defcharacter16x16(25,16,1,19,tab1);//顯示羊字
  694.         lcd_defcharacter16x16(27,16,1,20,tab1);//顯示年字
  695.                                            
  696.    while(1)
  697.      {                                                                             
  698.            read_date();
  699.            read_temp();//讀取溫度
  700.            ds1820disp();//顯示                  
  701.          }
  702. }




復制代碼


回復

使用道具 舉報

6#
ID:104599 發表于 2016-2-14 15:16 | 只看該作者
學習了,謝謝分享
回復

使用道具 舉報

7#
ID:104599 發表于 2016-2-23 14:51 | 只看該作者
按鍵處理部分,不會做啊,源代碼中如何調整日期和時間?小弟新學,想學習一下
回復

使用道具 舉報

8#
ID:111852 發表于 2016-4-1 21:52 | 只看該作者
這個論壇太好了,什么都有
回復

使用道具 舉報

9#
ID:137877 發表于 2016-8-29 23:15 | 只看該作者
華仔 發表于 2016-1-7 11:47
最近得到一個以T6963位控制器的24064液晶屏,看著挺好,就折騰了一段時間,也參考了一些別人的程序,感覺挺 ...

好東西,謝謝!
回復

使用道具 舉報

10#
ID:134810 發表于 2016-9-25 13:43 來自手機 | 只看該作者
admin 發表于 2016-1-11 04:23
資料已經很全了,仿真,電路圖,程序都有,可以直接制作了,你還缺什么?

下面是樓主的程序:

admin大大,哪兒都有你的身影
回復

使用道具 舉報

11#
ID:118448 發表于 2016-9-26 17:59 | 只看該作者
效果不錯,學習了,感謝!!!
回復

使用道具 舉報

12#
ID:140567 發表于 2016-9-26 22:02 | 只看該作者
樓主太強大了  
回復

使用道具 舉報

13#
ID:162691 發表于 2017-1-25 23:13 | 只看該作者
樓主威武。正在學習中
回復

使用道具 舉報

14#
ID:170689 發表于 2017-3-20 15:16 | 只看該作者
敢問樓主 能不能說說怎么調制  我做了一個一樣的  沒法設置時間呢
回復

使用道具 舉報

15#
ID:170689 發表于 2017-3-20 16:30 | 只看該作者
程序有誤  且 時間不對 還不能設置
回復

使用道具 舉報

16#
ID:184282 發表于 2017-4-14 19:49 | 只看該作者
好東西,樓主有T6963液晶驅動器的介紹資料么?或者是這個型號液晶的資料
回復

使用道具 舉報

17#
ID:85740 發表于 2017-7-27 21:16 | 只看該作者
admin 發表于 2016-1-11 04:23
資料已經很全了,仿真,電路圖,程序都有,可以直接制作了,你還缺什么?

下面是樓主的程序:

比如缺 取模方式?
回復

使用道具 舉報

18#
ID:242464 發表于 2018-2-17 17:52 | 只看該作者
按鍵處理部分的程序已經被處理掉,調整日期和時間的功能已經沒有了.
回復

使用道具 舉報

19#
ID:242464 發表于 2018-2-17 17:57 | 只看該作者
調整日期及時間的程序已經被處理掉了,只能自己開發
回復

使用道具 舉報

20#
ID:85934 發表于 2018-3-10 12:55 | 只看該作者
手里有個24064,自帶8個觸摸按鍵,一直驅動不了。這個如有農歷就完美了。
回復

使用道具 舉報

21#
ID:288930 發表于 2018-3-22 18:11 來自手機 | 只看該作者
程序怎么有警告?
回復

使用道具 舉報

22#
ID:288930 發表于 2018-3-22 18:12 來自手機 | 只看該作者
程序有警告?

IMG_20180322_163614.jpg (66.09 KB, 下載次數: 164)

IMG_20180322_163614.jpg
回復

使用道具 舉報

23#
ID:269511 發表于 2019-10-30 22:24 | 只看該作者
謝謝分享
回復

使用道具 舉報

24#
ID:164988 發表于 2019-10-31 17:02 | 只看該作者
我的屏是240128的,也是t6963控制器,不知怎么辦,
回復

使用道具 舉報

25#
ID:600695 發表于 2021-2-4 14:57 | 只看該作者
我下載程序編譯不成功,Build target 'Target 1'
assembling STARTUP.A51...
compiling 240wannianli .c...
linking...
BL51 BANKED LINKER/LOCATER V6.22 - SN: Eval Version
COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2009
"STARTUP.obj",
"240wannianli .obj"
TO "240萬年歷"
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
    SEGMENT: ?PR?_TURN_VAL?240WANNIANLI_
******************************************************************************
* RESTRICTED VERSION WITH 0800H BYTE CODE SIZE LIMIT; USED: 141AH BYTE (251%) *
******************************************************************************
Program Size: data=36.0 xdata=0 code=5861
LINK/LOCATE RUN COMPLETE.  1 WARNING(S),  0 ERROR(S)
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
    SEGMENT: ?PR?_TURN_VAL?240WANNIANLI_
*** FATAL ERROR L250: CODE SIZE LIMIT IN RESTRICTED VERSION EXCEEDED
    MODULE:  E:\KEIL\C51\LIB\C51S.LIB (-----)
    LIMIT:   0800H BYTES
Target not created
回復

使用道具 舉報

26#
ID:600695 發表于 2021-3-13 17:22 | 只看該作者
米花卷 發表于 2021-2-4 14:57
我下載程序編譯不成功,Build target 'Target 1'
assembling STARTUP.A51...
compiling 240wannianli .c. ...

應該是你的keil沒有破解,只能生成2k的hex,所以超了我前面也碰到過,總體來說這個程序不錯,仿真正常
回復

使用道具 舉報

27#
ID:884564 發表于 2021-4-28 15:04 | 只看該作者
哎,看到別人能成功,我還得加油啊,240128設計繼續!!
回復

使用道具 舉報

28#
ID:92553 發表于 2022-1-3 20:16 來自手機 | 只看該作者
問下樓主這個萬年歷是多少年的,從那一年到那一年?
回復

使用道具 舉報

29#
ID:1085582 發表于 2023-6-23 15:32 | 只看該作者
牛人啊,只是問問如果此51芯片單片機換成dspic芯片改動大嗎?
回復

使用道具 舉報

30#
ID:313936 發表于 2023-6-25 08:22 | 只看該作者
admin 發表于 2016-1-11 04:23
資料已經很全了,仿真,電路圖,程序都有,可以直接制作了,你還缺什么?

下面是樓主的程序:

謝謝老師分享
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

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

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 日日碰碰 | 久久中文高清 | 一区二区三区四区日韩 | 精品亚洲一区二区三区 | 久久亚洲欧美日韩精品专区 | 国产9 9在线 | 中文 | 国产午夜精品久久 | 九九精品在线 | 欧美成视频 | 国产一级电影在线观看 | 国产一区二区三区四区三区四 | 麻豆91精品91久久久 | 精品久久久久久久久久久 | 2018天天干天天操 | 久久精品一区 | 中文字幕在线精品 | 亚洲精品电影网在线观看 | 日韩欧美中文字幕在线观看 | 成人免费大片黄在线播放 | a级片www| 亚洲毛片网站 | 在线视频一区二区三区 | 亚洲三级国产 | 免费a网 | 激情国产视频 | 一区二区三区中文字幕 | 精品久久影院 | 亚洲一区在线播放 | 欧美日韩a | 午夜影院在线免费观看视频 | 91av视频 | 国产欧美在线一区二区 | 97久久久久久 | 一级一级一级毛片 | 永久www成人看片 | 一级免费看 | 国产精品不卡一区 | 中文字幕av一区 | 亚洲精品综合 | 成人精品在线视频 | 欧美电影一区 |