Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > timer with or without reset?

Reply
Thread Tools

timer with or without reset?

 
 
jazzman519 jazzman519 is offline
Junior Member
Join Date: Oct 2009
Posts: 7
 
      03-10-2010
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;
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I know about the shutdown timer, is there a "switch on" timer... Mal Carter Computer Support 3 01-12-2008 01:58 AM
page timer, or redirect timer Simon ASP .Net 1 11-04-2005 07:14 PM
System.Timers.Timer/System.Threading.Timer Not Firing At All on Dev Server james.e.coleman@gmail.com ASP .Net 1 02-22-2005 09:41 PM
Waiting until timer without cpu crash? Alessandro Giambruno Java 9 06-22-2004 09:44 PM
System.Timers.Timer vs. System.Threading.Timer Kelsang Wangchuk ASP .Net 0 07-31-2003 04:28 PM



Advertisments