今天一早来了没事干,就先完成第一个任务吧,跑马灯跑起来……
程序是用VHDL写的比较简单
附上吧
ARCHITECTURE BEHVER OF EP2C5Q208 IS
SIGNAL COUNT: INTEGER RANGE 0 TO 10000;
SIGNAL COUNT1: INTEGER RANGE 0 TO 100000;
SIGNAL TRIG: STD_LOGIC;
SIGNAL MARK: STD_LOGIC;
BEGIN
mser:PROCESS(CLK)
BEGIN
IF ( CLK = '1' AND CLK'EVENT ) THEN
CASE COUNT1 IS
WHEN 8000 => COUNT1 <= 0;
TRIG <= '1';
WHEN OTHERS => COUNT1 <= COUNT1 + 1;
TRIG <= '0';
END CASE;
END IF;
END PROCESS;
BLINK:PROCESS(CLK)
BEGIN
IF ( TRIG = '1' AND TRIG'EVENT ) THEN
CASE COUNT IS
WHEN 1000 => COUNT <= COUNT + 1 ;
LED_BUS <= "01111111";
WHEN 2000 => COUNT <= COUNT + 1 ;
LED_BUS <= "10111111";
WHEN 3000 => COUNT <= COUNT + 1 ;
LED_BUS <= "11011111";
WHEN 4000 => COUNT <= COUNT + 1 ;
LED_BUS <= "11101111";
WHEN 5000 => COUNT <= COUNT + 1 ;
LED_BUS <= "11110111";
WHEN 6000 => COUNT <= COUNT + 1 ;
LED_BUS <= "11111011";
WHEN 7000 => COUNT <= COUNT + 1 ;
LED_BUS <= "11111101";
WHEN 8000 => COUNT <= 0 ;
LED_BUS <= "11111110";
WHEN OTHERS => COUNT <= COUNT + 1 ;
END CASE;
END IF;
--LED_BUS <= SW_BUS;
END PROCESS;
END ARCHITECTURE;