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

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 3636|回復: 2
收起左側

搶答器vhdl源程序

[復制鏈接]
ID:260092 發表于 2017-12-11 14:18 | 顯示全部樓層 |閱讀模式
動定義為“開始”(即enable)的開關后,一排指示燈變亮,之后搶答開始,有4個扳動開關代表4個搶答器,數碼管將顯示出最先被扳動的開關的序號,同時發出聲音,表示搶答成功。若未按“開始”前,有任意開關被扳動,則數碼管顯示被扳動開關的序號,并發出另一種聲音,表示有人搶答
0.png
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)


回復

使用道具 舉報

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 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 久久91| 亚洲欧美中文日韩在线v日本 | 欧美久久久久久久久 | 国产一区二区三区在线视频 | 国产精品久久久久久久久久久久久 | 大学生a级毛片免费视频 | 精品久久久久久久久久久 | 精品国产欧美一区二区三区成人 | 毛片软件| 91免费在线| 久久久久成人精品 | 一区二区三区在线播放视频 | 午夜99| 亚洲综合视频 | 国产精品久久久久久久久久久久午夜片 | 少妇一区二区三区 | 久草网址| 成人av一区| 久久精品国产清自在天天线 | 日本精品一区二区三区在线观看视频 | 99精品99久久久久久宅男 | 国产精品久久久久不卡 | 超碰激情 | 日本黄色一级片视频 | 新超碰97 | 二区在线观看 | 荷兰欧美一级毛片 | 一级黄色片一级黄色片 | 日本成人福利视频 | 一区二区三区四区日韩 | 7777久久 | 欧美日韩一区二区在线播放 | 国产日韩精品在线 | 国产日韩欧美在线观看 | 日本高清中文字幕 | 国内精品久久久久久影视8 最新黄色在线观看 | 网站国产 | 亚洲一区精品在线 | 欧美日韩国产一区二区三区 | 天天综合国产 | 久久中文视频 |