How to shift clock by 90 degrees?

Thread Starter

daviddeakin

Joined Aug 6, 2009
207
Hi,
I am messing about with a simple logic circuit at fairly low frequencies (10Hz-10kHz).
I want to shift my clock frequency by 90 degrees, and then halve its frequency. I can half the frequency with a D-type flip flop:
Divide by 2

But how can I shift its phase by 90 degrees? (Ideally using the other device in the same package!)
 

SgtWookie

Joined Jul 17, 2007
22,230
Well, the easy way would be to clock a 4-bit Johnson counter at 4x the frequency you need. Run the D0 and D1 outputs through their own D-type FF's, Q\ wired to the D inputs.

Have D3 of the Johnson counter reset the D-type FF's. If your Johnson counter is more than 4 bits, use D5 to reset the counter.
 

rjenkins

Joined Nov 6, 2005
1,013
You can use just a couple of bistables wired as a two-bit shift register, with the second stage /Q wired to the D of the first.

That gives two outputs in quadrature at 1/4 the input frequency.

If the timing is not absolutely critical and the input clock is a square wave (rather than a pulse), you can simply feed clock and inverted clock to two /2 bistables to get half frequency quadrature clocks.
 

Ron H

Joined Apr 14, 2005
7,063
You can use just a couple of bistables wired as a two-bit shift register, with the second stage /Q wired to the D of the first.
For clarity:
This will divide the clock by two, and give you two signals that are shifted by 90 degrees of the new frequency.
For future reference, this is a Johnson counter.

Funny story (to me, anyhow):

A few years ago, when I was designing DRAMS for Micron, a fellow engineer showed me this "new" type of counter he had invented. I said, "Joe (not his real name), that's a Johnson counter". The funny part was, Joe's last name was Johnson. He was a very talented engineer, and I was astounded that in his education or experience, he had never before encountered one.
 

rjenkins

Joined Nov 6, 2005
1,013
This will divide the clock by two, and give you two signals that are shifted by 90 degrees of the new frequency.
For future reference, this is a Johnson counter.
I knew it had a name, I wasn't sure what it was.

However, the cycle length is twice the number of stages; two stages equals Four input clock cycles for a complete output cycle, so it is a /4 system.
 

Thread Starter

daviddeakin

Joined Aug 6, 2009
207
Also, does anyone know of a D-type flip flop which triggers on the falling edge of the clock? Or is that sort of thing the stuff of fantasy?
 

Thread Starter

daviddeakin

Joined Aug 6, 2009
207
Something else; I have the following circuit using an LM311 comparator which is supposed to feed a DC4013 arranged as a frequency divider. But it won't work!

The comparator alone produces a nice square wave train, but as soon as I try and plug it into the CD4013 the flip-flop goes crazy and produces random fluctuating output. What gives?

(I have tried replacing the comparator with an opamp, wired as a comparator, which works fine with the flip flop...)
 

Attachments

beenthere

Joined Apr 20, 2004
15,819
I do not understand why the comparitor's output is designated as "TTL output". TTL logic can't exceed 5 volts. Other than that, the second section of the 4013 needs to have its inputs tied to ground or to Vcc, as appropriate. If they are left to float, the device will go into oscillations and affect the first section.
 

SgtWookie

Joined Jul 17, 2007
22,230
The comparator's output will fluctuate between 0v and 9v, so as Beenthere says, it is not TTL level.

The output of the 311 will switch extremely fast. If you have long connecting wires, the falling edge of the 311's output can cause "ringing" (high frequency oscillations) to occur on the wire, which will cause multiple clock pulses to your flip flop. This is caused by the parasitic inductance of the wire and the capacitance on the 311's output and the FF's input.

To control this ringing, use a resistor (say, 47 to 200 Ohms) between the 311's output and the flip flop's clock. This will slow down the signal enough so that you should no longer have the ringing going on.

[eta]
A straight piece of wire 10mm (0.40") in length measures about 15nH inductance at 10MHz. A foot of straight wire has 450nH of inductance. If the wire is bent into a loop, the inductance goes up quite a bit. This kind of parasitic inductance will wreak havoc on digital signals, which require high bandwidth.
 

Thread Starter

daviddeakin

Joined Aug 6, 2009
207
The comparator's output will fluctuate between 0v and 9v, so as Beenthere says, it is not TTL level.
Oh yeah, that datasheet diagram originally had 5V written on it, so it was TTL. I am using 9V and CMOS.

. If you have long connecting wires, the falling edge of the 311's output can cause "ringing"
This is built on breadboard, so none of the wires are more than an inch long. I will ground the other flip-flops pins and try the filter anyway.

EDIT: After trying both things, no change. Looking at the output wave from the 311, there is a disturbance which might be ringing, at the bottom of the rising edge. I will build the improved positive feedback version on the datasheet and see if that makes any difference.
 
Last edited:

SgtWookie

Joined Jul 17, 2007
22,230
That's OK, use a resistor as a jumper anyway. You don't have the problem with the opamp, because the opamp is really, really slow compared to the comparator's output.

Note that you need to have bypass capacitors on your IC's supply pins. This is not shown in many schematics, because it is common knowledge that they are a requirement.

Use 0.1uF (100nF) metal poly or ceramic caps. "green caps" will work. They need to be directly across the Vcc/GND or Vdd/Vee/GND pins, with the leads as short as possible. The 100nF/0.1uF caps are a minimum requirement. You can also use larger electrolytic caps elsewhere on the board.
 
Top