新闻中心

EEPW首页 > EDA/PCB > 设计应用 > FPGA驱动LED静态显示和动态显示的VHDL程序

FPGA驱动LED静态显示和动态显示的VHDL程序

作者:时间:2012-05-29来源:网络收藏

  din1 : in std_logic_vector(6 downto 0); --译码后的数据信号1(4位2进制数据

  通过例1中的decoder模块译码得到din1,din2,din3,din4)

  din2 : in std_logic_vector(6 downto 0); --译码后的数据信号2

  din3 : in std_logic_vector(6 downto 0); --译码后的数据信号3

  din4 : in std_logic_vector(6 downto 0); --译码后的数据信号4

  shift: out std_logic_vector(3 downto 0); --位选信号

  bus4 : out std_logic_vector(6 downto 0)); --数据信号

  end dynamic;

  architecture Behavioral of dynamic is

  signal scan_clk:std_logic_vector(1 downto 0);

  begin

  process(clk,scan_clk,reset) --分频进程

  variable scan:std_logic_vector(17 downto 0);

  begin

  if reset='1' then

  scan:=000000000000000000;

  scan_clk=00;

  elsif clk'event and clk='1'then

  scan:=scan+1;

  end if;

  scan_clk=scan(17 downto 16);

  end process;

  process(scan_clk,din1,din2,din3,din4) --扫描进程

  begin

  case scan_clk is

  when 00=>

  bus4=din1;

  shift=0001;

  when 01=>

  bus4=din2;

  shift=0010;

  when 10=>

  bus4=din3;

  shift=0100;

  when 11=>

  bus4=din4;

  shift=1000;

  when others=> bus4=0000000;shift=0000;

  end case;

  end process;

  end Behavioral;


上一页 1 2 下一页

关键词: FPGA VHDL LED 驱动

评论


相关推荐

技术专区

关闭