微處理器 - Altera MAX II EPM240T100C5N - VHDL - LED



main.vhd

library ieee;
use ieee.std_logic_1164.all;
   
entity main is
    port(
        clk : in std_logic;
        led : out std_logic
    );
end main;
   
architecture logic of main is
    signal val: std_logic;
    signal clk_cnt : integer := 0;
   
begin
    process(clk) is
    begin
        if (clk'event and clk = '1') then
            clk_cnt <= clk_cnt + 1;
 
            if (clk_cnt = 25000000) then
                clk_cnt <= 0;
                led <= val;
                val <= not val;
            end if;
        end if;
    end process;
end logic;

開啟Quartus Prime


New Project Wizard


Empty Project


加入main.vhd


選擇型號


Next


電路合成


編輯腳位



編譯


Programmer


選擇Start



完成