VHDL - Debounce-Taste Drücken

Habe ich die folgende Schaltfläche drücken Sie die Logik in meinem code. Ich habe versucht entprellung es mit einer wait-Verzögerung, aber der compiler wird nicht zulassen. Ich habe vier Taster auf meinem FPGA, das den "Schlüssel" array unten reflektiert:

process(clock)
        begin
            if rising_edge(clock) then
                if(key(3)/='1' or key(2)/='1' or key(1)/='1' or key(0)/='1') then --MY ATTEMPT AT DEBOUNCING
                    wait for 200 ns; ----MY ATTEMPT AT DEBOUNCING
                    if (key(3)='1' and key(2)='1' and key(1)='0' and last_key_state="1111" and key(0)='1') then
                        ...
                    elsif (key(3)='1' and key(2)='1' and key(1)='1' and key(0)='0' and last_key_state="1111") then  
                        ...
                    elsif (key(3)='0' and key(2)='1' and key(1)='1' and key(0)='1' and last_key_state="1111") then
                        ...
                    elsif (key(3)='1' and key(2)='0' and key(1)='1' and key(0)='1' and last_key_state="1111") then
                        ...
                    end if;
                    last_key_state<=key;
                end if;
            end if;
    end process;

Kann jemand geben einige wirklich einfache Beispiel-code zeigt, wie konnte ich debounce-ein setup, wie ich Sie schon oben?

InformationsquelleAutor John Roberts | 2013-01-30

Schreibe einen Kommentar