用VHDL语言设计555压控振荡器测频率

上传人:无*** 文档编号:93089539 上传时间:2022-05-19 格式:DOC 页数:9 大小:925KB
收藏 版权申诉 举报 下载
用VHDL语言设计555压控振荡器测频率_第1页
第1页 / 共9页
用VHDL语言设计555压控振荡器测频率_第2页
第2页 / 共9页
用VHDL语言设计555压控振荡器测频率_第3页
第3页 / 共9页
资源描述:

《用VHDL语言设计555压控振荡器测频率》由会员分享,可在线阅读,更多相关《用VHDL语言设计555压控振荡器测频率(9页珍藏版)》请在装配图网上搜索。

1、 实验五利用压控振荡器测量电压一、实验目的(1)以555定时器为基础设计压控振荡器(2)设计一个具有如下功能的简易频率计。 1. 可以测量压控振荡器产生的频率,用4位数码管显示 2.测量结果直接用十进制数值显示 3. 被测信号是压控振荡器产生的方波脉冲信号,根据设计的压控振荡器确定电压值 4. 具有超量程警告(可以用 LED 灯显示)二、实验设备与器材(1)计算机:Quartus 16.0软件;(2)硬件:Cyclone DE0-CV FPGA开发平台、555定时器、电阻、电容、可变电阻三、利用Multisim搭建仿真电路四、实验程序library ieee;use ieee.std_logi

2、c_1164.all;use ieee.std_logic_unsigned.all;- 计数器entity t10 is port (rst,fx,ena:in std_logic; cout: out std_logic; outy :out std_logic_vector(3 downto 0);end t10;architecture behv of t10 isbegin process (rst,ena,fx) - 定义变量 - 0是对数组cqi所有元素赋值0 if rst=1 then cqi :=(others =0); elsif fxevent and fx=1 then

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

4、=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_logic_vector(15 down

5、to 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 锁存上次的数据 elsif clkevent and clk=1 then cqi:=d;-clk=1&ena=1 计入新数据 end if; q=cqi; end process;end one;- 报警led hehelibrary ieee;use ieee.std_logic_1164.

6、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 锁存上次的数据 elsif clkevent and clk=1 then cqi:= not cqi;-clk=1&ena=1 计入新数据 end

7、if; q a a a a a a a a a a a a a a a a null; end case; end process;end;- 控制模块(每隔一次clk,就翻转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 control isbegin process (clk) va

8、riable cqi :std_logic_vector(2 downto 0); begin if clkevent and clk=1 then if cqi 1 then cqi:=cqi+1;ena=1;rst0); ena=0;rst=1; end if; end if; end process;end behv;- 时钟(1hz)发生器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;arch

9、itecture fwm of freq_div isconstant m: integer:= 25000;signal tmp:std_logic;begin process(clk,tmp) variable cout:integer:=0; begin if clkevent and clk=1 then cout:=cout+1; if cout=m then tmp=0; elsif coutm*2 then tmp=1; else cout:=0; end if; end if; end process;clk_outclk,clk_out=clk_base);u2: contr

10、ol port map(clk=clk_base,ena=x,rst=z);u3: t10_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=h);u5: led_controller port map(d(3 downto 0)=h(3 downto 0),a(6 downto 0)=leds(6 downto 0);u6: led_controller port map(d(3 downto 0)=h(7 downto 4),a

11、(6 downto 0)=leds(13 downto 7);u7: led_controller port map(d(3 downto 0)=h(11 downto 8),a(6 downto 0)=leds(20 downto 14);u8: led_controller port map(d(3 downto 0)=h(15 downto 12),a(6 downto 0)=leds(27 downto 21);ledout=leds;end;-引脚配置说明:- port(clk:in std_logic;- fx:in std_logic;- ledout:out std_logic_vector(27 downto 0);- 数码管7*4clk五、实验结果1、搭建555实际电路2、用示波器测量实际电路的频率和电压:3、用已经下载了程序的开发板来测量实际电路的频率(由于开发板的数码管最后一个一直不稳定,所以把原本应该是最后一个的管脚绑到了第一个管脚,读频率的时候第一个数是个位,第二个数是千位,第三个数是百位,第四个数是十位;读出来的频率数乘以十就是单位为Hz的频率数)9 / 9

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!