




已閱讀5頁,還剩22頁未讀, 繼續(xù)免費閱讀
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領
文檔簡介
基于cpld的數(shù)字頻率計的設計 摘 要 頻率是電子技術(shù)中最基本的參數(shù)之一,與其他電參量的測量方案及結(jié)果關(guān)系非常密切。其中數(shù)字頻率計在各方面領域都有很廣泛的運用,隨著科技的發(fā)展與生活的提高,數(shù)字頻率計的需求也將大大提升。目前直接測頻方法有兩種:測頻法和測周期法。測頻法是在確定的時間tw內(nèi),記錄被測信號的變化周期數(shù)nx,則測得的頻率為:fx=nx/tw。測周期法需有標準信號頻率fs,在待測信號的一個周期tx內(nèi),記錄標準頻率的周期數(shù)。則測得的頻率為:fx=fs/ns 。本課題主要選擇以cpld為核心器件,vhdl為編程語言,采用測頻法設計一個簡單實用的數(shù)字頻率計,以計數(shù)器、譯碼器為核心,由內(nèi)部分頻輸入信號、信息鎖存、數(shù)字顯示等功能模塊組成,可以實現(xiàn)簡單的頻率測量。關(guān)鍵詞 cpld,頻率計,計數(shù),仿真波形abstractfrequency of electronic technology in one of the most basic parameters, and other electrical parameters and results of the measurement scheme very closely.in which all aspects of digital frequency meter in the field have a very widely used, with the development of technology and life improved, the demand for digital frequency meter will also be greatly enhanced.direct measurement of the current frequency in two ways: frequency measurement method and test cycle method. frequency measurement method is in determining the time tw, the record number of cycles the signal changes in nx, then the measured frequency is: fx = nx / tw. the need for standard test cycle approach signal frequency fs, a cycle in the tx signal under test, the recorded number of cycles the standard frequency. the measured frequency is: fx = fs / ns. the main subject chosen as the core device cpld, vhdl as a programming language, frequency measurement method using a simple and practical design of digital frequency meter to counter, decoder core, from the inner part of the frequency of the input signal, the information is latched, figures show other functional modules, a simple frequency measurement can be achieved.key words:cpld frequency counter count simulation waveform目 錄一、 緒 論11.1 課題背景及其意義11.1.1 設計背景11.1.2 設計目標11.1.3 設計意義11.2 設計思路21.2.1 軟件方面21.2.2 硬件方面21.3 數(shù)字頻率計的發(fā)展21.3.1 數(shù)字頻率計的分類31.4 數(shù)字頻率計的相關(guān)概念41.5 數(shù)字頻率計實現(xiàn)的主要方法5二、 設計內(nèi)容7三、 設計方案步驟83.1 信號輸入83.2 時基控制模塊83.3 分頻器模塊93.4 計數(shù)器模塊93.5 鎖存器模塊103.6 譯碼器模塊113.7 調(diào)試113.7.1 軟件調(diào)試113.7.2 硬件調(diào)試11四、 設計總結(jié)13五、 參考文獻14六、 附 錄156.1 附錄1 總電路圖156.2 附錄2 程序代碼156.2.1 時基控制模塊程序代碼156.2.2 分頻器模塊程序代碼166.2.3 計數(shù)器模塊程序代碼186.2.4 鎖存器模塊程序代碼196.2.5 譯碼器模塊程序代碼206.2.6 頂層文件程序代碼216.3 附錄3 實物圖22七、 答 謝23一、 緒 論1.1 課題背景及其意義1.1.1 設計背景轉(zhuǎn)眼間大學的學習生涯即將結(jié)束,為了檢驗對這四年所學知識掌握運用的程度,針對電子信息專業(yè)課程的要求,培養(yǎng)出能利用所學理論知識與實踐相結(jié)合,能獨立思考,鍛煉動手等方面的能力,基于個人愛好及所掌握的知識,本設計選擇基于cpld的數(shù)字頻率計的設計。1.1.2 設計目標(1)頻率測量范圍:19999hz。(2)輸入被測信號幅度vi100mv。(3)測量1s時間內(nèi)的脈沖數(shù)。(4)測量誤差編譯,提示沒有錯誤后便可以仿真了。 2.新建波形文件,進入操作界面,先點擊edict菜單,設置 end time ,一般情況大概設為10us,由于軟件本身的緣故,end time值不應該設的太小,否則延時會很大,影響效果。3.7.2 硬件調(diào)試 軟件仿真無誤后,就可以與硬件相連。在這之前的先設置好管腳。點擊“assingmengt”菜單的“pin planner”把管腳設置好,確定無誤后編譯。關(guān)閉puartus軟件,將頻率計接入電腦,按提示安裝。重新打開軟件,點擊菜單“tools”中的”granmmer”確定接好usb接口。調(diào)試結(jié)果如圖3-9,圖3-10和圖3-11所示,分別表示測得的頻率為128hz、512hz和1024hz:圖3-9圖3-10圖3-11四、 設計總結(jié)此次選擇基于cpld的數(shù)字頻率計畢業(yè)設計的初衷是:之前也學習接觸了與cpld相關(guān)的基礎知識,但是自己設計實際動手起來的條件是沒有的,本人也對cpld方面的設計比較感興趣,所以想通過此次畢業(yè)設計鍛煉自己的動手能力,更好的把理論知識與實踐聯(lián)系起來,鞏固、加深個人對電子設計方面的興趣。設計過程中使用了 quartus ii軟件。這個軟件前幾年已經(jīng)學習使用過但還不是很熟練,通過老師與同學多次指導,經(jīng)過多次反復操作最終基本掌握了它的使用方法。使我更加熟練掌握了編輯輸入圖形設計文件、編譯設計文件、仿真設計文件及編程下載設計文件等各種不同的文件設計。因為各種原因,我們設計之前準備確實不是很充足,包括心理上還有自身能力上,所以自然的就造成了把時間花費在許多不必要的事情上,我建議以后學校能夠在課堂外利用更多時間培訓同學們相關(guān)的實踐動手能力,讓同學們提前有所準備,更加透徹學習與了解專業(yè)相關(guān)的知識與技能,相信同學們再次接觸到設計之類時就不會忙手忙腳的了??偟膩碚f通過這次畢業(yè)設計讓我更加深刻的明白,理論上的知識與實際情況總是相差比較大的,做任何事情都不能想這是理所當然的,要通過自己親身體會才能明白其中的奧秘。五、 參考文獻1. 閻石主編,數(shù)字電子技術(shù)基礎(第五版),高等教育出版社。3. 曹昕燕,周鳳臣,聶春燕編著,eda技術(shù)實驗與課程設計,清華大學出版社。4. 彭介華主編,電子技術(shù)課程設計指導,高等教育出版社。5. 張 原編著,可編程邏輯器件設計及應用,機械工業(yè)出版社。6. 荀殿棟,徐志軍編著,數(shù)字電路設計實用手冊,電子工業(yè)出版社。7. 潘松、黃繼業(yè)編著,eda技術(shù)實用教程(第三版),科學出版社。8. 劉洪喜,陸穎編著,vhdl電路設計實用教程,清華大學出版社。9. 付家才主編,eda工程實踐技術(shù),化學工業(yè)出版社。六、 附 錄6.1 附錄1 總電路圖總體電路如圖6-1所示:圖6-1 總體電路圖6.2 附錄2 程序代碼6.2.1 時基控制模塊程序代碼library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity ctrl isport(clk:in std_logic;lock:out std_logic;en: out std_logic;clr: out std_logic);end;architecture art of ctrl issignal q :std_logic_vector(3 downto 0);beginprocess(clk)beginif clkevent and clk=1 thenif q=1111 then q=0000; else q=q+1;end if;end if;en=not q(3);lock=q(3) and not(q(2) and q(1);clr=q(3) and q(2) and not(q(1);end process;end art;6.2.2 分頻器模塊程序代碼(fpq部分):library ieee;use ieee:std_logic_1164.all;use ieee.std_logic_unsigned.all;entity fpq isport(clk_32mhz:in std_logic;clk_1hz:out_std_logic);end;architecture one of fpq isbeginprocess(clk_32mhz)variable r:std_logic :=0;variable q: ubteger :=0;beginif clk_32mhzevent and clk_32mhz=1 thenif q=2097151 then r:=not r;q:=0;else q:=q+1;end if;clk_1hz=r;end if;end process;end one;(fpq128部分):library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity fpq_128 isport(clk_32mhz:in std_logic;cld_128hz:out std_logic);end;architecture one of fpq_128 isbeginprocess(clk_32mhz)variable r: std_logic :=0;variable q: integer :=0;beginif clk_32mhzevent and clk_32mhz=1 thenif q=131071 then r:=not r;q:=0;else q:=q+1;end if;clk_128hz=r;end if;end process;end one;(fpq512部分):librara ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity fpq_512 isport(clk_32mhz:in std_logic;clk_512hz:out std_logic);end;architecture one of fpq_512 isbeginprocess(clk_32mhz)variable r: std_logic :=0;variable q: integer :=0;beginif clk_32mhzevent and clk_32mhz=1 thenif q=32767 then r:=not r;q:=0;else q:=q+1;end if;clk_512hz=r;end if;end process;end one;(fpq1024部分):library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity fpq_1024 isport(clk_32mhz:in std_logic;clk_1024hz:out std_logic);end;architecture one of fpq_1024 isbeginprocess(clk_32mhz)variable r: std_logic :=0;variable q: integer :=0;beginif clk_32mhzevent and clk_32mhz=1 thenif q=16383 then r:=not r;q:=0;else q:=q+1;end if;clk_1024hz=r;end if;end process;end one;6.2.3 計數(shù)器模塊程序代碼(1)library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity count isport(clk:in std_logic;en:in std_logic;clr:in std_logic;qa,qb,qc,qd:buffer std_logic_vector(3 downto 0);end;architecture art of count iscomponent cb10port(clk,en,clr:in std_logic; count10:buffer std_logic_vector(3 downto 0);end component;signal clk2:std_logic;signal clk3:std_logic;signal clk4:std_logic;beginclk2=not qa(3);clk3=not qb(3);clk4=not qc(3);u1:cb10 port map(clk,en,clr,qa);u2:cb10 port map(clk2,en,clr,qb);u3:cb10 port map(clk3,en,clr,qc);u4:cb10 port map(clk4,en,clr,qd);end art;(2)library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cb10 isport(clk,en,clr:in std_logic; count10:buffer std_logic_vector(3 downto 0);end cb10;architecture art of cb10 isbeginprocess(clk,clr,en)begin if clr=1 thencount10=0000;elsif rising_edge(clk) thenif (en=1)thenif count10=1001 thencount10=0000;elsecount10=count10+1;end if;end if; end if;end process;end art;6.2.4 鎖存器模塊程序代碼library ieee;use ieee.std_logic_1164.all;entity lock isport(lock:in std_logic; qa,qb,qc,qd:in std_logic_vector(3 downto 0); leda,ledb,ledc,ledd:out std_logic_vector(7 downto 0);end;architecture art of lock issignal qal,qbl,qcl,qdl:std_logic_vector(3 downto 0);component bcd7port(bcd:in std_logic_vector(3 downto 0); led:out std_logic_vector(7 downto 0);end component;beginprocess(lock)beginif(lockevent and lock=1)thenqal=qa;qbl=qb;qcl=qc;qdl=qd;end if;end process;u0:bcd7 port map(qal,leda);u1:bcd7 port map(qbl,ledb);u2:bcd7 port map(qcl,ledc);u3:bcd7 port map(qdl,ledd);end art;6.2.5 譯碼器模塊程序代碼library ieee;use ieee.std_logic_1164.all;entity bcd7 isport(bcd:in std_logic_vector(3 downto 0); led:out std_logic_vector(7 downto 0);end;architecture art of bcd7 isbeginled=00111111 when bcd=0000 else00000110 when bcd=0001 else01011011 when bcd=0010 else01001111 when bcd=0011 else01100110 when bcd=0100 else01101101 when bcd=0101 else01111101 when bcd=0110 else00000111 when bcd=0111 else01111111 when bcd=1000 else01101111 when bcd=1001 else00000000;end art;6.2.6 頂層文件程序代碼library ieee;use ieee.std_logic_1164.all;entity pinlvji isport(clk:in std_logic; f_in:in std_logic; f_128,f_512,f_1024:out std_logic; ent,lockt,clrt:buffer std_logic; z1,z2,z3,z4:out std_logic_vector(7 downto 0);end pinlvji;architecture art of pinlvji issignal ens,locks,clrs,clk_temp:std_logic;signal qas,qbs,qcs,qds:std_logic_vector(3 downto 0);component ctrlport(clk:in std_logic; en,lock,clr:out std_logic);end component;component fpqport(clk_32mhz:in std_logic;clk_1hz:out std_logic);end component;component fpq_128port(clk_32mhz:in std_logic;clk_128hz:out std_logic);end component;component fpq_512port(clk_32mhz:in std_logic;clk_512hz:o
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 產(chǎn)品開發(fā)進度跟蹤表-新產(chǎn)品開發(fā)流程
- 薪資詳情與獎金補助證明書(6篇)
- 移民招聘考試試題及答案
- 醫(yī)院中級考試試題及答案
- 六一創(chuàng)意集體活動方案
- 六一夾珠子活動方案
- 醫(yī)學考試試題及答案詳解
- 六一扶貧活動方案
- 六一校園集體活動方案
- 六一活動小食品活動方案
- 通信員工安全試題及答案
- 2025年洗紋身協(xié)議書
- 工會廠務公開課件
- 桃花源記的試題及答案
- 工廠計件獎罰管理制度
- GA/T 2014-2023道路交通信號配時運行管理規(guī)范
- 【9語二模】北京市東城區(qū)2025年6月份中考二模語文試卷
- 2025年湖南省普通高中學業(yè)水平合格性考試仿真(三)數(shù)學試卷(含答案)
- 2025黑龍江省交通投資集團限公司招聘348人易考易錯模擬試題(共500題)試卷后附參考答案
- 九師聯(lián)盟2025屆高三押題信息卷(四)歷史試卷(含答案)
- 江蘇省南京2022年中考歷史試卷(解析版)
評論
0/150
提交評論