发布时间 : 星期一 文章2进制-10进制(BCD码)数码转换器设计更新完毕开始阅读45930f9bd4d8d15abe234ea8
武汉理工大学《能力拓展训练》课程设计说明书
具体程序语言如下: library ieee;;
use ieee.std_logic_1164.all;
use ieee std_logic_unsigned.all; use ieee std_logic_arith.all; entity seltime is port(
clk2: std_logic;
y0,y1,y2:IN std_logic _vector(3 downto 0); daout:out std_logic _ ector(3 downto 0); sel: out std_logic _ vector(2 downto 0)); end;
architecture fun seltime is
signal count: std_logic _ vector(2 downto 0); begin sel<=count; process(clk2) begin
if clk 2'event and clk2='1')then if(count>=\ count<=\ else
count<=count+1; end if; end if; case count is
when\ when \ when\
8
武汉理工大学《能力拓展训练》课程设计说明书
when others=>daout<=\ end case end process end fun;
3.4输出到数码管
原理图如图3-4所示:
DELEDNUM[3..0]ABCDEFGDPOUTPUTOUTPUTOUTPUTOUTPUTOUTPUTOUTPUTOUTPUTABCDEFGinst3图3-4输出到二极管原理图
具体程序语言如下: library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity deled is
port(num:IN std_logic_vector(3 downto 0); A:OUT std_logic; B:OUT std_logic; C:OUT std_logic; D:OUT std_logic; E:OUT std_logic; F:OUT std_logic; G:OUT std_logic; DP:OUT std_logic );
9
武汉理工大学《能力拓展训练》课程设计说明书
END DELED;
ARCHITECTURE fun OF DELED IS signal led:std_logic_vector(6 downto 0); BEGIN A<=led(6); B<=led(5); C<=led(4); D<=led(3); E<=led(2); F<=led(1); G<=led(0); DP<='0';
led<=\ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\——把每一位输出用二极管显示 END fun;
10
武汉理工大学《能力拓展训练》课程设计说明书
3.5显示位数
原理图如图3-5所示:
decode3_8SEL[2..0]Q[7..0]OUTPUTselout[7..0]inst2图3-5显示位数原理图
具体程序语言如下: LIBRARY ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; ENTITY decode3_8 IS
PORT(SEL:IN std_logic_vector(2 downto 0); Q :OUT std_logic_vector(7 downto 0) ); END decode3_8;
ARCHITECTURE a OF decode3_8 IS BEGIN
Q<=\ \ \ \ END a;
整个设计完成。
11