







摘" 要:本設計利用FPGA控制DS1302時鐘芯片實現數字時鐘。FPGA芯片是系統的控制核心,按鍵通過FPGA的I/O口執行相應的操作,即對DS1302時鐘芯片的數據進行配置,然后FPGA定時讀取DS1302時鐘芯片的數據,傳到數碼管中譯碼顯示。在FPGA讀取數據的過程中,整點時蜂鳴器會發出SOS的聲音和LED燈閃爍,并有LCD液晶上閃現皮卡丘圖像。
關鍵詞:FPGA;數字時鐘;硬件描述語言;DS1302
中圖分類號:TP301" " " " 文獻標志碼:A" " " " "文章編號:2095-2945(2021)13-0080-03
Abstract: The design is to use DS1302 clock chip to realize digital clock on FPGA. The FPGA chip is the control core of the system. The keys are operated through the I/O port of the FPGA, that is, the data of the DS1302 clock chip is to be configured. Then the data of the DS1302 clock chip is read by the FPGA regularly and transmitted to the digital tube for decoding and displaying. In the process of reading data by FPGA, the buzzer will emit SOS sound and LED lamp flashing at the whole point, and Pikachu images will be flashed on LCD liquid crystal.
Keywords: FPGA; digital clock; hardware description language; DS1302
隨著數字化和信息化時代的到來,集成電路得到了很大的發展,數字時鐘應運而生并逐漸有取代鐘表的趨勢。數字時鐘相比于鐘表有走時精確、價格低廉、外觀多樣等獨到之處。
1 數字時鐘的總體結構
本系統設計方案:系統進行模塊化設計,包括時鐘模塊、按鍵控制模塊、數碼管譯碼顯示、蜂鳴器模塊和LCD液晶顯示模塊。采用FPGA作為系統的控制核心,按鍵通過FPGA的I/O口執行相應的操作,即對DS1302時鐘芯片的數據進行配置,然后FPGA定時讀取DS1302時鐘芯片的數據,傳到數碼管中譯碼顯示。DS1302時鐘芯片計時精度高可以保證時鐘的精準性,所以時鐘功能利用DS1302時鐘芯片實現。在工作時,5個按鍵有不同的功能,對數碼管顯示的數據進行相應的配置處理,保證可以顯示想要顯示的時間數據。另外,FPGA控制核心讀取時鐘芯片數據,在整點時蜂鳴器發出SOS響聲,LCD液晶閃現皮卡丘,實現整點報時功能。其系統整體框圖如圖1所示。
2 數字時鐘的工作原理
本設計采用的是DS1302時鐘芯片,利用FPGA對DS1302時鐘芯片進行操作,需要了解它的讀時序和寫時序及控制字節,DS1302時鐘芯片的控制字節如表1所示。……