Dr Jefyll wrote:
The clock generator shown below inverts its output every time the button is pressed. (IOW two presses results in one clock cycle.)
Attachment:
File comment: Jeff's No-Bounce Switch Circuit
bounceless_switch.png [ 3.8 KiB | Viewed 973 times ]
Nice circuit, Jeff. The electronics industry will be quite miffed with you for using so few parts to get the job done and thus negatively affecting profits.
One note, the WDC version of the 65C02 and the 65C816 tend to be somewhat fussy about the clock signal quality. I would be inclined to use a 74AC14 in place of the HC14 to get a sharper pulse rise and fall time.
If your Ø2 clock generator circuit runs the oscillator through a flip-flop, as is the case with my POC units, Jeff's circuit will require four pushes of the button to take the MPU through one complete clock cycle. If for some strange reason, you don't feel like doing that much button-pushing, you could rig up the below circuit to toggle the flop's
CLK input.
Attachment:
File comment: Clock Pulser Circuit
clock_pulser.gif [ 5.37 KiB | Viewed 973 times ]
Following power-on, the above circuit will pull
CLK low (note, a brief excursion to high will occur at power-on). When the push button is pressed and held,
CLK will go high and stay there until the push button is released (R1 limits the discharge current to a safe level when C1 is shorted by the push button). When the push button is released C1 will charge to
Vcc via R2 and eventually the voltage at C1 will go high enough to change the Schmitt's output state, causing
CLK to go low again. The time-constant of C1 and R2 is 0.1 seconds, so adequate debouncing should be produced. If your hands are real shaky from drugs, old age (my excuse) or both (also my excuse), you can increase C1 and/or R2 to increase the time-constant and thus further delay the change of state when the push button is released.
As
CLK does one high/low sequence with each press-and-release of the push button, the flop's
Q output will make one transition per push button press (flops normally respond to a high-going input at
CLK, so the high-to-low change at
CLK doesn't affect
Q). Hence, the MPU will be taken through one full clock cycle with two press-and-release push button operations.