位十進(jìn)制頻率計(jì)的設(shè)計(jì)計(jì)算機(jī)與電子等專業(yè)課程設(shè)計(jì)_第1頁(yè)
位十進(jìn)制頻率計(jì)的設(shè)計(jì)計(jì)算機(jī)與電子等專業(yè)課程設(shè)計(jì)_第2頁(yè)
位十進(jìn)制頻率計(jì)的設(shè)計(jì)計(jì)算機(jī)與電子等專業(yè)課程設(shè)計(jì)_第3頁(yè)
位十進(jìn)制頻率計(jì)的設(shè)計(jì)計(jì)算機(jī)與電子等專業(yè)課程設(shè)計(jì)_第4頁(yè)
位十進(jìn)制頻率計(jì)的設(shè)計(jì)計(jì)算機(jī)與電子等專業(yè)課程設(shè)計(jì)_第5頁(yè)
已閱讀5頁(yè),還剩7頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、4位十進(jìn)制頻率計(jì)的設(shè)計(jì)一、 主要指標(biāo)和要求1. 設(shè)計(jì)4位十進(jìn)制頻率計(jì),學(xué)習(xí)較復(fù)雜的數(shù)字系統(tǒng)設(shè)計(jì)方法;2. 深入學(xué)習(xí)數(shù)字系統(tǒng)設(shè)計(jì)的方法與步驟;3. 用元件例化語(yǔ)句寫(xiě)出頻率計(jì)的頂層文件;4. 用VHDL硬件描述語(yǔ)言進(jìn)行模塊電路的設(shè)計(jì);5. 設(shè)計(jì)硬件要求:PC機(jī),操作系統(tǒng)為Windows2000/XP,本課程所用系統(tǒng)均為max+plus II 5.1設(shè)計(jì)平臺(tái),GW48系列SOPC/EDA實(shí)驗(yàn)開(kāi)發(fā)系統(tǒng)。二、工作原理以及方案選擇原理工作說(shuō)明:根據(jù)頻率的定義和頻率測(cè)量的基本原理,測(cè)定信號(hào)的頻率必須有一個(gè)脈寬為1秒的對(duì)輸入信號(hào)脈沖計(jì)數(shù)允許的信號(hào);1秒計(jì)數(shù)結(jié)束后,計(jì)數(shù)值鎖入鎖存器的鎖存信號(hào)和為下一測(cè)頻計(jì)數(shù)周期

2、作準(zhǔn)備的計(jì)數(shù)器清0信號(hào)。這3個(gè)信號(hào)可以由一個(gè)測(cè)頻控制信號(hào)發(fā)生器產(chǎn)生,即圖(a)中的TESTCTL,它的設(shè)計(jì)要求是,TESTCTL的計(jì)數(shù)使能信號(hào)CNT_EN能產(chǎn)生一個(gè)1秒脈寬的周期信號(hào),并對(duì)頻率計(jì)的每一計(jì)數(shù)器CNT10的ENA使能端進(jìn)行同步控制。當(dāng)CNT_EN高電平時(shí),允許計(jì)數(shù);低電平時(shí)停止計(jì)數(shù),并保持其所計(jì)的脈沖數(shù)。在停止計(jì)數(shù)期間,首先需要產(chǎn)生一個(gè)鎖存信號(hào)LOAD,在該信號(hào)上升沿時(shí),將計(jì)數(shù)器在前1秒鐘的計(jì)數(shù)值鎖存進(jìn)各鎖存器REG4B中,并由外部的7段譯碼器譯出,顯示計(jì)數(shù)值。設(shè)置鎖存器的好處是,顯示的數(shù)據(jù)穩(wěn)定,不會(huì)由于周期性的清零信號(hào)而不斷閃爍。鎖存信號(hào)之后,必須有一清零信號(hào)RST_CNT對(duì)計(jì)數(shù)

3、器進(jìn)行清零,為下1秒鐘的計(jì)數(shù)操作作準(zhǔn)備。其工作時(shí)序波形如圖(a)。圖(a) 頻率計(jì)測(cè)頻控制器TESTCTL測(cè)控時(shí)序圖圖(b) 4位十進(jìn)制頻率計(jì)頂層文件原理圖選擇的設(shè)計(jì)方案:1. 根據(jù)頻率計(jì)的工作原理,將電路劃分成控制器、計(jì)數(shù)器、鎖存器和LED顯示幾個(gè)模塊, 控制器產(chǎn)生1秒脈寬的計(jì)數(shù)允許信號(hào)、鎖存信號(hào)和計(jì)數(shù)器清零信號(hào)計(jì)數(shù)器對(duì)輸入信號(hào)的脈沖數(shù)進(jìn)行累計(jì)鎖存器鎖存測(cè)得的頻率值LED顯示將頻率值顯示在數(shù)碼管上2. 根據(jù)圖(a)、(b)及(1)(2)描述的4位十進(jìn)制頻率計(jì)的工作原理,利用max+plusII 5.1對(duì)以上三者的程序進(jìn)行文本編輯輸入和仿真測(cè)試并根據(jù)圖(b),寫(xiě)出頻率計(jì)的頂層文件,并給出其測(cè)頻

4、時(shí)序波形,及其分析。3. 頻率計(jì)設(shè)計(jì)硬件驗(yàn)證。編譯、綜合和適配頻率計(jì)頂層設(shè)計(jì)文件,并編程下載進(jìn)入目標(biāo)器件中。本實(shí)驗(yàn)?zāi)繕?biāo)器件是EP1K30TC144-3,實(shí)驗(yàn)電路選擇模式0,4個(gè)數(shù)碼管(數(shù)碼4-1:PIO31-PIO16)顯示測(cè)頻輸出;待測(cè)頻率輸入FIN由clock0輸入,頻率可選4Hz、256HZ . . .或更高;1HZ測(cè)頻控制信號(hào)F1HZ可由clock2輸入(用電路帽選選1Hz)。三、各模塊及頂層文件的設(shè)計(jì)(1)、十進(jìn)制計(jì)數(shù)library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt1

5、0 is port (rst,clk,ena:in std_logic; cout: out std_logic; outy :out std_logic_vector(3 downto 0);end cnt10;architecture behv of cnt10 isbegin process (rst,ena,clk) variable cqi :std_logic_vector(3 downto 0);begin if rst=1 then cqi :=(others =0); elsif clkevent and clk=1 then if ena =1 then if cqi 9

6、then cqi:=cqi+1;cout0); cout0); end if;end if; outy clk,rst=rst,ena=ena,cout=e(0),outy=d(3 downto 0);u2:cnt10 port map(clk=e(0),rst=rst,ena=ena,cout=e(1),outy=d(7 downto 4);u3:cnt10 port map(clk=e(1),rst=rst,ena=ena,cout=e(2),outy=d(11 downto 8);u4:cnt10 port map(clk=e(2),rst=rst,ena=ena,cout=e(3),o

7、uty=d(15 downto 12); end architecture one;(3)、四位鎖存library ieee; use ieee.std_logic_1164.all;entity reg4b is port ( load : in std_logic; din : in std_logic_vector(3 downto 0); dout : out std_logic_vector(3 downto 0) );end reg4b;architecture behav of reg4b isbegin process(load, din)begin if loadevent

8、and load = 1 then dout = din; end if; end process;end behav;(3)(4)、測(cè)頻控制器library ieee; -use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity testctl is port ( clkk : in std_logic; cnt_en,rst_cnt,load : out std_logic); end testctl;architecture behav of testctl is signal div2clk : std_log

9、ic;begin process( clkk ) begin if clkkevent and clkk = 1 then div2clk = not div2clk; end if; end process; process (clkk, div2clk) begin if clkk=0 and div2clk=0 then rst_cnt = 1; else rst_cnt = 0; end if; end process; load = not div2clk ; cnt_en a a a a a a a a a a a a a a a a null;end case;end proce

10、ss;end;總體例化library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith;use ieee.std_logic_signed;entity cntf isport(clk1:in std_logic; clk2:in std_logic;ledout:out std_logic_vector(27 downto 0);end entity;architecture one of cntf iscomponent testctl port (clkk:i

11、n std_logic; rst_cnt,cnt_en,load: out std_logic);end component;component cnt10_4port(fx,rst,ena:in std_logic; d:out std_logic_vector(15 downto 0);end component;component reg4b port(load: in std_logic; din : in std_logic_vector(3 downto 0); dout: out std_logic_vector(3 downto 0);end component;compone

12、nt led_controllerport(d:in std_logic_vector(3 downto 0); a:out std_logic_vector(6 downto 0);end component;signal x,y,z:std_logic;signal b,h:std_logic_vector(15 downto 0);signal leds:std_logic_vector(27 downto 0);beginu1: testctl port map(clkk=clk1,cnt_en=x,rst_cnt=y,load=z);u2: cnt10_4 port map(fx=c

13、lk2,rst=y,ena=x,d=b);u3: reg4b port map(load=z,din=b(3 downto 0),dout=h(3 downto 0);u4: reg4b port map(load=z,din=b(7 downto 4),dout=h(7 downto 4);u5: reg4b port map(load=z,din=b(11 downto 8),dout=h(11 downto 8);u6: reg4b port map(load=z,din=b(15 downto 12),dout=h(15 downto 12);u7: led_controller port map(d=h(3 downto 0),a=leds(6 downto 0);u8: led_controller port map(d=h(7 downto 4),a=leds(13 down

溫馨提示

  • 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ì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論