




版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
1、一 實驗目的1熟悉Quarters-II軟件的使用方法;2.了解VHDL語言編程;3.了解基本的自頂向下模塊化設計思想;4.設計頻率計并在軟件上進行仿真;二設計的基本原理 2.1基本原理:數(shù)字頻率計是用數(shù)字顯示被測信號的頻率的儀器,被測信號可以是正弦波,方波或者其他周期性變化的信號,它的基本原理是時基信號發(fā)生器提供標準的時基脈沖信號,若其周期為1s則門控電路的輸出信號持續(xù)時間亦準確到1s。閘門電路有標準秒信號控制,當秒信號到來時閘門開通,信號通過閘門送到計數(shù)譯碼顯示電路,秒信號結束時閘門關閉,計數(shù)器停止計數(shù),由于計數(shù)器記得脈沖數(shù)N的是一秒內(nèi)的累積數(shù),所以被測頻率是NHZ。閘門時間可以取大于或者
2、小于1秒的值,測得的頻率時間間隔與閘門時間的取值成正比,在這里取的閘門時間為1s。數(shù)字頻率計由分頻器,片選電路,計數(shù)器,鎖存器,譯碼電路和顯示電路作為主要組成部分。三實驗內(nèi)容及步驟 在Quarters-II軟件中采用文本編輯的方式(VHDL),生成如下各個模塊的元器件。編譯完成后點擊file - creat/update - creat symbol files for current file .注意工程名與實體名要相同。3.1分頻電路模塊 分頻器在總電路中有兩個作用。由總圖框圖中分頻器有兩個輸出,一個給計數(shù)器,一個給鎖存器。時鐘信號經(jīng)過分頻電路形成了20分頻后的門信號。另一個給鎖存器作鎖存
3、信號,當信號為低電平時就鎖存計數(shù)器中的數(shù)。分頻模塊的程序:library ieee;use ieee.std_logic_1164.all;entity fen isport(clk:in std_logic; q:out std_logic);end fen;architecture fen_arc of fen isbeginprocess(clk)variable cnt:integer range 0 to 9;variable x:std_logic;beginif clk'event and clk='1' then if cnt<9 then cnt
4、:=cnt+1; else cnt:=0;x:=not x;end if; end if; q<=x;end process;end fen_arc;分頻電路圖如圖2.1 圖3.1 分頻電路圖3.2片選信號電路模塊 這個電路有兩個用途:一是為后面的片選電路產(chǎn)生片選信號,二是為譯碼模塊提供選擇脈沖信號。片選信號模塊的程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity sel isport(clk:in std_logic; q:out std_logic_vector(2 do
5、wnto 0);end sel;architecture sel_arc of sel isbeginprocess(clk)variable cnt:std_logic_vector(2 downto 0);beginif clk'event and clk='1' then cnt:=cnt+1;end if;q<=cnt;end process;end sel_arc;電路圖如圖2.2圖3.2 片選信號電路圖3.3計數(shù)器模塊 計數(shù)器模塊為該電路中的核心模塊,它的功能是:當門信號為上升沿時,電路開始計算半個周期內(nèi)被測信號通過的周期數(shù),到下升沿后結束。然后送給鎖
6、存器鎖存。計數(shù)器模塊的程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity corna isport(clr,sig,door:in std_logic; alm:out std_logic; q3,q2,q1,q0,dang:out std_logic_vector(3 downto 0);end corna;architecture corn_arc of corna isbeginprocess(door,sig)variable c3,c2,c1,c0:std_logic_v
7、ector(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"c0:="0000" elsif door='0' then c3:="0000"c2:="0000"c1:="0000"c
8、0:="0000" elsif door='1' then if c0<"1001" thenc0:=c0+1; elsec0:="0000"if c1<"1001" thenc1:=c1+1;else c1:="0000"if c2<"1001" thenc2:=c2+1;elsec2:="0000"if c3<"1001" thenc3:=c3+1;elsec3:="0000&quo
9、t;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/="0000" then q3<="0000"q2<=c2;q1<=c1;q0<=c0;dang<="0011" elsif c1/="0000" thenq3&
10、lt;="0000"q2<="0000"q1<=c1;q0<=c0;dang<="0010" else q3<="0000"q2<="0000"q1<="0000"q0<=c0;dang<="0001"end if; end if;end process; end corn_arc;計數(shù)器電路圖如圖2.3所示:圖3.3 計數(shù)器電路圖3.4鎖存器模塊 在分頻信號的下降沿到來時,鎖存器將計數(shù)器的信號鎖存,然
11、后送給編譯模塊中。鎖存器模塊的程序:library ieee;use ieee.std_logic_1164.all;entity lock isport(l:in std_logic; a4,a3,a2,a1,a0:in std_logic_vector(3 downto 0); q4,q3,q2,q1,q0:out std_logic_vector(3 downto 0);end lock;architecture lock_arc of lock isbegin process(l) variable t4,t3,t2,t1,t0:std_logic_vector(3 downto 0)
12、;beginif l'event and l='0' thent4:=a4;t3:=a3;t2:=a2;t1:=a1;t0:=a0;end if;q4<=t4;q3<=t3;q2<=t2;q1<=t1;q0<=t0;end process;end lock_arc;電路圖如圖2.4所示:圖 3.4 鎖存器電路圖3.5譯碼信號模塊 此模塊是對四個鎖存器進行選擇,按順序的將四個鎖存器中的數(shù)值送給譯碼模塊中譯碼。譯碼信號模塊的程序:library ieee;use ieee.std_logic_1164.all;entity ch isport(
13、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 ch;architecture ch_arc of ch isbeginprocess(sel)begincase sel iswhen "000"=>q<=a0;when "001"=>q<=a1;when "010"=>q<=a2;when &qu
14、ot;011"=>q<=a3;when "111"=>q<=dang;when others=>q<="1111"end case;end process;end ch_arc;電路圖如圖2.5圖3.5 譯碼信號電路圖3.6片選模塊 該模塊接收到片選信號后,輸出給顯示器,選擇顯示那個顯示管。片選模塊的程序:library ieee;use ieee.std_logic_1164.all;entity ym isport(d:in std_logic_vector(2 downto 0); q:out std_
15、logic_vector(7 downto 0);end ym;architecture ym_arc of ym isbeginprocess(d)begincase d iswhen "000"=>q<="00000001"when "001"=>q<="00000010"when "010"=>q<="00000100"when "011"=>q<="00001000"when &q
16、uot;100"=>q<="00010000"when "101"=>q<="00100000"when "110"=>q<="01000000"when "111"=>q<="10000000"when others=>q<="00000000"end case;end process;end ym_arc;電路圖如圖2.6所示:圖3.6 片選電路圖3.7譯碼模塊譯
17、碼模塊的作用就是將譯碼信號模塊中選擇出的信號進行譯碼,并將其送給顯示器。譯碼器模塊的程序:library ieee;use ieee.std_logic_1164.all;entity disp isport(d:in std_logic_vector(3 downto 0); q:out std_logic_vector(6 downto 0);end disp;architecture disp_arc of disp isbeginprocess(d)begincase d iswhen "0000"=>q<="0111111"when
18、 "0001"=>q<="0000110"when "0010"=>q<="1011011"when "0011"=>q<="1001111"when "0100"=>q<="1100110"when "0101"=>q<="1101101"when "0110"=>q<="1111101"when "0111"=>q<="0100101"when "1000"=>q<="1111111"when "1001"=>q<="1101111"when others=>q<="0000000"end case;end process;end disp_arc;路圖如圖2.7所示:圖3.7 譯碼電路圖3.8 各個模塊生成后,新建一個文件夾將每個模塊生成
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025店鋪轉(zhuǎn)讓合同協(xié)議書范本下載
- 上海中學高三數(shù)學試卷及答案大全
- 肇慶市實驗中學高中歷史二教案:第課改變世界的工業(yè)革命教案
- 2025科技咨詢合同示范文本
- 機械產(chǎn)品標準化與模塊化考核試卷
- 科技創(chuàng)新趨勢的智能家居和智能穿戴設備市場考核試卷
- 編織品在建筑工程中的加固應用考核試卷
- 無線數(shù)據(jù)傳輸考核試卷
- 煤炭轉(zhuǎn)化與化工產(chǎn)品高端化發(fā)展考核試卷
- 今日會計考試試題及答案
- 2023年護理知識競賽題庫有答案
- 2021年四川省瀘州市中考理綜物理試題【含答案、解析】
- 2025上半年江蘇省連云港東??h事業(yè)單位招聘23人歷年自考難、易點模擬試卷(共500題附帶答案詳解)
- 2025屆湖北聯(lián)投集團有限公司校園招聘299人筆試參考題庫附帶答案詳解
- 超市安全用電培訓
- (一模)2025屆安徽省“江南十?!备呷?lián)考數(shù)學試卷(含官方答案)
- 電氣火災警示教育培訓考試試題
- 物業(yè)安全知識培訓內(nèi)容
- 內(nèi)科學 尿路感染學習課件
- (2025)駕照C1證考試科目一必考題庫及參考答案(包過版)
- 2025年泰興經(jīng)濟開發(fā)區(qū)國有企業(yè)招聘筆試參考題庫含答案解析
評論
0/150
提交評論