Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Verilog Code for LED blinking

Status
Not open for further replies.

malikkhaled

Junior Member level 1
Joined
Jan 14, 2010
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
sweden
Activity points
1,447
Hi everyone,

I have an assignment to do i.e, 8 LEDs blinking one after the other on Spartan 3E board. The pattern for LEDs should be started from right most LED and continue to the left one. after one round completion it should again be started from right. I know the basics to divide clock, the question is do i need 8 different clocks to derive each LED (Total 8 LEDs are on spartan 3E). Any hint about how to start is helpful, some verilog examples codes would be appreciated.

Thanks
 

1. counter: big enough to count at the whatever clock frequency you're using to about 250-500 ms (a quarter second is more than enough to see the LEDs turned on)
2. quarter second pulse: generate a pulse at the rollover count or just compare to the counter value in the next step
3. led select counter: counts from 0-7-0... (assumes the right most LED is 0 and the left most LED is controlled by 7)
4. decoder: using the led select decode the LED enables. e.g. led_sel == 3'd1 should output LED_OE_N <= 8'b11111101;

If you want the LEDs to turn on-off then pause before the next one turns on-off. Then just make a comparison to a count value before the rollover count and use that to shut off all the LEDs, until the next led_sel updated at the rollover count.


Regards

- - - Updated - - -

You could also use a shift register for the LED outputs and just shift a 0 around the 8 outputs.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top