Clock and Asynchronous Reset with just one pin

I have a counter chip whose output is decoded. (The 4017 Johnson decade counter). As you clock it, the output pins go high in sequence. It has an asynchronous reset.

What I want to do is the following:

Loop: * Assert the reset to make sure it starts counting at zero * De-assert the reset * Clock it 8 times goto Loop;

Now this would be a trivial exercise if I used two microcontrollers pins, but I want to use one. Yes, I know I can get a microcontroller that has more pins, but I'm doing this for the learning experience and for the enjoyment of it.

(I realise I can tie the chip's reset pin back to 9th decoder output, but I want to have software control just in case I lose sync because of interference, static, etc.)

As suggested by people here, I'm going to take the microcontroller pin and feed it into an RC circuit. The counter's clock pin will be connected directly to the microcontroller pin, but the reset pin will be connected to the output of the RC.

The idea is as follows: When I clock it very quickly from 0 V to 5 V, the output of the RC shouldn't swing above 2 V (thus it stays low and is not asserted). However, if I clock it with a greater pulse width (maybe three times the normal width), the RC voltage should swing above 3 V, ensuring that the counter gets reset.

Using the PIC16F684, the greatest clock speed I can get using internal oscillators is 8 MHz. Given this figure of 8 MHz, I'd imagine that the shortest pulse that can be put on a pin is about 1 microsecond in duration.

With my display multiplex design, (which is what I'm using the 4017 for), I keep each column lit for 200 microseconds before moving on to the next. Given that the pulses will be 1 microsecond in length, this gives me a duty cycle of 1/200 on the counter's clock.

So now I have to pick values for R and C. I have to pick them such that:

1) When a 1 microsecond pulse is applied, the voltage doesn't swing above 2 V. 2) When a 3 microsecond pulse is applied, the voltage swings above 3 V. 3) The remaining 200 microseconds must be enough for the voltage to drop to zero. (Actually, I've been thinking about this; it never really reaches zero, so will this small voltage get bigger and bigger every time the capacitor discharges?)

Now I need to pick the values for R and C. I'll go thru this step by step to see if I've got the technique right:

  • Firstly, 2 volts is equal to 40% of 5 V.
  • The time taken for an RC circuit to reach 40% of its final voltage is about 0.8 of a time constant.
  • Therefore we need 0.8 of a time constant to be less than 1 microsecond.
  • If 0.8 of a time constant is 1 microsecond, then one whole timeconstant is equal to 1.25 microseconds.
  • Of course we want the TC to be below 1.25 microseconds, so we'll decrease it by 10% to about 1.125 microseconds.
  • So that means I need a resistor and a cap, the product of whose values is 1.125e-6.
  • How do 10 nanofarads and 110 ohms sound? (By the way, is there any rationale behind making the resistor value smaller so that you can use a bigger cap (or vice versa) ?)

So I opened up Protel and made up the RC circuit with the values mentioned. I ran a simulation with a pulse width of 1 microsecond and saw that the the voltage swung up to a peak of 3 V, which I suppose isn't *too* far off my calculations. I increased the cap size to 20 nanofarads and then it swung to a peak of 2 volts. Nice.

The next thing I did was change the pulse width to 3 microseconds to see if the voltage would swing above 3 volts, and thankfully it swung right up to 4 volts.

So the loop that I wrote at the top of this post will be realised as follows:

Loop: * Pin high for 3 microseconds in order to reset the counter * Pin low for about 20 microseconds to make sure the reset drops right down to zero volts * Pin high for 1 microsecond to clock the counter * Pin low for 200 microseconds (that's how long I keep each column lit for) * Do the "clock and wait" a further 7 times. goto Loop;

So basically I'd like to ask if I'm on the right track here, i.e.: If I have a fundamental clock pulse width of one microsecond, then should I be looking at an RC circuit of about 20 nanofarads and 100 ohms?

If anyone has experience playing around with this stuff then I'd appreciate any pointers you can give me. Obviously I'll eventually get out the osciliscope and see how the waveforms look but for now theory and Protel are quite handy. :-D

Reply to
Tomás Ó hÉilidhe
Loading thread data ...

100 ohms is low for a port pin. Think Kilo-ohms and pF, rather than Ohms and nF

The 4017 has a Hi MR, so narrow pulses hi will clock, and a much wider one will reset. You do not have to constrain yourself to 20:1 ratio, go to 100:1 and you can tolerate any threshold, and any cap.

Final detail: Slow Removal of RESET on a non-schmitt pin, can do strange things, so a diode would solve that. It also means your first clock is not going to fight with a decaying reset. Slow attack is less important.

-jg

Reply to
Jim Granville

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.