Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8176773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:19:26+00:00 2026-06-06T23:19:26+00:00

So I’m new to Verilog and CPLDs. I wrote some code that turns on

  • 0

So I’m new to Verilog and CPLDs. I wrote some code that turns on an LED, and now I would like to have it blinking.

module LEDON(LED);    

    output LED;

    reg LED;

    always 
    begin
        LED=1'b1;
    end
 endmodule

So how do I add a delay that will allow me to see the LED coming on and off? I’ve read tha tI have to slow down the clock speed using flip flops, but I’m not quite sure what this means.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:19:29+00:00Added an answer on June 6, 2026 at 11:19 pm

    You don’t have to slow down the clock frequency. What you want to do is to make a counter that toggles the LED after so many clock cycles.

    If you have a 1MHz clock, and you want to toggle the led once per second, then do something like this

    reg [31:0] count;
    reg        led_state;
    wire count_max = 32'd1_000_000;
    
    
    assign count_nxt = (count >= count_max) ? 32'd0 : count + 32'd1;
    assign led_state_nxt = (count == count_max) ? ~led_state : led_state;
    
    always @(posedge clk)
    begin
        count <= count_nxt;
        led_state <= led_state_nxt;
    end
    

    Basically this is just a free running counter, and every time it hits a certain value, it toggles the led_state and resets itself.

    You’ll have to adjust the value of the count_max based on your desired blink rate and clock frequency.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
I have just tried to save a simple *.rtf file with some websites and
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
this is what i have right now Drawing an RSS feed into the php,
I would like to run a str_replace or preg_replace which looks for certain words
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.