How to shift clock by 90 degrees?

Discussion in 'General Electronics Chat' started by daviddeakin, May 20, 2010.

  1. daviddeakin

    Thread Starter Active Member

    Aug 6, 2009
    207
    27
    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!)
     
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    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.
     
  3. daviddeakin

    Thread Starter Active Member

    Aug 6, 2009
    207
    27
    Is a Johnson counter another name for a 4017 decade counter?
     
  4. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Yes, the 4017 is a 5-stage Johnson counter.
     
  5. rjenkins

    AAC Fanatic!

    Nov 6, 2005
    1,015
    69
    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.
     
  6. daviddeakin

    Thread Starter Active Member

    Aug 6, 2009
    207
    27
    Thanks for the tips- I'll look into it!
     
  7. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    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.
     
  8. rjenkins

    AAC Fanatic!

    Nov 6, 2005
    1,015
    69
    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.
     
  9. daviddeakin

    Thread Starter Active Member

    Aug 6, 2009
    207
    27
    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?
     
  10. daviddeakin

    Thread Starter Active Member

    Aug 6, 2009
    207
    27
    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...)
     
  11. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    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.
     
  12. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    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.
     
  13. daviddeakin

    Thread Starter Active Member

    Aug 6, 2009
    207
    27
    Oh yeah, that datasheet diagram originally had 5V written on it, so it was TTL. I am using 9V and CMOS.

    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: May 22, 2010
  14. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    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.
     
Loading...