[elektro] VHDL kezdo
Moczik Gabor
pm_levlista at progzmaster.hu
Thu Jan 24 16:46:30 CET 2008
Csiszlér Gergely wrote:
> Számolj egy kicsit utána az átfordulási időnek. Az adatok alapján több
> másodperc így hirtelen számolva.
Hat ezaz, szep lassan kene villognia a LED-nek...
Egyebkent az alabbi lenne az eredeti feladat (nyomogomb prellmentesites),
csak mar leegyszerusitettem erre a LED villogtatasra hogy megtudjam mi a
hiba. Abszolut nem jo, mintha nem is lenne prellmentesites.
entity xv is
Port ( LED : out std_logic;
btn : in std_logic;
clk : in std_logic
);
end xv;
architecture behavioral of xv is
signal deb_cnt :std_logic_vector(20 downto 0);
signal led_state :std_logic:='1';
signal debounced_btn :std_logic:='0';
begin
process(clk,btn)
begin
if clk'event and clk='1' then
if btn='0' and debounced_btn='0' then
deb_cnt <= deb_cnt + '1';
debounced_btn <= deb_cnt(20) and deb_cnt(19);
end if;
if btn='1' then
deb_cnt <= (others => '0');
debounced_btn <= '0';
end if;
end if;
end process;
process(debounced_btn)
begin
if debounced_btn'event and debounced_btn='1' then
led_state <= not led_state;
end if;
end process;
LED <= led_state;
end behavioral;
--
((( Móczik Gábor )))--((( E~Mail: pm-junk ~@~ progzmaster ~.~ hu )))
((( Skype: moczik )))
More information about the Elektro
mailing list