《EDA16x16点阵滚动+动画显示(61页).doc》由会员分享,可在线阅读,更多相关《EDA16x16点阵滚动+动画显示(61页).doc(64页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、-四、课程设计的总体步骤1、单个字符的显示(如:黄):library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity xianshi isport( clk2:in std_logic;rck,sck:out std_logic;si:out std_logic);end ;architecture one of xianshi issignal sel:std_logic_vector(3 downto 0);signal q: std_logic_vector(31 downto 0);sign
2、al i:integer range 0 to 31;signal coi:std_logic;begin process(sel,clk1)begincase sel is when0000=qqqqqqqqqqqqqqqqnull; end case; if clk1event and clk1=1then si=q(i);i=i+1;coi=0; if i=31 then i=0;coi=1;sel=sel+1; end if; rck=not coi; end if;end process;sck=clk1;end ;时序仿真:从图中可以看出,当clk1在第32个上升沿rck变为低电频
3、,sck与clk1是同一电频,故此程序满足要求。 2、多个字符的跳动显示(如:黄小红):library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity xianshi isport( clk1:in std_logic;clk2:in std_logic;rck,sck:out std_logic;si:out std_logic);end ;architecture one of xianshi issignal lie:std_logic_vector(3 downto 0);signal se
4、l:std_logic_vector(3 downto 0);signal q: std_logic_vector(31 downto 0);signal i:integer range 0 to 31;signal coi:std_logic;begin process(sel,clk1,clk2)beginif clk2event and clk2=1 then lie case sel is when0000=qqqqqqqqqqqqqqqqnull; end case; when0001= case sel is when0000=qqqqqqqqqqqqqqqqnull; end c
5、ase; when0010= case sel is when0000=qqqqqqqqqqqqqqqqnull; end case; when others=null; end case; if clk1event and clk1=1then si=q(i);i=i+1;coi=0; if i=31 then i=0;coi=1;sel=sel+1; end if; rck=not coi; end if;end process;sck=clk1;end ; 时序仿真:从上图看出,当clk1在第32个上升沿rck变为低电频,sck与clk1是同一电频,故此程序满足要求。3、汉字的滚动和动画
6、显示(如:黄小红+笑脸):library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity xianshi isport( clk1:in std_logic;clk2:in std_logic;rck,sck:out std_logic;si:out std_logic);end ;architecture one of xianshi issignal lie:std_logic_vector(3 downto 0);signal sel:std_logic_vector(3 downto 0);
7、signal q: std_logic_vector(31 downto 0);signal i:integer range 0 to 31;signal coi:std_logic;begin process(sel,clk1,clk2)beginif clk2event and clk2=1 then lie case sel is when0000=qqqqqqqqqqqqqqqqnull; end case; when0001= case sel is when0000=qqqqqqqqqqqqqqqqnull; end case; when0010= case sel is when
8、0000=qqqqqqqqqqqqqqqqnull; end case; when0011= case sel is when0000=qqqqqqqqqqqqqqqqnull; end case; when0100= case sel is when0000=qqqqqqqqqqqqqqqqnull; end case; when0101= case sel is when0000=qqqqqqqqqqqqqqqqnull; end case; when0110= case sel is when0000=qqqqqqqqqqqqqqqnull; end case; when0111= case sel is when0000=qqqqqqqqqqqqqqqqnull; end case; when1000= case sel is when0000=qqqqqqq=00000000000000001111111111