Keeping a count of user button pushes --

  • Thread starter Thread starter thisguy928
  • Start date Start date
  • Tags Tags
    Count
AI Thread Summary
To implement a user button push counter on an Altera DE2 Development Board using a 74163 counter, it is essential to incorporate an edge detector and debounce circuit to avoid counting mechanical button bounces. The counter should be fed a single pulse for each button press, which can be achieved through a one-shot circuit that generates a pulse of one clock duration. Synchronizing the asynchronous button input to the internal clock is crucial, typically done with a three flip-flop shift register for stability. The count-enable signal must only be high for one clock cycle to ensure accurate counting. Proper implementation of these components will resolve the counting issues experienced.
thisguy928
Messages
1
Reaction score
0
Hi, I'm using an Altera DE2 Development Board. I'm creating a counter that counts the number of times a user pushes a button. I'm using 74163 counter since I need to count 0-9 and I think it's easier to control. I must have it running on an internal clock. However, my counter didn't seem to be working to perfectly. when the button is pressed, P and T are true and the counter starts counting but it counts from 0-9 changing on the edge of clock. How am I able to implement this? how can I keep the single ou out count after the button is pressed and held even if the clock is 'clockkng'?
 
Last edited by a moderator:
Engineering news on Phys.org
You will need to implement an edge detector and debounce circuit before feeding the counter.

I'm assuming that you mean that you have implemented the logic of a 74163 inside of the FPGA but the same thing applies if you are using an external discrete 74163.

Edge detect & debounce are easy to implement in your FPGA.
 
You are having one of 2 problems, I think, but I'm not sure which.

Either you are feeding the button into the counter clock input, in which case you are counting the mechanical bounce of the button (like emi guy said). Or, you are feeding a clock to the counter (which what I think you are doing) and want the count-enable signal to only allow 1 count per button press. For that to happen, the count enable signal can only be 1 clock in duration.

Either way, you must first debounce the switch.

Then, you must make a 1-shot circuit that causes 1 pulse that is 1 clock in duration, for each button press, to feed to the counter's enable input. It can be tricky because you have to synchronize the asynchronous input of the button to the internal clock using a meta-stable proof double synchronizer (look it up). That can be a 3 flip-flop shift register clocked off the internal clock that is fed by a high true button press signal. You use AND gate off the Q of the 2nd flop and the QN of the third flop to feed your count-enable (if it is high true). (or you can use low true and change the output detector. Or, you can detect the trailing edge of the button press, or whatever you want.)

The signal into the shift register (or, synchronizer and pulse generator as you will) must first be debounced. You can look that part up. There are lots of ways, so research it and then ask questions.
 
Thread 'Weird near-field phenomenon I get in my EM simulation'
I recently made a basic simulation of wire antennas and I am not sure if the near field in my simulation is modeled correctly. One of the things that worry me is the fact that sometimes I see in my simulation "movements" in the near field that seems to be faster than the speed of wave propagation I defined (the speed of light in the simulation). Specifically I see "nodes" of low amplitude in the E field that are quickly "emitted" from the antenna and then slow down as they approach the far...
Hello dear reader, a brief introduction: Some 4 years ago someone started developing health related issues, apparently due to exposure to RF & ELF related frequencies and/or fields (Magnetic). This is currently becoming known as EHS. (Electromagnetic hypersensitivity is a claimed sensitivity to electromagnetic fields, to which adverse symptoms are attributed.) She experiences a deep burning sensation throughout her entire body, leaving her in pain and exhausted after a pulse has occurred...
Back
Top