




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、等級(jí):課 程 設(shè) 計(jì)課程名稱(chēng)嵌入式系統(tǒng)課程設(shè)計(jì)課題名稱(chēng)基于CPLD的簡(jiǎn)易數(shù)字頻率計(jì)專(zhuān) 業(yè)電子信息工程班 級(jí)電信1303學(xué) 號(hào) xxxxxxxxxxxxxxxxxxxx姓 名XX指導(dǎo)老師陳愛(ài)萍2016年12月20日目錄一總體設(shè)計(jì)21.設(shè)計(jì)總體思路22.基本原理23.總體框圖2二各個(gè)單元模塊設(shè)計(jì)31.分頻器模塊32.計(jì)數(shù)器模塊43.鎖存器模塊64.編碼器模塊85.片選模塊96.顯示模塊107.片選信號(hào)模塊11四.總體電路圖14五.設(shè)計(jì)調(diào)試141.軟件調(diào)試與硬件調(diào)試141.1軟件調(diào)試141.2硬件調(diào)試15六. 總結(jié)與體會(huì)16七.參考文獻(xiàn)16電氣信息學(xué)院課程設(shè)計(jì)任務(wù)書(shū)課題名稱(chēng)基于CPLD的簡(jiǎn)易數(shù)字頻率
2、計(jì)姓 名xx專(zhuān)業(yè)電子信息工程班級(jí)xxxx 學(xué)號(hào)xx 指導(dǎo)老師陳愛(ài)萍課程設(shè)計(jì)時(shí)間2016年12月18日-2016年12月30日(17、18周)教研室意見(jiàn)意見(jiàn):同意 審核人:劉望軍一、任務(wù)及要求CPLD為復(fù)雜可編程邏輯器件,通過(guò)EDA技術(shù)對(duì)其進(jìn)行編程,設(shè)計(jì)數(shù)字頻率計(jì),并最終完成電路的編程調(diào)試。具體要求如下:數(shù)字頻率計(jì)是一種用數(shù)字顯示的頻率測(cè)量?jī)x表,它不僅可以測(cè)量正弦信號(hào)、方波信號(hào)的頻率,還可以測(cè)量如機(jī)械振動(dòng)次數(shù)、物體轉(zhuǎn)動(dòng)次數(shù)、單位時(shí)間里經(jīng)過(guò)傳送帶的產(chǎn)品數(shù)量等多種物理量。技術(shù)指標(biāo):()、頻率測(cè)量范圍:1/109999Hz。()、輸入被測(cè)信號(hào)幅度Vi<100mV。()、測(cè)量1s和10s時(shí)間內(nèi)的脈
3、沖數(shù)。()、顯示時(shí)間分“手動(dòng)”和“自動(dòng)”兩檔。二、進(jìn)度安排第一周:周一:集中布置課程設(shè)計(jì)相關(guān)事宜。周二周三:子模塊程序設(shè)計(jì),頂層電路程序設(shè)計(jì)。周四周日:子模塊,頂層電路仿真。第二周:周一周三:編程下載,系統(tǒng)調(diào)試。周四周五:設(shè)計(jì)報(bào)告撰寫(xiě)。周五進(jìn)行答辯和設(shè)計(jì)結(jié)果檢查。一總體設(shè)計(jì)1.設(shè)計(jì)總體思路采用現(xiàn)場(chǎng)可編程門(mén)陣列(FPGA)為控制核心,利用VHDL語(yǔ)言編程,下載燒制實(shí)現(xiàn)。將所有器件集成在一塊芯片上,體積大大減小的同時(shí)還提高了穩(wěn)定性,可實(shí)現(xiàn)大規(guī)模和超大規(guī)模的集成電路,測(cè)頻測(cè)量精度高,測(cè)量頻率范圍大,而且編程靈活、調(diào)試方便.2.基本原理頻率計(jì)的基本原理是用高頻信號(hào)基準(zhǔn)時(shí)鐘,對(duì)比測(cè)量其他信號(hào)的頻率。通常
4、情況下計(jì)算每秒內(nèi)待測(cè)信號(hào)的脈沖個(gè)數(shù),即閘門(mén)時(shí)間為1 s。閘門(mén)時(shí)間可以根據(jù)需要取值,大于或小于1 s都可以。閘門(mén)時(shí)間越長(zhǎng),得到的頻率值就越準(zhǔn)確。閘門(mén)時(shí)間越短,測(cè)得的頻率值刷新就越快。一般取1 s作為閘門(mén)時(shí)間。數(shù)字頻率計(jì)的關(guān)鍵組成部分包括分頻器,計(jì)數(shù)器、鎖存器、片選電路,譯碼驅(qū)動(dòng)電路和顯示電路.3.總體框圖 圖1-3-1 數(shù)字頻率計(jì)總體框圖二各個(gè)單元模塊設(shè)計(jì)1.分頻器模塊本次實(shí)驗(yàn)主要采用的是計(jì)數(shù)器構(gòu)成分頻電路,對(duì)1KHz的時(shí)鐘脈沖進(jìn)行分頻。這里使用的是10分頻,一個(gè)輸出給計(jì)數(shù)器,一個(gè)給鎖存器。源程序:library ieee; use ieee.std_logic_1164.all; entity
5、 fen_ck22 is port(clk:in std_logic; q:out std_logic); end; architecture fen_arc of fen_ck22 is begin process(clk) variable cnt:integer range 0 to 9; variable x:std_logic; begin if clk'event and clk='1' then if cnt<9 then cnt:=cnt+1; else cnt:=0; x:=not x; end if; end if; q<=x; end
6、process; end fen_arc; 電路模塊如圖所示:圖2-1-1分頻模塊仿真波形如圖:圖2-1-2 分頻模塊仿真波形2.計(jì)數(shù)器模塊這個(gè)模塊主要是記錄待測(cè)信號(hào)經(jīng)過(guò)了多少的波峰,將其轉(zhuǎn)換成數(shù)量。然后給鎖存器鎖存。源程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all; entity count_ck22 isport(clr,sig,door:in std_logic; alm:out std_logic; q3,q2,q1,q0,dang:out std_logic_vector(3 do
7、wnto 0);end;architecture count22_arc of count_ck22 isbeginprocess(door,sig)variable c3,c2,c1,c0:std_logic_vector(3 downto 0);variable x:std_logic;begin if sig'event and sig='1' then if clr='0' then alm<='0' c3:="0000" c2:="0000" c1:="0000"
8、 c0:="0000" elsif door='0' then c3:="0000" c2:="0000" c1:="0000" c0:="0000" elsif door='1' then if c0<"1001" thenc0:=c0+1; else c0:="0000" if c1<"1001" then c1:=c1+1; else c1:="0000" if c2
9、<"1001" then c2:=c2+1; else c2:="0000" if c3<"1001" then c3:=c3+1; else c3:="0000" alm<='1' end if; end if; end if; end if; end if; if c3/="0000" then q3<=c3; q2<=c2; q1<=c1; q0<=c0; dang<="0100" elsif c2/=&q
10、uot;0000" then q3<="0000" q2<=c2; q1<=c1; q0<=c0; dang<="0011" elsif c1/="0000" then q3<="0000" q2<="0000" q1<=c1; q0<=c0; dang<="0010" else q3<="0000" q2<="0000" q1<="000
11、0" q0<=c0; dang<="0001"end if;end if;end process;end count22_arc;模塊如圖所示:圖2-2-1計(jì)數(shù)器模塊仿真波形如圖:圖2-1-2計(jì)數(shù)器模塊仿真波形3.鎖存器模塊此模塊主要是鎖存來(lái)自于計(jì)數(shù)器的數(shù)據(jù)然后傳送給編碼器。library ieee;use ieee.std_logic_1164.all;entity lock_ck22 isport(l:in std_logic; a4,a3,a2,a1,a0:in std_logic_vector(3 downto 0); q4,q3,q2,q1,
12、q0:out std_logic_vector(3 downto 0);end;architecture lock22_arc of lock_ck22 isbegin process(l) variable t4,t3,t2,t1,t0:std_logic_vector(3 downto 0);begin if l'event and l='0' then t4:=a4; t3:=a3; t2:=a2; t1:=a1; t0:=a0; end if; q4<=t4; q3<=t3; q2<=t2; q1<=t1; q0<=t0; end
13、process;end lock22_arc;模塊如圖所示:圖2-3-1鎖存器模塊仿真波形圖如下:圖2-3-2鎖存器模塊仿真波形4.編碼器模塊 從前面的鎖存器模塊接受由計(jì)數(shù)器記錄的數(shù)據(jù)并且編碼,并且接受片選模塊來(lái)的信號(hào),根據(jù)來(lái)自片選模塊的信號(hào)選擇鎖存器中的數(shù)據(jù)編碼,然后給后面的顯示譯碼器。library ieee;use ieee.std_logic_1164.all;entity bm_ck22 isport(sel:in std_logic_vector(2 downto 0);a3,a2,a1,a0,dang:in std_logic_vector(3 downto 0);q:out s
14、td_logic_vector(3 downto 0);end;architecture bm_ck22_arc of bm_ck22 isbeginprocess(sel)begincase sel iswhen "000"=>q<=a0;when "001"=>q<=a1;when "010"=>q<=a2;when "011"=>q<=a3;when "111"=>q<=dang;when others=>q<=&qu
15、ot;1111"end case;end process;end ;電路圖如圖所示:圖2-4-1編碼器模塊仿真波形圖如下:圖2-4-2編碼器模塊仿真波形5.片選模塊通過(guò)時(shí)鐘信號(hào)clk產(chǎn)生片選信號(hào),此信號(hào)主要是給后面的模塊選擇數(shù)碼管的位置,輸出顯示信號(hào)。源程序:library ieee; use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity ph_ck22 is port(clk:in std_logic; q:out std_logic_vector(2 downto 0);end;architectur
16、e ph_ck22_arc of ph_ck22 is begin process(clk) variable cnt:std_logic_vector(2 downto 0); begin if clk'event and clk='1' then cnt:=cnt+1; end if; q<=cnt;end process;end;電路圖如圖所示:圖2-5-1片選模塊仿真波形如圖:圖2-5-2片選模塊仿真波形6.顯示模塊此模塊主要是接受上個(gè)模塊的編碼信號(hào),然后通過(guò)顯示譯碼給數(shù)碼管。源程序:library ieee;use ieee.std_logic_1164
17、.all; entity display_ck22 isport(d:in std_logic_vector(3 downto 0);q:out std_logic_vector(6 downto 0);end;architecture display_ck22_arc of display_ck22 isbeginprocess(d)begincase d iswhen "0000"=>q<="0111111"when "0001"=>q<="0000110"when "0010
18、"=>q<="1011011"when "0011"=>q<="1001111"when "0100"=>q<="1100110"when "0101"=>q<="1101101"when "0110"=>q<="1111101"when "0111"=>q<="0100101"when &quo
19、t;1000"=>q<="1111111"when "1001"=>q<="1101111"when others=>q<="0000000"end case;end process;end;電路圖如圖所示:圖2-6-1顯示模塊仿真波形如圖:圖2-6-2顯示模塊仿真波形7.片選信號(hào)模塊片選信號(hào)模塊的作用就是接受片選模塊信號(hào),選擇數(shù)碼管。源程序:library ieee;use ieee.std_logic_1164.all;entity phs_ck22 isport(
20、d:in std_logic_vector(2 downto 0);q:out std_logic_vector(7 downto 0);end;architecture phs_ck22_arc of phs_ck22 isbeginprocess(d)begincase d iswhen "000"=>q<="00000001"when "001"=>q<="00000010"when "010"=>q<="00000100"when
21、"011"=>q<="00001000"when "100"=>q<="00010000"when "101"=>q<="00100000"when "110"=>q<="01000000"when "111"=>q<="10000000"when others=>q<="00000000"end case
22、;end process;end;電路圖如圖所示:圖2-7-1片選信號(hào)模塊仿真波形圖:圖2-7-2片選信號(hào)模塊仿真波形三、頂層文件設(shè)計(jì)用元件例化語(yǔ)句寫(xiě)一個(gè)頂層文件library ieee;use ieee.std_logic_1164.all;entity ck22 is port(sig,clr,clk,door:in std_logic; alm:out std_logic; q:out std_logic_vector(6 downto 0); se:out std_logic_vector(7 downto 0);end ck22;architecture art of ck22 is
23、component count_ck22 port(clr,sig,door:in std_logic; alm:out std_logic; q3,q2,q1,q0,dang:out std_logic_vector(3 downto 0);end component;component fen_ck22 port(clk:in std_logic; q:out std_logic);end component;component lock_ck22 port(l:in std_logic; a4,a3,a2,a1,a0:in std_logic_vector(3 downto 0); q4
24、,q3,q2,q1,q0:out std_logic_vector(3 downto 0);end component;component ph_ck22 port(clk:in std_logic; q:out std_logic_vector(2 downto 0);end component;component bm_ck22 port(sel:in std_logic_vector(2 downto 0);a3,a2,a1,a0,dang:in std_logic_vector(3 downto 0); q:out std_logic_vector(3 downto 0);end co
25、mponent;component display_ck22 port(d:in std_logic_vector(3 downto 0); q:out std_logic_vector(6 downto 0);end component;component phs_ck22 port(d:in std_logic_vector(2 downto 0); q:out std_logic_vector(7 downto 0);end component;signal t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t12:std_logic_vector(3 downto 0);s
26、ignal t11:std_logic;signal t20:std_logic_vector(2 downto 0);beginu1:count_ck22 port map (clr=>clr,sig=>sig,door=>door,alm=>alm,q3=>t1,q2=>t2,q1=>t3,q0=>t4,dang=>t5);u2: fen_ck22 port map (clk=>clk,q=>t11);u3:lock_ck22 port map (l=>t11,a4=>t1,a3=>t2,a2=>t3
27、,a1=>t4,a0=>t5,q4=>t6,q3=>t7,q2=>t8,q1=>t9,q0=>t10);u4: ph_ck22 port map (clk=>clk,q=>t20);u5: bm_ck22 port map (sel=>t20,a3=>t6,a2=>t7,a1=>t8,a0=>t9,dang=>t10,q=>t12);u6: display_ck22 port map (d=>t12,q=>q);u7: phs_ck22 port map (d=>t20,q=>se);end architecture art;通過(guò)元件例化語(yǔ)句生成的元件圖3-1總體仿真波形圖:圖3-2總體仿真波形圖四.總體電路圖圖4-1總體電路圖五.設(shè)計(jì)調(diào)試 1.軟件調(diào)試與硬件調(diào)試 1.1軟件調(diào)試 仿真時(shí),打開(kāi)軟件Quartus II,建立工程文件,然后新建7個(gè)VHDL文件。保存后,編譯,無(wú)誤后及可以仿真了。 仿真時(shí)最好每個(gè)模塊單獨(dú)分開(kāi)仿真,這樣不容易出錯(cuò)??梢杂媚J(rèn)的end time。對(duì)時(shí)鐘頻率clk不宜過(guò)小,最好不要小于1ns否則可能出錯(cuò),導(dǎo)致無(wú)仿真圖。 1.2硬件調(diào)試1、連接線路:選擇主菜單“Assignments”中的“
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 初中歷史明朝的統(tǒng)治教案-2024~2025學(xué)年統(tǒng)編版七年級(jí)歷史下冊(cè)
- 高功能抑郁癥的臨床護(hù)理
- 2025銷(xiāo)售人員勞動(dòng)合同范本 銷(xiāo)售勞動(dòng)合同樣本
- 外傷性低顱內(nèi)壓綜合征的臨床護(hù)理
- 煤礦井下超大斷面硐室施工技術(shù)規(guī)范
- 眼瞼松弛癥的臨床護(hù)理
- 浙江國(guó)企招聘2025上半年湖州市交通投資集團(tuán)有限公司招聘11人筆試參考題庫(kù)附帶答案詳解
- 射洪七小期末試卷及答案
- 2025年物資采購(gòu)合同模板
- 廈大美術(shù)高考試卷及答案
- 傷殘鑒定 委托書(shū)
- 班組長(zhǎng)、員工安全生產(chǎn)責(zé)任制考核記錄表
- 老年康體指導(dǎo)職業(yè)教育79課件
- 北京市建設(shè)工程施工現(xiàn)場(chǎng)安全生產(chǎn)標(biāo)準(zhǔn)化管理圖集(2019版)
- 2025年江蘇省江寧城建集團(tuán)招聘筆試參考題庫(kù)含答案解析
- 大學(xué)生就業(yè)與創(chuàng)業(yè)指導(dǎo)知到智慧樹(shù)章節(jié)測(cè)試課后答案2024年秋遼寧廣告職業(yè)學(xué)院
- 高鈦渣及其產(chǎn)品深加工項(xiàng)目的可行性研究報(bào)告
- 2024年中國(guó)黃油行業(yè)供需態(tài)勢(shì)及進(jìn)出口狀況分析
- 三下26《和拖延的壞朋友說(shuō)再見(jiàn)》心理健康教學(xué)設(shè)計(jì)
- 2025屆山東省濰坊市高考英語(yǔ)二模試卷含解析
- 2023無(wú)人機(jī)系統(tǒng)測(cè)評(píng)規(guī)范
評(píng)論
0/150
提交評(píng)論