




版權(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 is1 / 9 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
3、); begin - 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
4、if; elsif 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 on
5、e of 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=&g
7、t;ena,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
8、_logic_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 proces
9、s; end 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 鎖存上次的
10、數(shù)據(jù) elsif 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_l
11、ogic_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&l
12、t;="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"
14、when "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
15、control 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 p
16、rocess;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
17、 and 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 compone
19、nt;component 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_vect
20、or(3 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,
溫馨提示
- 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. 人人文庫網(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 小學(xué)語文教學(xué)提升策略計(jì)劃
- 2025-2030天然氣汽車行業(yè)市場(chǎng)現(xiàn)狀供需分析及重點(diǎn)企業(yè)投資評(píng)估規(guī)劃分析研究報(bào)告
- 2025-2030十二指腸支架行業(yè)市場(chǎng)現(xiàn)狀供需分析及重點(diǎn)企業(yè)投資評(píng)估規(guī)劃分析研究報(bào)告
- 2025-2030全球及中國(guó)證券交易所行業(yè)市場(chǎng)現(xiàn)狀供需分析及市場(chǎng)深度研究發(fā)展前景及規(guī)劃可行性分析研究報(bào)告
- 四年級(jí)班主任教學(xué)方法優(yōu)化計(jì)劃
- 仁愛版八年級(jí)初中英語作文范文指導(dǎo)
- 學(xué)校交通安全管理領(lǐng)導(dǎo)小組職責(zé)
- 2025-2030年標(biāo)示牌市場(chǎng)發(fā)展現(xiàn)狀分析及行業(yè)投資戰(zhàn)略研究報(bào)告
- 江蘇省南京市文昌中學(xué)2025屆八年級(jí)物理第一學(xué)期期末質(zhì)量檢測(cè)試題含解析
- 福建體育職業(yè)技術(shù)學(xué)院《河南地方戲曲》2023-2024學(xué)年第一學(xué)期期末試卷
- 廣東省深圳市小升初語文分班考試試卷一(含答案)
- YY 0503-2023 正式版 環(huán)氧乙烷滅菌器
- 北師大版數(shù)學(xué)小學(xué)二年級(jí)下冊(cè)期末無紙筆化檢測(cè)題
- 現(xiàn)代教育技術(shù)投稿格式
- 足球《踢墻式二過一》課件
- 高中信息技術(shù)面試試講真題匯總
- 《色彩構(gòu)成》核心課程標(biāo)準(zhǔn)
- 《論語》中的人生智慧與自我管理學(xué)習(xí)通超星課后章節(jié)答案期末考試題庫2023年
- 《三伏貼》ppt課件(圖文)
- 電梯司機(jī)安全技術(shù)交底
- 2022-2023學(xué)年黑龍江省寧安市六年級(jí)數(shù)學(xué)第二學(xué)期期末達(dá)標(biāo)測(cè)試試題含解析
評(píng)論
0/150
提交評(píng)論