(FPGA) LCMXO2-400HC (小脚丫STEP-MXO2第二代) >> VHDL
Button
參考資訊:
1. basic
程式如下:
library ieee; use ieee.std_logic_1164.all; entity main is port( btn: in bit; led: out bit_vector(7 downto 0)); end main; architecture logic of main is signal cnt:bit_vector(7 downto 0):="11111110"; begin process(btn) is begin if (btn'event and btn = '0') then cnt<= cnt rol 1; end if; end process; led<= cnt; end logic;
觸發條件為btn的正緣訊號,接著依序點亮LED
腳位
完成