timer with or without reset?

Discussion in 'VHDL' started by jazzman519, Mar 10, 2010.

  1. jazzman519

    jazzman519

    Joined:
    Oct 15, 2009
    Messages:
    7
    This code is designed to output a square wave with freq dot(morse code) when an s is pressed on a keyboard. it is nearly working. the problem is that i have a timer that counts on the signal of the 21st bit of a counter(about 80 ms). when the 3rd bit of thr timer turns to a 1(after 240 ms) i want the dots to stop outputting. the problem is that when i put in code to say if the bit turns to a 1 then stop, it will not work at all.should i have a reset for the timer or is the code wrong?

    any help would be greatly appreciatedl.




    process(cnt(21)) --code to initialise the timer
    begin

    if cnt(21)' event and cnt(21) = '1' then
    timer <= timer + 1;

    end if;
    end process;


    process(clk)
    begin



    if clk'event and clk='1' then

    cnt <= cnt + 1;


    tone_temp <= cnt(16);
    dash_temp <= cnt(24);
    dot_temp <= cnt(22);

    end if;



    if scancode = "00011011" and clk'event and clk='1' then --scancode for letter S

    sig_dot <= tone_temp and dot_temp;

    -- dash <= cnt(24) ; --pin 4
    -- tone <= cnt(16) ; --pin 25

    while timer(2) <= '0' loop
    enable <= '1';
    end loop;
    dash <= sig_dot and enable;
    --if timer(2) <= '1' then enable <= '0' -- when this code is input it stops working


    --dash <= sig_dot and enable;


    --if timer(2) <= '1' then sig_dot <= '0';


    end if;

    -- end if;
    end process;


    process(clk)
    begin



    if scancode = "01000100" and clk'event and clk='1' then --scancode for letter O

    sig_dash <= tone_temp and dash_temp;

    if timer(3) <= '1'then
    tone <= sig_dash;

    end if;
    end if;
    end process;



    end architecture;
    jazzman519, Mar 10, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kelsang Wangchuk

    System.Timers.Timer vs. System.Threading.Timer

    Kelsang Wangchuk, Jul 31, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    707
    Kelsang Wangchuk
    Jul 31, 2003
  2. james.e.coleman@gmail.com
    Replies:
    1
    Views:
    1,579
    Steve C. Orr [MVP, MCSD]
    Feb 22, 2005
  3. Simon

    page timer, or redirect timer

    Simon, Nov 4, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    11,188
    Bruce Barker
    Nov 4, 2005
  4. Ken Varn

    How do I reset session timeout timer?

    Ken Varn, Jan 31, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    4,881
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Jan 31, 2006
  5. clusardi2k@aol.com

    Is There a C++ Timer Like the java.util.Timer

    clusardi2k@aol.com, Jul 11, 2013, in forum: C++
    Replies:
    8
    Views:
    481
    Jorgen Grahn
    Jul 15, 2013
Loading...

Share This Page