久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 3607|回復(fù): 2
打印 上一主題 下一主題
收起左側(cè)

搶答器vhdl源程序

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:260092 發(fā)表于 2017-12-11 14:18 | 只看該作者 |只看大圖 回帖獎勵 |倒序瀏覽 |閱讀模式
動定義為“開始”(即enable)的開關(guān)后,一排指示燈變亮,之后搶答開始,有4個扳動開關(guān)代表4個搶答器,數(shù)碼管將顯示出最先被扳動的開關(guān)的序號,同時發(fā)出聲音,表示搶答成功。若未按“開始”前,有任意開關(guān)被扳動,則數(shù)碼管顯示被扳動開關(guān)的序號,并發(fā)出另一種聲音,表示有人搶答

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黑下載附件…………
復(fù)制代碼


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


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

使用道具 舉報

沙發(fā)
ID:260092 發(fā)表于 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.
回復(fù)

使用道具 舉報

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

使用道具 舉報

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

本版積分規(guī)則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機教程網(wǎng)

快速回復(fù) 返回頂部 返回列表
主站蜘蛛池模板: 午夜影院毛片 | 国产激情视频网站 | 色爱综合网 | 国产一区在线免费 | 午夜爽爽爽男女免费观看 | 亚洲最新在线 | 欧美精品在线免费观看 | 91精品国产综合久久久密闭 | 国产美女h视频 | 99精品在线观看 | 日韩免费在线视频 | 一级黄色毛片 | 97av在线 | 亚洲免费成人 | 91精品国产91久久久久久密臀 | 欧美日在线 | 3级毛片| 日韩精品在线免费 | 国产成人福利视频在线观看 | 亚洲三区在线观看 | 日本不卡一区二区三区在线观看 | 91免费在线看 | 日本五月婷婷 | 成人免费视频 | 欧美日韩亚洲国产 | 日本久久精品视频 | 国产精品久久国产精品久久 | 亚洲精品久久久蜜桃网站 | 久久av.com | 欧美日韩亚洲一区 | 久久精品一区 | 成在线人视频免费视频 | 97人人澡人人爽91综合色 | 91精品国产综合久久久动漫日韩 | 日本电影一区二区 | 亚洲国产福利视频 | 日韩一区二区久久 | av中文字幕在线播放 | 国产日韩精品视频 | 国产精品成人在线播放 | 欧美久操网 |