|
放假啦,在家沒(méi)事做,就做啦個(gè)數(shù)碼管顯示的萬(wàn)年歷,用max7219做的數(shù)碼管驅(qū)動(dòng),ds18B20溫度采集,ds12c887時(shí)鐘芯片,造價(jià)也不貴,板子早就畫好啦,但沒(méi)有條件做,只有手工焊接啦,原理圖、PCB都在附件里頭,有興趣可以玩玩,也希望各位提下意見,呵呵。。
數(shù)字萬(wàn)年歷原理圖及pcb.zip
(294.91 KB, 下載次數(shù): 309)
2016-9-1 17:44 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
數(shù)字鐘源程序.zip
(91.9 KB, 下載次數(shù): 298)
2016-9-1 17:44 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
效果圖如下
ourdev_662159VD6UWM.jpg (108.66 KB, 下載次數(shù): 168)
下載附件
2016-9-1 17:43 上傳
ourdev_662157Y7PIWD.jpg (245.66 KB, 下載次數(shù): 178)
下載附件
2016-9-1 17:43 上傳
(原文件名:max7219萬(wàn)年歷pcb.jpg)
ourdev_662158MFR35V.jpg (138.06 KB, 下載次數(shù): 174)
下載附件
2016-9-1 17:43 上傳
(原文件名:max7219萬(wàn)年歷原理圖.jpg)
下面是max7219的子程序
- #include "main.h"
- /*-------------------------------------------------
- 向MAX7219寫入字節(jié)(8位)
- --------------------------------------------------*/
- void SendChar (unsigned char ch)
- {
- unsigned char i,temp;
- _nop_();
- for (i=0;i<8;i++)
- {
- temp=ch&0x80;
- ch=ch<<1;
- if(temp)
- {
- dis_DIN=1;
- dis_CLK=0;
- dis_CLK=1;
- }
- else
- {
- dis_DIN=0;
- dis_CLK=0;
- dis_CLK=1;
- }
- }
- }
- /*-------------------------------------------------
- 向MAX7219寫入字(16位)
- -------------------------------------------------*/
- void WriteWord_3 (unsigned char addr,unsigned char num)
- {
- dis_LOAD=0;
- _nop_();
- SendChar (addr);
- _nop_();
- SendChar (num);
- _nop_();
- SendChar (NoOp);
- _nop_();
- SendChar (0);
- _nop_();
- SendChar (NoOp);
- _nop_();
- SendChar (0);
- _nop_();
- dis_LOAD=1;
- }
- /*-------------------------------------------------
- 向MAX7219寫入字(16位)
- -------------------------------------------------*/
- void WriteWord_2 (unsigned char addr,unsigned char num)//發(fā)現(xiàn)與第二及第三塊相連的數(shù)碼管閃爍,與test9相比增加了空操作后就不閃爍了!!
- {
- dis_LOAD=0;
- _nop_();
- SendChar (NoOp);
- _nop_();
- SendChar (0);
-
- _nop_();
- SendChar (addr);
- _nop_();
- SendChar (num);
- _nop_();
- SendChar (NoOp);
- _nop_();
- SendChar (0);
- _nop_();
-
- dis_LOAD=1;
- }
- /*-------------------------------------------------
- 向MAX7219寫入字(16位)
- -------------------------------------------------*/
- void WriteWord_1 (unsigned char addr,unsigned char num)//發(fā)現(xiàn)與第二及第三塊相連的數(shù)碼管閃爍,與test9相比增加了空操作后就不閃爍了!!
- {
- dis_LOAD=0;
- _nop_();
- SendChar (NoOp);
- _nop_();
- SendChar (0);
- _nop_();
- SendChar (NoOp);
- _nop_();
- SendChar (0);
- _nop_();
- SendChar (addr);
- _nop_();
- SendChar (num);
- _nop_();
-
- dis_LOAD=1;
- }
- /*-------------------------------------------------
- MAX7219初始化
- -------------------------------------------------*/
- void InitDis (void)
- {
- WriteWord_1 (ScanLimit,ScanDigit); /*設(shè)置掃描界限*/
- WriteWord_1 (DecodeMode,DecodeDigit); /*設(shè)置譯碼模式*/
- WriteWord_1 (Intensity,IntensityGrade); /*設(shè)置亮度*/
- WriteWord_1 (ShutDown,NormalOperation); /*設(shè)置電源工作模式*/
-
- WriteWord_2 (ScanLimit,ScanDigit); /*設(shè)置掃描界限*/
- WriteWord_2 (DecodeMode,DecodeDigit); /*設(shè)置譯碼模式*/
- WriteWord_2 (Intensity,IntensityGrade); /*設(shè)置亮度*/
- WriteWord_2 (ShutDown,NormalOperation); /*設(shè)置電源工作模式*/
- WriteWord_3 (ScanLimit,ScanDigit); /*設(shè)置掃描界限*/
- WriteWord_3 (DecodeMode,DecodeDigit); /*設(shè)置譯碼模式*/
- WriteWord_3 (Intensity,IntensityGrade); /*設(shè)置亮度*/
- WriteWord_3 (ShutDown,NormalOperation); /*設(shè)置電源工作模式*/
- }
復(fù)制代碼
|
|