8421码十进制计数器

发布时间:2024-10-23

8421码十进制计数器:

LIBRARY IEEE;

USE IEEE.STD_LOGIC_1164.ALL;

USE IEEE.STD_LOGIC_UNSIGNED.ALL;

ENTITY GKY07P10 IS

PORT(clk,reset:IN STD_LOGIC;

q:OUT STD_LOGIC_VECTOR(3 DOWNTO 0));

END GKY07P10;

ARCHITECTURE struc OF GKY07P10 IS

SIGNAL q_temp:STD_LOGIC_VECTOR(3 DOWNTO 0);

BEGIN

PROCESS(clk)

BEGIN

IF(clk'EVENT AND clk='1')THEN

IF reset='1'THEN

q_temp<="0000";

ELSIF q_temp="1001"THEN

q_temp<="0000";

ELSE

q_temp<=q_temp+1;

END IF;

END IF;

END PROCESS;

q<=q_temp;

END struc;

从状态‘0000’到状态‘1001’,然后再跳回‘0000’,异步复位要立即复位。

分频器:

LIBRARY IEEE;

USE IEEE.STD_LOGIC_1164.ALL;

USE IEEE.STD_LOGIC_UNSIGNED.ALL;

ENTITY GKY07P13 IS

PORT(clk,clear:IN STD_LOGIC;

clk_out:OUT STD_LOGIC);

END GKY07P13;

ARCHITECTURE struc OF GKY07P13 IS

SIGNAL temp:INTEGER RANGE 0 TO 11;

BEGIN

p1:PROCESS(clear,clk)

BEGIN

IF clear='0' THEN

temp<=0;

ELSIF clk'EVENT AND clk='1' THEN

IF temp=11 THEN

temp<=0;

ELSE

temp<=temp+1;

END IF;

END IF;

END PROCESS p1;

p2:PROCESS(temp)

BEGIN

IF temp<6 THEN

clk_out<='0';

ELSE

clk_out<='1';

END IF;

END PROCESS p2;

END struc;

很重要的一个器件,但是设计难度并不很高,首先是模为12的计数,然后是占空比50%。

LIBRARY IEEE;

USE IEEE.STD_LOGIC_1164.ALL;

ENTITY LED IS

PORT(a:IN STD_LOGIC_VECTOR(3 DOWNTO 0);

b:OUT STD_LOGIC_VECTOR(6 DOWNTO 0));

END LED;

ARCHITECTURE LEDarch OF LED IS

BEGIN

PROCESS(a)

BEGIN

CASE a IS

WHEN"0000" => b <= "1111110"; --0

WHEN"0001" => b <= "0110000"; --1

WHEN"0010" => b <= "1101101"; --2

WHEN"0011" => b <= "1111001"; --3

WHEN"0100" => b <= "0110011"; --4

WHEN"0101" => b <= "1011011"; --5

WHEN"0110" => b <= "1011111"; --6

WHEN"0111" => b <= "1110000"; --7

WHEN"1000" => b <= "1111111"; --8

WHEN"1001" => b <= "1111011"; --9

WHEN OTHERS => b <="0000000";

END CASE; END PROCESS; END;

8421码十进制计数器.doc 将本文的Word文档下载到电脑

    精彩图片

    热门精选

    大家正在看

    × 游客快捷下载通道(下载后可以自由复制和排版)

    限时特价:7 元/份 原价:20元

    支付方式:

    开通VIP包月会员 特价:29元/月

    注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
    微信:fanwen365 QQ:370150219