在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 2274|回复: 2

[求助] 大家看下这个代码是否触发到蜂鸣器了?

[复制链接]
发表于 2015-4-18 11:32:35 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

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,结果那蜂鸣器响了,老师怀疑我不是自己做的,好郁闷。。
发表于 2015-4-18 23:07:42 | 显示全部楼层
请问你的硬件连接情况是怎么样的,蜂鸣器连接的哪些FPGA管脚,上面的代码中,哪些信号被分配至输入、输出管脚?
 楼主| 发表于 2015-4-21 21:40:56 | 显示全部楼层
回复 2# glace12123

对于器件的管脚连接我不是很清楚,因为我是这学期才接触FPGA,当时就切换了短路帽,其他的都没动啊。。
想问下触发到蜂鸣器具体是有涉及到什么代码吗??
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条


小黑屋| 手机版| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-11-23 07:02 , Processed in 0.020369 second(s), 12 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表