CUGB-SOPC常用外围器件连线图

  • 格式:doc
  • 大小:152.50 KB
  • 文档页数:7

CUGB-SOPC常用外围器件连线图
注意事项:
1、特别注意:在做Quartus II工程时必须将未分配的管脚置为三态输入。

Quartus II --> Assignments --> Device… --> Device --> Device & Pin Options…--> Unused Pins --> Reserve all unused pins : AS input tri-stated。

2、按键S1—S8与LED指示灯LED1—LED8
3、系统复位与系统时钟(50MHz )
4、蜂鸣器
5、7段数码管
6、
7、
8、对EP3C25-B型电路板的LED与按键测试程序如下:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity KEY_LED_SEG_BEEP is
port (
-- inputs:
signal key : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
signal clk : IN STD_LOGIC;
-- outputs:
signal speaker : OUT STD_LOGIC;
signal led_light_control : OUT STD_LOGIC;
signal led_light : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
signal seg_choose : OUT STD_LOGIC_VECTOR(3 DOWNTO 0) );
end entity KEY_LED_SEG_BEEP;
architecture test of KEY_LED_SEG_BEEP is
signal speaker_output : STD_LOGIC:='0';
signal key_input : STD_LOGIC_VECTOR(7 DOWNTO 0);
begin
PROCESS(clk)
V ARIABLE NUM1:integer range 0 to 65535;
begin
if rising_edge(clk) then
NUM1:=NUM1+1;
if NUM1=0 then
--led_light<="11111111";
case key_input is
--ABCDEFGH=64310572
when "11111110"=>led_light<="11100111";--1
when "11111101"=>led_light<="00101100";--2
when "11111011"=>led_light<="00100101";--3
when "11110111"=>led_light<="01000111";--4
when "11101111"=>led_light<="00010101";--5
when "11011111"=>led_light<="00010100";--6
when "10111111"=>led_light<="10100111";--7
when "01111111"=>led_light<="00000100";--8
when others =>led_light<="11111111";
end case;
end if;
if NUM1>0 and NUM1<42767 then
seg_choose<="1111";
end if;
if NUM1=42767 then
seg_choose<="0000";
end if;
if NUM1=50000 then
led_light<=key_input;
end if;
if NUM1>50000 and NUM1<60000 then
led_light_control<='1';
end if;
if NUM1=60000 then
led_light_control<='0';
end if;
end if;
end process;
process(clk)
V ARIABLE NUM2:integer range 0 to 16383; begin
if rising_edge(clk) then
NUM2:=NUM2+1;
if NUM2>=16383 then
NUM2:=0;
speaker_output<=not speaker_output;
if key_input/="11111111" then
speaker<=speaker_output;
else
speaker<='0';
end if;
end if;
end if;
end process;
key_input<=key;
end test;
管脚分配如下图:。