×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

push button suggestions

push button suggestions

push button suggestions

(OP)
A question for those with more experience.

I am implementing a single push button circuit that will select an output (and light a LED). It will toggle between 4 possible choices. It is an active low. I tried to use something like “1110” and shifting with rol. I also tried a straight up if/then counter setup. My question is what would you use? Any suggestions for something better (more elegant, less logic)?

RE: push button suggestions

I would go for the shift register:


  if (reset = '1') then
        
    leds <= "1110";
    
  elsif (push_button'event AND push_button = '1') then
            
    leds <= leds(2 downto 0) & leds(3);
            
  end if;


This VHDL only uses four FF's. This means only two slices in a Virtex 4 device. That's 0.008%!!!

There's also no asynchronous logic what so ever, which means very good timing.

The only problem could be the button noise, which would create several events at one push. This off course can be solved by oversampling.

Bert

RE: push button suggestions

(OP)
Yep, I decided to design several ways and compare. I figured this would be the best way to learn. Yours is more efficient than mine. I was also going asynchronous. I like yours better. Also no problem with the button noise. I had some extra nand gates on the board and used them for debounce. Thanks much.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close