手机版

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文档下载到电脑,方便复制、编辑、收藏和打印
    ×
    二维码
    × 游客快捷下载通道(下载后可以自由复制和排版)
    VIP包月下载
    特价:29 元/月 原价:99元
    低至 0.3 元/份 每月下载150
    全站内容免费自由复制
    VIP包月下载
    特价:29 元/月 原价:99元
    低至 0.3 元/份 每月下载150
    全站内容免费自由复制
    注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
    × 常见问题(客服时间:周一到周五 9:30-18:00)