Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > LED Flashing

Reply
Thread Tools

LED Flashing

 
 
XRay123 XRay123 is offline
Junior Member
Join Date: Mar 2010
Posts: 6
 
      03-11-2010
Hey there.
I'm pretty new at VHDL and I've been banging my head all day long on this code but it doesn't work in any way.
The program should flash led B.

Code:
entity Flash is
	Port(
	A,B : out STD_LOGIC;
	clk: in STD_LOGIC;
	led_val: out STD_LOGIC_VECTOR(7 downto 0):="00000000");
end Flash;

architecture Behavioral of Flash is
signal clk_slow: STD_LOGIC;
signal clk_divider: STD_LOGIC_VECTOR(24 downto 0):= "0000000000000000000000000";
signal temp_val: STD_LOGIC_VECTOR(7 downto 0):="00000000";
begin
	clk_division : process(clk, clk_divider)
		begin
			if rising_edge(clk) then
				clk_divider <= clk_divider + 1;
			end if;
			clk_slow <= clk_divider(24);
		end process;
	moving : process(clk_slow,temp_val)
	begin
			if rising_edge(clk_slow) then
			temp_val <= temp_val + 1;
			end if;
         led_val<=temp_val;
	end process;
	light : process
	begin
		if temp_val(7)='1' then
		A <= '1';
		B <= '1';
		end if;
		if temp_val(7)='0' then
		B <= '0';
		end if;
	end process;
end Behavioral;
A and B are LEDS and clk is assigned to the 50 Mhz on-board oscillator.
Hope somebody can give me any tips why the code doesn't work.
Thanks in advance.
 
Reply With Quote
 
 
 
 
jeppe jeppe is offline
Senior Member
Join Date: Mar 2008
Location: Denmark
Posts: 348
 
      03-12-2010
Code:
architecture Behavioral of Flash is
signal clk_slow: STD_LOGIC;
signal clk_divider: STD_LOGIC_VECTOR(24 downto 0):= "0000000000000000000000000";
signal temp_val: STD_LOGIC_VECTOR(7 downto 0):="00000000";
begin
	clk_division : process(clk, clk_divider)
		begin
			if rising_edge(clk) then
				clk_divider <= clk_divider + 1;
			end if;
			clk_slow <= clk_divider(24);
		end process;
	moving : process(clk_slow,temp_val)
	begin
			if rising_edge(clk_slow) then
			temp_val <= temp_val + 1;
			end if;
         led_val<=temp_val;
	end process;

	light : process( temp_val)
	begin
		if temp_val(7)='1' then
		A <= '1';
		B <= '1';
		end if;
		if temp_val(7)='0' then
		B <= '0';
		end if;
	end process;
end Behavioral;
 
Reply With Quote
 
 
 
 
XRay123 XRay123 is offline
Junior Member
Join Date: Mar 2010
Posts: 6
 
      03-21-2010
The Synthesizer issued a warning about the missing signal in the sensitivity list but "will assume that all necessary signals are present in the sensitivity list. " Seems like my problem originated in a misassigned pin. Still, thanks for your time and your help.
 
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
page flashing.. EMW ASP .Net 5 05-30-2004 06:41 PM
1600 ok LED flashing Chris G. Cisco 1 05-24-2004 08:42 AM
flashing text in ASP.NET DzemoT. ASP .Net 2 03-01-2004 02:21 PM
LED there be Light, a D.I.Y. LED ringlight E Pericoloso Sporgersi Digital Photography 18 08-19-2003 03:22 PM
how to avoid "flashing" when I reload (in a frame) pepsi ASP .Net 0 06-25-2003 04:41 PM



Advertisments