欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 3788|回復: 2
打印 上一主題 下一主題
收起左側

搶答器vhdl源程序

[復制鏈接]
跳轉到指定樓層
樓主
動定義為“開始”(即enable)的開關后,一排指示燈變亮,之后搶答開始,有4個扳動開關代表4個搶答器,數碼管將顯示出最先被扳動的開關的序號,同時發出聲音,表示搶答成功。若未按“開始”前,有任意開關被扳動,則數碼管顯示被扳動開關的序號,并發出另一種聲音,表示有人搶答

vhdl源程序如下:
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.ALL;
  3. use IEEE.STD_LOGIC_ARITH.ALL;
  4. use IEEE.STD_LOGIC_UNSIGNED.ALL;

  5. --  Uncomment the following lines to use the declarations that are
  6. --  provided for instantiating Xilinx primitive components.
  7. --library UNISIM;
  8. --use UNISIM.VComponents.all;

  9. entity qiangdaqi is
  10. port(enable:in std_logic;
  11.      --reset:in std_logic;
  12.           a:in std_logic;
  13.           b:in std_logic;
  14.           c:in std_logic;
  15.           d:in std_logic;
  16.           clk:in std_logic;
  17.           spkout:out std_logic;
  18.           cs:buffer std_logic_vector(1 downto 0);
  19.           --cs:buffer std_logic;
  20.           led:out std_logic_vector(7 downto 0);
  21.           seg:out std_logic_vector(3 downto 0);
  22.           segment:out std_logic_vector(7 downto 0)
  23.           );
  24. end qiangdaqi;

  25. architecture Behavioral of qiangdaqi is
  26. -- signal led1,led0:std_logic_vector(7 downto 0);
  27. signal flag:std_logic;
  28. signal output:std_logic_vector(3 downto 0);
  29. signal start:std_logic;
  30. signal index:std_logic_vector(5 downto 0);
  31. signal count: std_logic_vector(25 downto 0);
  32. signal fclk:std_logic;
  33. --signal led1:std_logic_vector(7 downto 0);

  34. component input is
  35.     port(--en:in std_logic;
  36.               clk:in std_logic;
  37.                         --reset:in std_logic;
  38.               a:in std_logic;
  39.                         b:in std_logic;
  40.                         c:in std_logic;
  41.                         d:in std_logic;
  42.                         output:out std_logic_vector(3 downto 0);
  43.                         flag:out std_logic);
  44. end component;

  45. component light is
  46.     port(--en:in std_logic;
  47.               clk:std_logic;
  48.                         input:in std_logic_vector(3 downto 0);
  49.                         flag:in std_logic;
  50.                         seg:out std_logic_vector(3 downto 0);
  51.                         ledout:out std_logic_vector(7 downto 0));
  52. end component;

  53. component control is
  54.     port(start:in std_logic;
  55.               a:in std_logic;
  56.                         b:in std_logic;
  57.                         c:in std_logic;
  58.                         d:in std_logic;
  59.                         clk:in std_logic;
  60.                         spkout:out std_logic;
  61.                         index:buffer std_logic_vector(5 downto 0)
  62.          );
  63. end component;

  64. --component lcd is
  65.    -- port(clk:in std_logic;
  66.                 --        enable:in std_logic;
  67.                 --        led:out std_logic_vector(7 downto 0);
  68.                 --        cs:buffer std_logic_vector(1 downto 0);
  69.                 --        start:out std_logic
  70. --                        );
  71. --end component;

  72. begin
  73. --cs<=cs1;
  74. --led<=led1;
  75. process(fclk,enable)
  76. begin
  77. --cs<="00";
  78. --led<="11111111";
  79.      if fclk'event and  fclk='1' then
  80.         if  enable='0' then
  81.                       cs<="01";
  82.                                 --led<="11111111";
  83.                                 if(fclk='1') then
  84.                  led<="11111110";
  85.                                 end if;
  86.                                 if(fclk='0') then
  87.                  led<="11111100";
  88.                                 end if;
  89.                                 if(fclk='1') then
  90.                  led<="11111000";
  91.                                 end if;
  92.                                 if(fclk='0') then
  93.                  led<="11110000";
  94.                                 end if;
  95.                                 if(fclk='1') then
  96.                  led<="11100000";
  97.                                 end if;
  98.                                 if(fclk='0') then
  99.                  led<="11000000";
  100.                                 end if;
  101.                                 if(fclk='1') then
  102.                  led<="10000000";
  103.                                 end if;
  104.                                 if(fclk='0') then
  105.                  led<="00000000";
  106.                                 end if;
  107.                  start <='1';
  108.                         else
  109.             start<='0';
  110.                                 cs<="00";
  111.                       --led<="11111111";
  112.                         end if;
  113.           end if;
  114. end process;

  115. process(clk)
  116. begin
  117.          if (clk'event and clk='1') then
  118.           if(count=50000000)        then
  119.             count<="00000000000000000000000000";
  120.           else
  121.                  count<=count+1;
  122.      end if;
  123.         end if;
  124. end process;

  125. fclk <= count(25);

  126. --process(fclk)
  127. --begin
  128. --if(fclk'event and fclk='1') then
  129.    --counter<="000";



  130. --process(clk,enable)
  131. --begin
  132. --if(clk'event and clk='1') then
  133.   -- if(enable'event and enable='0') then
  134.      --   cs<="01";
  135.           --   led<="11111110";
  136.           --   led<="11111100";
  137.           --   led<="11111000";
  138. ……………………

  139. …………限于本文篇幅 余下代碼請從51黑下載附件…………
復制代碼


所有資料51hei提供下載:
搶答器.rar (4.32 KB, 下載次數: 42)


分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復

使用道具 舉報

沙發
ID:260092 發表于 2017-12-11 14:20 | 只看該作者
eached for the definition of "start" (enable) the switch, a row of bright lights changed, after Responder, a four flick of a switch on behalf of four Responder, digital controls are to be shown first to be reached for the switch serial number, also issued voices saying Responder success. If the failure to "start" before it was switched on the flick, Digital Display was the flick of a switch the serial numbers, and issued another voice, someone Responder.
回復

使用道具 舉報

板凳
ID:323384 發表于 2019-6-3 12:13 | 只看該作者
真棒真棒真棒
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表