UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor rompicog
Visitor
13,333 Views
Registered: ‎01-01-2013

spartan 3e starter kit led blinking in order

hi to all :)  i m new with this kit and i just simply want to blink the leds and change the blinking frequency 

can i do it with a simple code . i need a help 

thank you for instance

 

0 Kudos
9 Replies
Scholar joelby
Scholar
13,324 Views
Registered: ‎10-05-2010

Re: spartan 3e starter kit led blinking in order

I'd suggest getting hold of a book such as Pong Chu's FPGA Prototyping by Verilog Examples (or the VHDL version if you prefer) and working through the examples.

 

What have you written so far?

0 Kudos
Highlighted
Visitor rompicog
Visitor
13,308 Views
Registered: ‎01-01-2013

Re: spartan 3e starter kit led blinking in order

I've foud this code from some search on internet is working for counter to decrease the frequency and make it visible but i think this code is working on a single led but i need to first blink the leds (led0 to led7 or reverse) in order and than modify the blinking frequency. I think this code is not the thing that i need , thank you for your interest .. I need to complete it as quick as possible thank you

 

the code i've found : 

 

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity LED_Blink is
	port (
		CLK_50MHz: in std_logic;
		LED: out std_logic
	);
end LED_Blink;

architecture Behavioral of LED_Blink is
	signal Counter: std_logic_vector(24 downto 0);
	signal CLK_1Hz: std_logic;
begin

	Prescaler: process(CLK_50MHz)
	begin
		if rising_edge(CLK_50MHz) then
			if Counter < "1011111010111100001000000" then
				Counter <= Counter + 1;
			else
				CLK_1Hz <= not CLK_1Hz;
				Counter <= (others => '0');
			end if;
		end if;
	end process Prescaler;
	
	LED <= CLK_1Hz;


end Behavioral;

 

Tags (1)
0 Kudos
Scholar joelby
Scholar
13,299 Views
Registered: ‎10-05-2010

Re: spartan 3e starter kit led blinking in order

Is this a homework question? Have you asked your tutor for assistance? This forum isn't an ideal place to teach the basics of VHDL and digital design.

 

Here's how I might do it, in pseudo-code.

 

  • At reset, set output (8-bits) to 0x01 and counter to 0.
  • Every clock cycle (at 50 MHz): If counter equals 50 million, set enable=1 and counter=0. Otherwise, increment counter and set enable=0. This will give you a single clock enable pulse, once per second.
  • Every clock cycle (at 50 MHz): if enable is 1, rotate output by one bit.

At the moment you have a single output "LED". You will need an 8-bit output register, and the appropriate mapping to your LEDs in the UCF.

 

To change the speed or direction on the fly, you'll need some other input such as a switch or button. These can be used to control the counter comparison value or the direction of the rotation.

 

0 Kudos
Historian
Historian
13,285 Views
Registered: ‎02-25-2008

Re: spartan 3e starter kit led blinking in order

Well, if I was your instructor, I'd fail you for using the 

 

if Counter < "1011111010111100001000000" then

 

construct instead of declaring the Counter register as a ranged natural and also declaring the terminal count as a constant of that same type.

----------------------------Yes, I do this for a living.
0 Kudos
Visitor rompicog
Visitor
13,253 Views
Registered: ‎01-01-2013

Re: spartan 3e starter kit led blinking in order

 

To sum up my aim :

  • I m thinking to give a led_output as std_logic_vector ( 7 down to 0) and give this one by one  "10000000"  and shifting it to right so it will go like "01000000" "00100000" and ... till "00000001"

and I don't have any idea to control the blinking speed also I need a favor from someone who knows the vhdl program

0 Kudos
Explorer
Explorer
13,246 Views
Registered: ‎12-31-2012

Re: spartan 3e starter kit led blinking in order

I'm a beginner as well, your answer is in one of my posts: http://forums.xilinx.com/t5/New-Users-Forum/Advice-on-my-first-VHDL-app/td-p/283256 .  If this is a homework assignment I suggest you figure it out on your own. As someone else posted I highly recommenredialing Pong p chu's book. 

---------------------------------------------------------------------------------
I like these books:
Free Range VHDL (free), http://www.freerangefactory.org/site/pmwiki.php/Main/Books
VHDL for Logic Synthesis, Andrew Rushton
FPGA Prototyping by VHDL Examples, Pong P Chu
0 Kudos
Visitor rompicog
Visitor
13,237 Views
Registered: ‎01-01-2013

Re: spartan 3e starter kit led blinking in order

thanks a lot for advice of this book but i just have 2 days left and i'm stucked 

if someone can help i would appreciate 

ps: i can not find your answer related with my question

0 Kudos
Explorer
Explorer
13,227 Views
Registered: ‎12-31-2012

Re: spartan 3e starter kit led blinking in order

Then I hate to say it but you really are stuck if you haven't worked out that the link in my last post does indeed answer your question and that joelby already explained to you how to properly divide the clock. What you are asking to do is to build a "ring counter". Just do a google search for VHDL and "ring counter".
---------------------------------------------------------------------------------
I like these books:
Free Range VHDL (free), http://www.freerangefactory.org/site/pmwiki.php/Main/Books
VHDL for Logic Synthesis, Andrew Rushton
FPGA Prototyping by VHDL Examples, Pong P Chu
0 Kudos
Historian
Historian
13,210 Views
Registered: ‎02-25-2008

Re: spartan 3e starter kit led blinking in order


@rompicog wrote:

thanks a lot for advice of this book but i just have 2 days left and i'm stucked 

if someone can help i would appreciate 

ps: i can not find your answer related with my question


Surely there's someone at your university with whom you can discuss this?

I reiterate again: your instructor should should be willing and able to help.

----------------------------Yes, I do this for a living.
0 Kudos