Serial shift register control (with parallel port)

Discussion in 'The Projects Forum' started by ld100, May 28, 2012.

  1. ld100

    Thread Starter New Member

    May 16, 2012
    8
    0
    Hello everyone! I'm fairly new to electronics and have been experimenting with an 74LS164 serial shift register (www.esi.uclm.es/www/isanchez/teco/ci/74164.pdf) and 8 leds (with resisters in series) on the register outputs (leds on when register output is low). I have this on a breadboard, and I'm using a computer power supply for the 5 volt power to the register and the leds. I would like to control the shift register using a parallel port and so I have tied register pin 2 (input B) to pin 14 on my parallel port (Autofeed line). Then I connected register pin 8 (clock pin) to pin 1 on the parallel port (strobe line). Register pin 1 (input A) and the master reset pin are tied high. The leds light up all right, but I thought this circuit would produce a shift on the register each time I set the strobe line from low to high, but instead it seems the register shifts continuously when the strobe line is low, and stops when it is high. Switching it quickly high-low-high (programtically) I get one to several shifts. So, have I misunderstood how the register works or perhaps the parallel port cant be used directly to the register clock pin? Do I need to add a capacitor(s) for this circuit to work properly? Any advice or wisdom on this matter would be greatly appreciated!
     
  2. nerdegutta

    Moderator

    Dec 15, 2009
    2,515
    785
    Hi,

    it would be nice with a schematic layout. For some people it is easier to see it than to read it.

    Why not use D0-D7, PIN2-9? Do they common GND?
     
  3. ld100

    Thread Starter New Member

    May 16, 2012
    8
    0
    Yeah sorry I don't have a schematic, I'll have to get back to you with that. I could use D0-D7, but I was hoping not to as I had another use for them in mind. I'm not sure what you mean by common ground? I ran one 5 volt line from the power supply to the registers Vcc pin, and one ground line from the supply to the register's GND pin. The led's are all connected in parallel to another 5v line from the power supply. The ground lines from the parallel port aren't connected to anything, could that be an issue?
     
  4. nerdegutta

    Moderator

    Dec 15, 2009
    2,515
    785
    Is the circuit powered with the same supply as the LPT-port? If yes, then you have common GND. Then it shouldn't matter if you have connected the LPT GND pins, but I suppose it wouldn't matter.

    Let's see the schematic first, then move to the software.
     
  5. ld100

    Thread Starter New Member

    May 16, 2012
    8
    0
    Okay, so here is a first attempt at a schematic. The power supply is external from the computer so not the same as the LPT port. Should I connect the ports ground lines to the ground of the external power supply? Also, I control the parallel port via pythons pyparallel module.
     
    Last edited: May 28, 2012
  6. nerdegutta

    Moderator

    Dec 15, 2009
    2,515
    785
    I don't know about Python pyparallel so I cannot help you there. However, see this animated gif:


    [​IMG]

    Look at the clock signal on pin 8, and how altering pin 1 and 2 high/low...
     
  7. ld100

    Thread Starter New Member

    May 16, 2012
    8
    0
    Yes, this is the sort of diagram I based the design on. The shift is supposed to be triggered by the rising edge of the clock pulse at Cp, according to the datasheet for the register. However pulling it low directly from the parallel port line seems to cause very rapid shifts to occur continuously (ie, all lights come on or all lights go out very quickly depending on the input at A and B). Maybe it can't pull Cp down all the way or something and it hovers around a trigger voltage? Setting it high again stops the shifting.
     
  8. nerdegutta

    Moderator

    Dec 15, 2009
    2,515
    785
    If you have an o-scope, you should check your LPT-PINs while the program is running.

    Maybe the program is "free-running", and it all happens too fast...
     
  9. ld100

    Thread Starter New Member

    May 16, 2012
    8
    0

    Well I can confirm the pins are working as expected. The multimeter shows the pins going high and low as instructed from the interactive interpreter. Running a scripted series of highs and lows I can verify proper looking square waves like shown in the diagram (using a soundcard as an oscilloscope) but there is still multiple register shifts per clock pulse. The datasheet says minimum clock pulse width is 20 ns for the register, I don't think I could even MAKE pulses that short with python. It does not mention a max pulse width so I assumed even slow, manually controlled HIGH-LOW-HIGH pulses would trigger the shift on the rising edge of the clock pulse as long as it was longer than the minimum 20 ns. Instead, I get continuous shifting as soon as Cp is pulled low.

    Thanks for all the suggestions so far, I just cannot seem to get why this won't work, everything looks connected right and it's driving me a bit batty :p
     
Loading...