|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 Ssyoung 于 2015-4-18 11:34 编辑
ENTITY SCAN_LED IS
PORT( CLK :IN STD_LOGIC;
RST :IN STD_LOGIC;
SG :OUT STD_LOGIC_VECTOR(6 DOWNTO 0);
BT :OUT STD_LOGIC_VECTOR(7 DOWNTO 0));
END SCAN_LED;
ARCHITECTURE one OF SCAN_LED IS
SIGNAL CNT8 :STD_LOGIC_VECTOR(5 DOWNTO 0);
SIGNAL A:INTEGER RANGE 0 TO 20;
BEGIN
P1: PROCESS ( CLK,CNT8,RST)
BEGIN
IF CLK'EVENT AND CLK ='1'THEN
CASE CNT8(5 DOWNTO 0) IS
WHEN "000000" => BT <= "00000001" ;A<= 16;
when "000001" => BT <= "00000010" ;A<= 18;
WHEN "000010" => BT <= "00000100" ;A<= 18;
WHEN "000011" => BT <= "00001000" ;A<= 1;
WHEN "000100" => BT <= "00010000" ;A<= 8;
WHEN "000101" => BT <= "00100000" ;A<= 18;
WHEN "000110" => BT <= "01000000" ;A<= 18;
WHEN "000111" => BT <= "10000000" ;A<= 17;
WHEN "001000" => BT <= "00000010" ;A<= 16;
WHEN "001001" => BT <= "00000100" ;A<= 18;
WHEN "001010" => BT <= "00001000" ;A<= 1;
WHEN "001011" => BT <= "00010000" ;A<= 8;
WHEN "001100" => BT <= "00100000" ;A<= 18;
WHEN "001101" => BT <= "01000000" ;A<= 17;
WHEN "001110" => BT <= "00000100" ;A<= 16;
WHEN "001111" => BT <= "00001000" ;A<= 1;
WHEN "010000" => BT <= "00010000" ;A<= 8;
WHEN "010001" => BT <= "00100000" ;A<= 17;
WHEN "010010" => BT <= "00000010" ;A<= 16;
WHEN "010011" => BT <= "00000100" ;A<= 18;
WHEN "010100" => BT <= "00001000" ;A<= 1;
WHEN "010101" => BT <= "00010000" ;A<= 8;
WHEN "010110" => BT <= "00100000" ;A<= 18;
WHEN "010111" => BT <= "01000000" ;A<= 17;
WHEN OTHERS => NULL;
END CASE;
END IF;
END PROCESS P1;
P2: PROCESS (CLK,RST)
BEGIN
IF RST='1'THEN CNT8 <="000000";
ELSIF CLK'EVENT AND CLK ='1' THEN
CNT8<= CNT8+1;
END IF;
END PROCESS P2;
P3: PROCESS( CLK,RST,A )
BEGIN
IF RST ='1'THEN SG <= "0000000";
ELSIF CLK'EVENT AND CLK ='1'THEN
CASE A IS
WHEN 0 => SG <= "0111111"; WHEN 1 => SG <= "0000110";
WHEN 2 => SG <= "1011011"; WHEN 3 => SG <= "1001111";
WHEN 4 => SG <= "1100110"; WHEN 5 => SG <= "1101101";
WHEN 6 => SG <= "1111101"; WHEN 7 => SG <= "0000111";
WHEN 8 => SG <= "1111111"; WHEN 9 => SG <= "1101111";
WHEN 10 => SG <= "1110111"; WHEN 11 => SG <= "1111100";
WHEN 12 => SG <= "0111001"; WHEN 13 => SG <= "1011110";
WHEN 14 => SG <= "1111001"; WHEN 15 => SG <= "1110001";
WHEN 18 => SG <= "1000000"; WHEN 16 => SG <= "1001110";
WHEN 17 => SG <= "1111000"; WHEN OTHERS => NULL;
END CASE;
END IF;
END PROCESS P3;
END one;
请大家帮我看看这个代码哪里触动了蜂鸣器?
ps:前几天那这个代码去测试EP3C40Q240c8,结果那蜂鸣器响了,老师怀疑我不是自己做的,好郁闷。。 |
|