版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、實(shí)驗(yàn)五 利用壓控振蕩器測(cè)量電壓一、實(shí)驗(yàn)?zāi)康模?)以555定時(shí)器為基礎(chǔ)設(shè)計(jì)壓控振蕩器(2)設(shè)計(jì)一個(gè)具有如下功能的簡(jiǎn)易頻率計(jì)。 1. 可以測(cè)量壓控振蕩器產(chǎn)生的頻率,用4位數(shù)碼管顯示 2.測(cè)量結(jié)果直接用十進(jìn)制數(shù)值顯示 3. 被測(cè)信號(hào)是壓控振蕩器產(chǎn)生的方波脈沖信號(hào),根據(jù)設(shè)計(jì)的壓控振蕩器確定電壓值 4. 具有超量程警告(可以用 LED 燈顯示)二、實(shí)驗(yàn)設(shè)備與器材(1)計(jì)算機(jī):Quartus 16.0軟件;(2)硬件:Cyclone DE0-CV FPGA開發(fā)平臺(tái)、555定時(shí)器、電阻、電容、可變電阻三、利用Multisim搭建仿真電路四、實(shí)驗(yàn)程序library ieee;use ieee.std_logi
2、c_1164.all;use ieee.std_logic_unsigned.all;- 計(jì)數(shù)器entity cnt10 is port (rst,fx,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,fx) - 定義變量 - <=是對(duì)信號(hào)賦值;而:=是對(duì)變量進(jìn)行賦值 variable cqi :std_logic_vector(3 downto 0); be
3、gin - others =>'0'是對(duì)數(shù)組cqi所有元素賦值0 if rst='1' then cqi :=(others =>'0'); elsif fx'event and fx='1' then if ena ='1' then if cqi < 9 then cqi:=cqi+1;cout<='0' elsif cqi=9 then cqi :=(others =>'0'); cout<='1' end if; e
4、lsif ena='0' then cqi:=(others =>'0'); end if; end if; outy <=cqi; end process;end behv;- 4位10進(jìn)計(jì)數(shù)器library ieee;use ieee.std_logic_1164.all;entity cnt10_4 isport(fx,rst,ena,clk:in std_logic;d:out std_logic_vector(15 downto 0); led_a:out std_logic);end entity;architecture one of
5、cnt10_4 iscomponent cnt10 port (rst,fx,ena:in std_logic; cout: out std_logic; outy :out std_logic_vector(3 downto 0);end component;component led_heheport(ena,clk:in std_logic;q:out std_logic);end component;signal e:std_logic_vector(3 downto 0);begin- 整體使用相同的rst和ena,fx作為進(jìn)位使用。u1:cnt10 port map(fx=>
6、fx,rst=>rst,ena=>ena,cout=>e(0),outy=>d(3 downto 0);u2:cnt10 port map(fx=>e(0),rst=>rst,ena=>ena,cout=>e(1),outy=>d(7 downto 4);u3:cnt10 port map(fx=>e(1),rst=>rst,ena=>ena,cout=>e(2),outy=>d(11 downto 8);u4:cnt10 port map(fx=>e(2),rst=>rst,ena=>ena
7、,cout=>e(3),outy=>d(15 downto 12);u5:led_hehe port map(ena=>e(3),clk=>clk,q=>led_a);end architecture one;- 16位鎖存器 latch=閂library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity latch4 isport(d:in std_logic_vector(15 downto 0);ena,clk:in std_logic;q:out std_logi
8、c_vector(15 downto 0);end latch4;architecture one of latch4 isbegin process(clk,ena,d) variable cqi:std_logic_vector(15 downto 0); begin if ena='0' then cqi:=cqi;- ena=0 鎖存上次的數(shù)據(jù) elsif clk'event and clk='1' then cqi:=d;-clk=1&&ena=1 計(jì)入新數(shù)據(jù) end if; q<=cqi; end process; en
9、d one;- 報(bào)警led hehelibrary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity led_hehe isport(ena,clk:in std_logic;q:out std_logic);end led_hehe;architecture one of led_hehe isbegin process(clk,ena) variable cqi:std_logic; begin if ena='0' then cqi:=cqi;- ena=0 鎖存上次的數(shù)據(jù) el
10、sif clk'event and clk='1' then cqi:= not cqi;-clk=1&&ena=1 計(jì)入新數(shù)據(jù) end if; q<=cqi; end process;end one;- LED控制模塊(數(shù)碼管controller)library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity led_controller isport(d:in std_logic_vector(3 downto 0);a:out std_logic_
11、vector(6 downto 0);end led_controller;architecture one of led_controller isbegin process(d) begin case d is when "0000"=> a<="1000000"when "0001"=> a<="1111001" when "0010"=> a<="0100100"when "0011"=> a<=&q
12、uot;0110000" when "0100"=> a<="0011001"when "0101"=> a<="0010010" when "0110"=> a<="0000010"when "0111"=> a<="1111000" when "1000"=> a<="0000000"when "1001"
13、;=> a<="0010000" when "1010"=> a<="0001000"when "1011"=> a<="0000011" when "1100"=> a<="1000110"when "1101"=> a<="0100001" when "1110"=> a<="0000110"when
14、"1111"=> a<="0001110" when others=> null; end case; end process;end;- 控制模塊(每隔一次clk,就翻轉(zhuǎn)ena和rst)library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity control is port (clk:in std_logic; rst,ena: out std_logic);end control;architecture behv of contr
15、ol isbegin process (clk) variable cqi :std_logic_vector(2 downto 0); begin if clk'event and clk='1' then if cqi <1 then cqi:=cqi+1;ena<='1'rst<='0' elsif cqi=1 then cqi :=(others =>'0'); ena<='0'rst<='1' end if; end if; end proces
16、s;end behv;- 時(shí)鐘(1hz)發(fā)生器library ieee;use ieee.std_logic_1164.all;entity freq_div is port (clk:in std_logic; clk_out:out std_logic); end freq_div;architecture fwm of freq_div isconstant m: integer:= 25000;signal tmp:std_logic;begin process(clk,tmp) variable cout:integer:=0; begin if clk'event and
17、clk='1' then cout:=cout+1; if cout<=m then tmp<='0' elsif cout<m*2 then tmp<='1' else cout:=0; end if; end if; end process;clk_out<=tmp;end fwm;- 總體例化語句:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;- clk是50hz的板載時(shí)鐘信號(hào),即參考信號(hào),而fx才是測(cè)量的輸入信
18、號(hào)entity voc isport(clk:in std_logic;fx:in std_logic;ledout:out std_logic_vector(28 downto 0);- 數(shù)碼管7*4end entity;architecture one of voc iscomponent freq_div port (clk:in std_logic; clk_out:out std_logic);end component;component control port (clk:in std_logic; rst,ena: out std_logic);end component;co
19、mponent cnt10_4port(clk,fx,rst,ena:in std_logic;d:out std_logic_vector(15 downto 0); led_a:out std_logic);end component;component latch4port(d:in std_logic_vector(15 downto 0);ena,clk:in std_logic;q:out std_logic_vector(15 downto 0);end component;component led_controllerport(d:in std_logic_vector(3
20、downto 0);a:out std_logic_vector(6 downto 0);end component;signal x,z:std_logic;signal g,h:std_logic_vector(15 downto 0);signal leds:std_logic_vector(28 downto 0);signal clk_base:std_logic;beginu1: freq_div port map(clk=>clk,clk_out=>clk_base);u2: control port map(clk=>clk_base,ena=>x,rst=>z);u3: cnt10_4 port map(fx=>fx,rst=>z,ena=>x,d=>g,led_a=>leds(28),clk=>clk_base);u4: latch4 port map(clk=>clk_base,ena=>x,d=>g,q
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度教育培訓(xùn)機(jī)構(gòu)學(xué)生資助及獎(jiǎng)學(xué)金管理合同
- 案例分析及教育寫作(學(xué)生打印版)
- 二零二五年度個(gè)人消費(fèi)分期付款服務(wù)合同
- 二零二五年度排水泵站設(shè)備升級(jí)合同4篇
- 二零二五年度拍賣會(huì)安全保障合同范本
- 2025年度房產(chǎn)租賃合同糾紛調(diào)解服務(wù)協(xié)議4篇
- 2025年度摩托車行業(yè)展會(huì)主辦與參展合同
- 第四單元 和諧與夢(mèng)想 (解析版)-2023-2024學(xué)年九年級(jí)道德與法治上學(xué)期期中考點(diǎn)大串講(部編版)
- 第二單元 近代化的早期探索與民族危機(jī)的加?。ㄔ戆妫? 2023-2024學(xué)年八年級(jí)歷史上學(xué)期期中考點(diǎn)大串講(部編版)
- 課題申報(bào)參考:民事訴訟法與民事實(shí)體法協(xié)同發(fā)展研究
- 2024年甘肅省武威市、嘉峪關(guān)市、臨夏州中考英語真題
- DL-T573-2021電力變壓器檢修導(dǎo)則
- 繪本《圖書館獅子》原文
- 安全使用公共WiFi網(wǎng)絡(luò)的方法
- 2023年管理學(xué)原理考試題庫(kù)附答案
- 【可行性報(bào)告】2023年電動(dòng)自行車相關(guān)項(xiàng)目可行性研究報(bào)告
- 歐洲食品與飲料行業(yè)數(shù)據(jù)與趨勢(shì)
- 放療科室規(guī)章制度(二篇)
- 中高職貫通培養(yǎng)三二分段(中職階段)新能源汽車檢測(cè)與維修專業(yè)課程體系
- 浙江省安全員C證考試題庫(kù)及答案(推薦)
- 目視講義.的知識(shí)
評(píng)論
0/150
提交評(píng)論