LED Flashing

Discussion in 'VHDL' started by XRay123, Mar 11, 2010.

  1. XRay123

    XRay123

    Joined:
    Mar 11, 2010
    Messages:
    6
    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.
    XRay123, Mar 11, 2010
    #1
    1. Advertising

  2. XRay123

    jeppe

    Joined:
    Mar 10, 2008
    Messages:
    348
    Location:
    Denmark
    Try this

    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;
    jeppe, Mar 12, 2010
    #2
    1. Advertising

  3. XRay123

    XRay123

    Joined:
    Mar 11, 2010
    Messages:
    6
    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.
    XRay123, Mar 21, 2010
    #3
    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. network lines

    VHDL code to light up LED???

    network lines, May 25, 2004, in forum: VHDL
    Replies:
    8
    Views:
    8,489
    Symon
    May 27, 2004
  2. Flemming Hansen

    LED decoder with CoolRunner II

    Flemming Hansen, Jan 9, 2006, in forum: VHDL
    Replies:
    5
    Views:
    1,593
    Mike Treseler
    Jan 23, 2006
  3. semagraw@gmail.com

    Mouse LED Control in Python

    semagraw@gmail.com, Jul 30, 2006, in forum: Python
    Replies:
    1
    Views:
    552
    Chris Lambacher
    Jul 31, 2006
  4. =?iso-8859-1?q?J=FCrgen_Gerstacker?=

    A swing/awt component that looks like a LED

    =?iso-8859-1?q?J=FCrgen_Gerstacker?=, Dec 15, 2006, in forum: Java
    Replies:
    2
    Views:
    1,045
    =?iso-8859-1?q?J=FCrgen_Gerstacker?=
    Dec 17, 2006
  5. Amit

    string recognize and led

    Amit, Nov 8, 2007, in forum: VHDL
    Replies:
    1
    Views:
    370
Loading...

Share This Page