用VHDL语言设计555压控振荡器测频率
《用VHDL语言设计555压控振荡器测频率》由会员分享,可在线阅读,更多相关《用VHDL语言设计555压控振荡器测频率(7页珍藏版)》请在装配图网上搜索。
1、【精品文档】如有侵权,请联系网站删除,仅供学习与交流用VHDL语言设计555压控振荡器测频率.精品文档.实验五 利用压控振荡器测量电压一、实验目的(1)以555定时器为基础设计压控振荡器(2)设计一个具有如下功能的简易频率计。 1. 可以测量压控振荡器产生的频率,用4位数码管显示 2.测量结果直接用十进制数值显示 3. 被测信号是压控振荡器产生的方波脉冲信号,根据设计的压控振荡器确定电压值 4. 具有超量程警告(可以用 LED 灯显示)二、实验设备与器材(1)计算机:Quartus 16.0软件;(2)硬件:Cyclone DE0-CV FPGA开发平台、555定时器、电阻、电容、可变电阻三、
2、利用Multisim搭建仿真电路四、实验程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;- 计数器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) - 定义变量 - 0是对数组cqi所有元素赋值0 if
3、 rst=1 then cqi :=(others =0); elsif fxevent and fx=1 then 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: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,cou
4、t=e(2),outy=d(11 downto 8);u4:cnt10 port map(fx=e(2),rst=rst,ena=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(
5、15 downto 0);ena,clk:in std_logic;q:out std_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 锁存上次的数据 elsif clkevent and clk=1 then cqi:=d;-clk=1&ena=1 计入新数据 end if; q=cqi; end p
6、rocess;end one;- 报警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 锁存上次的数据 els
7、if clkevent and clk=1 then cqi:= not cqi;-clk=1&ena=1 计入新数据 end 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);e
8、nd control;architecture behv of control isbegin process (clk) variable 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 p
9、ort (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 clkevent and clk=1 then cout:=cout+1; if cout=m then tmp=0; elsif coutm*2 then tmp=1; else cout:=0; en
10、d if; end if; end process;clk_outclk,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=h);u5: led_controller port map(d(3 downto 0)=h(3 downto 0),a(6 downto 0)=leds(6 d
11、ownto 0);u6: led_controller port map(d(3 downto 0)=h(7 downto 4),a(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的频率数)
- 温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 届高考英语复习课件:专题一-名词和冠词
- 动物微生物_第八章免疫学基础理论课件
- 届高考语文一轮教学课件文言断句和翻译
- 届高考英语一轮复习考案选修7-Unit-4课件
- 槟榔的危害课件
- 动物疾病诊疗过程-兽医学概论(动物科学专业使用)课件
- 届高考英语一轮复习考案必修2-Unit-4课件
- 发动机进气系统故障课件
- 届高考英语二轮专题复习(湖南专用)阅读简答课件
- 常见酿酒葡萄品种简绍课件
- 届高考英语高效备考复习阅读理解微技能与新题型特训13课件
- 部编版小学语文二年级上册知识总结复习ppt课件全册
- 材料成形装备及自动化课件
- 届高考英语一轮复习学通语法教学课件-第-讲-动词的时态和语态-新人教版
- 厄尔尼诺和拉尼娜ppt课件