Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

push button suggestions

Status
Not open for further replies.

BadTime

Technical User
Jun 11, 2007
2
US
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)?
 
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
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top