




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、現(xiàn)代電子技術(shù)綜合實驗數(shù)字頻率計設(shè)計實驗報告姓名: 學(xué)號:一、系統(tǒng)總體設(shè)計設(shè)計要求1、被測輸入信號:方波2、測試頻率范圍為:10Hz1MHz 擴展 1MHz 100MHz3、量程分為三檔:第一檔:閘門時間為1S時,最大讀數(shù)為999.999KHz 第二檔:閘門時間為0.1S時,最大讀數(shù)為9999.99KHz 第三檔:閘門時間為0.01S時,最大讀數(shù)為99999.9KHz。4、顯示工作方式:a、用六位BCD七段數(shù)碼管顯示讀數(shù)。 b、采用記憶顯示方法 c、實現(xiàn)對高位無意義零的消隱。系統(tǒng)工作原理信號的頻率就是信號在單位時間內(nèi)所產(chǎn)生的脈沖個數(shù),其表達式為f=N/T,其中f為被測信號的頻率,N為技術(shù)其所累計
2、的脈沖個數(shù),T為產(chǎn)生N個脈沖所需的時間。技術(shù)其所記錄的結(jié)果,就是被測信號的頻率。如在1s內(nèi)記錄1000個脈沖,則被測信號的頻率為1000HZ。測量頻率的基本方法有兩種:計數(shù)法和計時法,或稱測頻法和測周期法。1、計數(shù)法計數(shù)法是將被測信號通過一個定時閘門加到計數(shù)器進行計數(shù)的方法,如果閘門打開的時間為T,計數(shù)器得到的計數(shù)值為N1,則被測頻率為f=N1/T。改變時間T,則可改變測量頻率范圍。如圖所示。計數(shù)法測量原理 設(shè)在T期間,計數(shù)器的精確計數(shù)值應(yīng)為N,根據(jù)計數(shù)器的計數(shù)特性可知,N1的絕對誤差是N1=N+1,N1的相對誤差為N1=(N1-N)/N=1/N。由N1的相對誤差可知,N的數(shù)值愈大,相對誤差愈
3、小,成反比關(guān)系。因此,在f以確定的條件下,為減少N的相對誤差,可通過增大T的方法來降低測量誤差。當(dāng)T為某確定值時(通常取1s),則有f1=N1,而f=N,故有f1的相對誤差:f1=(f1-f)/f=1/f 從上式可知f1的相對誤差與f成反比關(guān)系,即信號頻率越高,誤差越??;而信號頻率越低,則測量誤差越大。因此測頻法適合用于對高頻信號的測量,頻率越高,測量精度也越高。2、計時法計時法又稱為測周期法,測周期法使用被測信號來控制閘門的開閉,而將標準時基脈沖通過閘門加到計數(shù)器,閘門在外信號的一個周期內(nèi)打開,這樣計數(shù)器得到的計數(shù)值就是標準時基脈沖外信號的周期值,然后求周期值的倒數(shù),就得到所測頻率值。首先把
4、被測信號通過二分頻,獲得一個高電平時間是一個信號周期T的方波信號;然后用一個一直周期T1的高頻方波信號作為計數(shù)脈沖,在一個信號周期T的時間內(nèi)對T1信號進行計數(shù),如圖所示。計時法測量原理若在T時間內(nèi)的計數(shù)值為N2,則有:T2=N2*T1 f2=1/T2=1/(N2*T1)=f1/N2 N2的絕對誤差為N2=N+1。N2的相對誤差為N2=(N2-N)/N=1/NT2的相對誤差為T2=(T2-T)/T=(N2*T1-T)/T=f/f1從T2的相對誤差可以看出,周期測量的誤差與信號頻率成正比,而與高頻標準計數(shù)信號的頻率成反比。當(dāng)f1為常數(shù)時,被測信號頻率越低,誤差越小,測量精度也就越高。 根據(jù)本設(shè)計要
5、求的性能與技術(shù)指標,首先需要確定能滿足這些指標的頻率測量方法。有上述頻率測量原理與方法的討論可知,計時法適合于對低頻信號的測量,而計數(shù)法則適合于對較高頻信號的測量。但由于用計時法所獲得的信號周期數(shù)據(jù),還需要求倒數(shù)運算才能得到信號頻率,而求倒數(shù)運算用中小規(guī)模數(shù)字集成電路較難實現(xiàn),因此,計時法不適合本實驗要求。測頻法的測量誤差與信號頻率成反比,信號頻率越低,測量誤差就越大,信號頻率越高,其誤差就越小。但用測頻法所獲得的測量數(shù)據(jù),在閘門時間為一秒時,不需要進行任何換算,計數(shù)器所計數(shù)據(jù)就是信號頻率。因此,本實驗所用的頻率測量方法是測頻法。 單元電路的劃分分頻電路FPGA的石英振蕩器,產(chǎn)生頻率為48MH
6、z的方波信號。因此需要分頻電路,將48MHz的高頻信號,分頻為整個系統(tǒng)需要的信號:1Hz閘門信號和1KHz掃描顯示信號計數(shù)器對外部輸入的被測信號,進行計數(shù)鎖存器對計數(shù)器的計數(shù)結(jié)果,進行鎖存門控電路對計數(shù)電路、鎖存電路,進行時序控制掃描顯示控制電路對鎖存的結(jié)果,進行動態(tài)掃描顯示系統(tǒng)框圖:二、單元電路設(shè)計單元電路設(shè)計思路一分頻器分頻器的功能是將提供的48MHz標準信號,產(chǎn)生所需的1Hz閘門控制信號及1KHz掃描時鐘信號。因此通過計數(shù)器的計數(shù),來實現(xiàn)分頻器的功能例如:實現(xiàn)對一個信號的5分頻if clkinevent and clkin = 1 then if cnt = 5 thencnt = 1;
7、clkout =not clkout; elsecnt = cnt + 1; end if; end if; 源程序見附錄二計數(shù)器計數(shù)器的功能是對外部輸入的被測信號,進行計數(shù)。因為系統(tǒng)要求,顯示為6為數(shù)字,所以需要6位的計數(shù)器。因此采用6個10進制計數(shù)器級聯(lián)的方法單級計數(shù)器級聯(lián)后的計數(shù)器級聯(lián),分為同步級聯(lián)和異步級聯(lián)兩種方式同步級聯(lián)原理圖:異步級聯(lián)原理圖:本設(shè)計選擇的是同步級聯(lián)源程序見附錄三鎖存器鎖存器用來實現(xiàn)對6位計數(shù)結(jié)果,和溢出信號的鎖存功能源程序見附錄四門控電路門控電路的作用是對計數(shù)電路和鎖存電路,進行時序控制例如:源程序見附錄五掃描顯示控制電路掃描顯示控制電路的功能是對鎖存的結(jié)果,進行動
8、態(tài)掃描顯示。選用頻率1KHz的信號實現(xiàn)對六位已經(jīng)鎖存的計數(shù)結(jié)果的掃描輸出 掃描顯示控制電路分為以下幾部分構(gòu)成:1.計數(shù)部分:通過計數(shù)器的計數(shù),來產(chǎn)生動態(tài)顯示數(shù)碼管的位選信號2.小數(shù)點控制部分:控制小數(shù)點的顯示3.數(shù)據(jù)選擇部分:根據(jù)計數(shù)部分產(chǎn)生的位選信號,來選擇一組數(shù)據(jù)輸出顯示4.七段譯碼部分:將數(shù)據(jù)選擇器輸出的數(shù)據(jù),進行譯碼,形成數(shù)碼管的段選信號5.消隱部分實現(xiàn)高位無意義0的消隱各個部分間的鏈接關(guān)系如圖:源程序見附錄三、 設(shè)計實現(xiàn)頂層設(shè)計通過原件的聲明,和原件的例化,來將各個底層實體,在頂層調(diào)用例如:architecture digitalfrequency_arch of digitalfr
9、equency iscomponent fenpinPort ( clk : in STD_LOGIC; clkout1 : out STD_LOGIC; clkout1k : out STD_LOGIC);end component;beginu1:fenpin port map (clk24m,clk1,clk1k);end digitalfrequency_arch;管腳分配NET overflow LOC = K14;NET clk24m LOC = T8;NET g LOC = D7;NET ledout LOC = A11;NET ledout LOC = B12;NET ledo
10、ut LOC = A12;NET ledout LOC = C12;NET ledout LOC = C13;NET ledout LOC = A13;NET ledout LOC = B14;NET digitalsignal LOC = D14;NET sel LOC = F8;NET sel LOC = D8;NET sel LOC = E7;NET point LOC = C11;下載過程 四、測試結(jié)果及結(jié)論測試結(jié)果輸入信號為1MHz數(shù)碼管顯示為999.999KHz輸入信號為10Hz數(shù)碼管顯示為0.010KHz輸入信號為5000Hz數(shù)碼管顯示為5.000KHz輸入信號為5555Hz數(shù)碼
11、管顯示為5.555KHz輸入為98429Hz數(shù)碼管顯示為98.429KHz實驗結(jié)論當(dāng)輸入信號為1MHz時,顯示稍有誤差,其余量程范圍內(nèi)的信號均能精確顯示,該數(shù)字頻率計性能良好,實驗成功!附錄源程序1分頻電路entity fenpin is Port ( clk : in STD_LOGIC; clkout1 : out STD_LOGIC; clkout1k : out STD_LOGIC);end fenpin;architecture Behavioral of fenpin issignal fcount1 :integer range 1 to 500:=1;signal fcount
12、1k :integer range 1 to 24000:=1;signal clk1k:STD_LOGIC:=0;signal clk1:STD_LOGIC:=0;beginprocess(clk)begin if clkevent and clk=1 then if fcount1k= 24000 thenfcount1k=1;clk1k=not clk1k;elsefcount1k=fcount1k +1;end if;end if;end process;clkout1k = clk1k ;process(clk1k)begin if clk1kevent and clk1k=1 th
13、en if fcount1= 500 thenfcount1=1;clk1=not clk1;elsefcount1=fcount1 +1;end if;end if;end process;clkout1 = clk1 ;end Behavioral;2.門控電路entity gatecontrol isPort ( gatein : in STD_LOGIC; gateout : out STD_LOGIC; latch : out STD_LOGIC; reset : out STD_LOGIC);end gatecontrol;architecture Behavioral of ga
14、tecontrol issignal A:STD_LOGIC:=0;signal B:STD_LOGIC:=0;signal C:STD_LOGIC:=0;beginprocess(gatein)beginif gateinevent and gatein=1 then A=not A;end if;if gateinevent and gatein=0 thenB=not A;end if;end process;process(gatein,A,B)beginif gatein=0 and A=0 and B=1 thenC=1;else C=0;end if;end process;ga
15、teout=A;latch=B;reset=C;end Behavioral;3計數(shù)器單級計數(shù)器entity counter is Port ( clk : in STD_LOGIC; reset : in STD_LOGIC; carry_in : in STD_LOGIC; carry_out : out STD_LOGIC; count_out : out STD_LOGIC_VECTOR (3 downto 0);end counter;architecture Behavioral of counter issignal count:STD_LOGIC_VECTOR (3 downt
16、o 0):=0000;beginprocess (clk,carry_in)begin if reset=1 thencount=0000;elsif clkevent and clk=1 and carry_in=1 then if count=1001 thencount=0000; elsecount=count+1; end if; end if;end process;count_out=count;carry_out=1 when carry_in=1 and count=1001 else 0;end Behavioral;級聯(lián)后計數(shù)器entity counter6 is Por
17、t ( Csignal : in STD_LOGIC; clear : in STD_LOGIC; count_en : in STD_LOGIC; out1 : out STD_LOGIC_VECTOR (3 downto 0); out2 : out STD_LOGIC_VECTOR (3 downto 0); out3 : out STD_LOGIC_VECTOR (3 downto 0); out4 : out STD_LOGIC_VECTOR (3 downto 0); out5 : out STD_LOGIC_VECTOR (3 downto 0); out6 : out STD_
18、LOGIC_VECTOR (3 downto 0); over : out STD_LOGIC);end counter6;architecture counter6_arch of counter6 iscomponent counterport(clk : in STD_LOGIC; reset : in STD_LOGIC; carry_in : in STD_LOGIC; carry_out : out STD_LOGIC; count_out : out STD_LOGIC_VECTOR (3 downto 0);end component;signal overflow1:STD_
19、LOGIC :=0;signal overflow2:STD_LOGIC :=0;signal overflow3:STD_LOGIC :=0;signal overflow4:STD_LOGIC :=0;signal overflow5:STD_LOGIC :=0;signal overflow6:STD_LOGIC :=0;beginu1:counter port map (Csignal,clear,count_en,overflow1,out1);u2:counter port map (Csignal,clear,overflow1,overflow2,out2);u3:counte
20、r port map (Csignal,clear,overflow2,overflow3,out3);u4:counter port map (Csignal,clear,overflow3,overflow4,out4);u5:counter port map (Csignal,clear,overflow4,overflow5,out5);u6:counter port map (Csignal,clear,overflow5,overflow6,out6);over=overflow6;end counter6_arch;4.鎖存器entity latch is Port ( data
21、_in1 : in STD_LOGIC_VECTOR (3 downto 0); data_in2 : in STD_LOGIC_VECTOR (3 downto 0); data_in3 : in STD_LOGIC_VECTOR (3 downto 0); data_in4 : in STD_LOGIC_VECTOR (3 downto 0); data_in5 : in STD_LOGIC_VECTOR (3 downto 0); data_in6 : in STD_LOGIC_VECTOR (3 downto 0); latch_in : in STD_LOGIC; over_in :
22、 in STD_LOGIC; over_out : out STD_LOGIC; data_out1 : out STD_LOGIC_VECTOR (3 downto 0); data_out2 : out STD_LOGIC_VECTOR (3 downto 0); data_out3 : out STD_LOGIC_VECTOR (3 downto 0); data_out4 : out STD_LOGIC_VECTOR (3 downto 0); data_out5 : out STD_LOGIC_VECTOR (3 downto 0); data_out6 : out STD_LOGI
23、C_VECTOR (3 downto 0);end latch;architecture Behavioral of latch isbeginprocess(latch_in)beginif latch_inevent and latch_in=1 thendata_out1=data_in1;end if;end process;process(latch_in)beginif latch_inevent and latch_in=1 thendata_out2=data_in2;end if;end process;process(latch_in)beginif latch_ineve
24、nt and latch_in=1 thendata_out3=data_in3;end if;end process;process(latch_in)beginif latch_inevent and latch_in=1 thendata_out4=data_in4;end if;end process;process(latch_in)beginif latch_inevent and latch_in=1 thendata_out5=data_in5;end if;end process;process(latch_in)beginif latch_inevent and latch
25、_in=1 thendata_out6=data_in6;end if;end process;process(latch_in)beginif latch_inevent and latch_in=1 thenover_out=over_in;end if;end process;end Behavioral;5.掃描顯示控制電路entity display is Port ( value0 : in STD_LOGIC_VECTOR (3 downto 0); value1 : in STD_LOGIC_VECTOR (3 downto 0); value2 : in STD_LOGIC_
26、VECTOR (3 downto 0); value3 : in STD_LOGIC_VECTOR (3 downto 0); value4 : in STD_LOGIC_VECTOR (3 downto 0); value5 : in STD_LOGIC_VECTOR (3 downto 0); led : out STD_LOGIC_VECTOR (6 downto 0); clk1k : in STD_LOGIC; point : out STD_LOGIC; g:out STD_LOGIC; sel : out STD_LOGIC_VECTOR (2 downto 0);end dis
27、play;architecture Behavioral of display issignal count:STD_LOGIC_VECTOR (2 downto 0):=000;signal dataout:STD_LOGIC_VECTOR (3 downto 0):=0000;signal hide:STD_LOGIC:=0;signal hide_4:STD_LOGIC:=0;signal hide_5:STD_LOGIC:=0;beginprocess(clk1k)beginif clk1kevent and clk1k=1 then if count=101 thencount=00
28、0; elsecount=count+1; end if; end if;end process;sel=count;g dataout dataout dataout dataout dataout dataout dataout=0000;end case;end process;process(hide,dataout)beginledledledledledledledledledledledled=; end case;end if;end process;process(count)beginif count=011 thenpoint=0;else point=1;end if;
29、end process;process(value4,value5)beginif value5 = 0000thenhide_5 = 1 ;else hide_5 =0;end if;if value4 = 0000 and value5 = 0000 then hide_4 = 1;else hide_4 hide hide hide hide hide hide hide =1;end case;end process;end Behavioral;6.頂層電路entity digitalfrequency is Port ( digitalsignal : in STD_LOGIC;
30、clk24m : in STD_LOGIC; ledout : out STD_LOGIC_VECTOR (6 downto 0); sel : out STD_LOGIC_VECTOR (2 downto 0):=000; overflow : out STD_LOGIC; g : out STD_LOGIC; point: out STD_LOGIC);end digitalfrequency;architecture digitalfrequency_arch of digitalfrequency iscomponent fenpinPort ( clk : in STD_LOGIC;
31、 clkout1 : out STD_LOGIC; clkout1k : out STD_LOGIC);end component;component gatecontrolPort ( gatein : in STD_LOGIC; gateout : out STD_LOGIC; latch : out STD_LOGIC; reset : out STD_LOGIC);end component;component counter6Port ( Csignal : in STD_LOGIC; clear : in STD_LOGIC; count_en : in STD_LOGIC; ou
32、t1 : out STD_LOGIC_VECTOR (3 downto 0); out2 : out STD_LOGIC_VECTOR (3 downto 0); out3 : out STD_LOGIC_VECTOR (3 downto 0); out4 : out STD_LOGIC_VECTOR (3 downto 0); out5 : out STD_LOGIC_VECTOR (3 downto 0); out6 : out STD_LOGIC_VECTOR (3 downto 0); over : out STD_LOGIC);end component;component latc
33、h Port ( data_in1 : in STD_LOGIC_VECTOR (3 downto 0); data_in2 : in STD_LOGIC_VECTOR (3 downto 0); data_in3 : in STD_LOGIC_VECTOR (3 downto 0); data_in4 : in STD_LOGIC_VECTOR (3 downto 0); data_in5 : in STD_LOGIC_VECTOR (3 downto 0); data_in6 : in STD_LOGIC_VECTOR (3 downto 0); latch_in : in STD_LOG
34、IC; over_in : in STD_LOGIC; over_out : out STD_LOGIC; data_out1 : out STD_LOGIC_VECTOR (3 downto 0); data_out2 : out STD_LOGIC_VECTOR (3 downto 0); data_out3 : out STD_LOGIC_VECTOR (3 downto 0); data_out4 : out STD_LOGIC_VECTOR (3 downto 0); data_out5 : out STD_LOGIC_VECTOR (3 downto 0); data_out6 :
35、 out STD_LOGIC_VECTOR (3 downto 0);end component;component displayPort ( value0 : in STD_LOGIC_VECTOR (3 downto 0); value1 : in STD_LOGIC_VECTOR (3 downto 0); value2 : in STD_LOGIC_VECTOR (3 downto 0); value3 : in STD_LOGIC_VECTOR (3 downto 0); value4 : in STD_LOGIC_VECTOR (3 downto 0); value5 : in
36、STD_LOGIC_VECTOR (3 downto 0); led : out STD_LOGIC_VECTOR (6 downto 0); clk1k : in STD_LOGIC; point : out STD_LOGIC; g:out STD_LOGIC; sel : out STD_LOGIC_VECTOR (2 downto 0);end component;signal clk1k:STD_LOGIC:=0;signal clk1:STD_LOGIC:=0;signal A:STD_LOGIC:=0;signal B:STD_LOGIC:=0;signal C:STD_LOGIC:=0;signal counterout1:
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 衢州職業(yè)技術(shù)學(xué)院《搜索引擎營銷》2023-2024學(xué)年第二學(xué)期期末試卷
- 山東化工職業(yè)學(xué)院《英語學(xué)科教學(xué)設(shè)計與技能訓(xùn)練》2023-2024學(xué)年第二學(xué)期期末試卷
- 三江學(xué)院《世界古代史(下)》2023-2024學(xué)年第二學(xué)期期末試卷
- 廣東食品藥品職業(yè)學(xué)院《醫(yī)務(wù)社會工作》2023-2024學(xué)年第二學(xué)期期末試卷
- 西安交通大學(xué)城市學(xué)院《環(huán)境化學(xué)Ⅱ》2023-2024學(xué)年第二學(xué)期期末試卷
- 貴州財經(jīng)大學(xué)《中學(xué)政治課教師技能訓(xùn)練》2023-2024學(xué)年第二學(xué)期期末試卷
- 煙臺工程職業(yè)技術(shù)學(xué)院《工程概論與概預(yù)算》2023-2024學(xué)年第二學(xué)期期末試卷
- 株洲師范高等專科學(xué)?!斗b結(jié)構(gòu)原理》2023-2024學(xué)年第二學(xué)期期末試卷
- 山東農(nóng)業(yè)工程學(xué)院《油畫人物風(fēng)格與實驗》2023-2024學(xué)年第二學(xué)期期末試卷
- 山東工藝美術(shù)學(xué)院《變形觀測與數(shù)據(jù)處理》2023-2024學(xué)年第二學(xué)期期末試卷
- 電工基礎(chǔ)(第五版) 課件全套 白乃平 第1-9章 電路的基本概念和基本定律- 磁路與鐵芯線圈+附錄 常用電工儀表簡介
- ct增強掃描中造影劑外滲課件
- 《汽車發(fā)動機構(gòu)造與維修》教案-
- 2021年陜西西安亮麗電力集團有限責(zé)任公司招聘筆試試題
- 高中英語-Studying abroad教學(xué)課件設(shè)計
- 原材料取樣檢測安全操作規(guī)程
- 創(chuàng)新思維與方法(第2版)PPT全套完整教學(xué)課件
- (5.3.2)-2.2雜草的分類農(nóng)田雜草及防除學(xué)
- 人教部編道德與法治五年級下冊單元計劃
- 天津武清區(qū)事業(yè)單位考試真題2022
- 鐵路營業(yè)線施工安全管理培訓(xùn)課件
評論
0/150
提交評論