文档详情

实验五数字电路系统实验.docx

发布:2018-05-14约1.23千字共3页下载文档
文本预览下载声明
实验五 数字电路系统实验——设计一个方波信号输出电路一、实验目的1.设计一个方波信号产生电路,并在实验装置上验证所设计的电路;2.建立自顶向下的设计思路。二、实验要求设计一个占空比为20%、周期为1S的方波信号,并用末位数码管进行指示——当方波信号为高电平时,数码管显示2;当方波信号为低电平时,数码管显示8。三、实验方案占空比为20%,周期为1S的方波,可分为0.2S的高电平和0.8S的低电平;可设计一个计数器,当计数值小于999999输出高电平,当计数值大于999999小于4999999输出低电平,大于4999999后清零重新计时。数码管显示模块用组合逻辑电路组成,当分频计数器高电平时输出数码“2”,低电平时输出数码管“8”。四、实验步骤1.建立新的工程2.建立计数分频结构div.vhdlibrary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity div isport(clk:in std_logic;divout:out std_logic;public:out std_logic);end;architecture one of div issignal cnt:std_logic_vector(9 downto 0);signal clk_temp:std_logic;constant m:integer:=1000;--1M divbeginprocess(clk)variable s:std_logic;beginif clk event and clk=1 then--上升沿if cnt=m thenclk_temp=not clk_temp;cnt=(others=0);elsecnt=cnt+1;--计数clk_temp=clk_temp;--反转end if;end if;divout=clk_temp;s:=1;public=s;end process;end;3.建立数码管显示结构:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity LED isport(number:in std_logic; ledout:out std_logic_vector(7 downto 0));end;architecture u1 of LED isbeginwith number selectledouthen1,--高电平显示“2hen0;--低电平显示“8”end;4.顶层设计中将分频计数实体和数码管显示实体相连接;5.配置引脚,编译下载。五、实验结果下载完成后,可以看到数码管交替显示“2” “8”,周期大约为1S。
显示全部
相似文档