Cascading shift registers - how fast can I fill them?

Discussion in 'The Projects Forum' started by squatchy, Nov 30, 2012.

  1. squatchy

    Thread Starter Member

    Nov 21, 2012
    43
    0
    Let's say I chain 32 shift registers together (8-bits apiece) for a 256-bit long shift register, and connect it so that it fills all 256 bits then latches it for output.

    Are there practical limits to how quickly I can do this?

    If it takes 513 steps to accomplish this (check my math), I figure a microcontroller than can update its pin-out values at 1mhz could update the entire register 1949 times per second. But is that realistic? Is there any microcontroller that can toggle digital-out pins at that speed, and is there anything about a 32-chain register that would prevent this?

    Thanks!
     
  2. squatchy

    Thread Starter Member

    Nov 21, 2012
    43
    0
    A microcontroller that could toggle ouput values at 12Khz would update the entire register 24 times per second, which is much slower but would still work for my application.

    Is a 12Khz output speed realistic?
     
  3. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    Any uC that can't toggle that fast is useless in my book...

    Really, though, it is dependent on the uC architecture and clock speed...
     
  4. squatchy

    Thread Starter Member

    Nov 21, 2012
    43
    0
    Would a standard PIC chip be able to toggle this fast? Is this even considered a fast rate? I have no idea... I'm a software guy. I'd be elated to learn that pin update speeds above 12Khz are common.
     
  5. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    Yes, which PIC are you using? And what oscillator speed?
    Not particularly
     
  6. squatchy

    Thread Starter Member

    Nov 21, 2012
    43
    0
    I still need to learn more about PICs before choosing. Still pretty stupid about this stuff.
     
  7. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    No, no, not stupid.. ignorant:p

    Stupid means you can't understand, ignorant means you haven't tried...;)
     
    absf likes this.
  8. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,015
    Easily. Of course it depends on the pic but yes most pics easily. The pic I have in front of me now can operate at 20mhz with the internal r/c osc. Much faster if you user an external xtal.

    Now the serial port can only send out as fast as the clock / 4.

    The other thing you need to consider is the speed of your shift registers.
     
  9. DickCappels

    Moderator

    Aug 21, 2008
    2,658
    632
    I don't know much about PICs, but some AVR microcontrollers that have hardware SPI interfaces that can pump out data in the MHz range. The question then becomes one of where one has to get the data to fill the pipe (for example, a serial port or a serial flash memory could be the bottleneck).
     
  10. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    Only two steps to output a bit? Tell us more on how.

    I would reckon a bit shift operation, a clocking operation(which take two steps) for just one bit.

    Then after 8 bits, you have to reload new data in order to shift out. Not to mention some more checking to see when everything has been completed.
     
  11. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    If you use a clock of 1 MHz or more for a long chain of shifting registers, you will encounter various problems. This will depend on the length of the wires. To some degree compensation coils can help. Especially if you use more than 1 MHz, the distance of wire/PCB track can not be more than some 10cm.

    I have such a circuit here, where I actually need compensation coils.

    The PIC itself can be used to shift out bits as fast as it can do. The limit is the software code, or the hardware USART.

    But you will see that it simply will not work beyond a certain frequency. What value you must use for the coils and where they must be placed, I can not give this information generically. I placed 22uH coils on the DATA input only, and it works. The PICs run at 32 MHz! The instruction cycle is 8 MHz then. I use only 5 cascaded shifting registers.
     
    Last edited: Dec 1, 2012
  12. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Have you considered using a whole port to drive 8 chains of 4 shift registers?
    It would be around 8 times faster, possibly better.
    <ed>Assuming you are just doing it in software.</ed>
     
  13. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    yes this is intelligent solution.
    I use 2 bitlines for some larger displays.
     
  14. squatchy

    Thread Starter Member

    Nov 21, 2012
    43
    0
    I would be open to it. What kind of port set-up are you describing? A PC's serial port only has one usable pin, right? I'd use a parallel port if they made computers with those anymore.
     
  15. russdx

    New Member

    Feb 5, 2013
    1
    0
    if you use a stm32f4 micro you could shift out data at 24mhz!!! using hardware dma-spi (is that fast enough for ya lol)

    a 256 shift register chain should only take 256 clocks to shift out all 256 bits unless im missing some thing? the above micro can do this is nano seconds.
     
  16. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    Why would you want to use so many shifting registers?

    12 KHz. Kilohertz. Software guy. Can't you answer that question for yourself?

    On a PCB nobody wants 32 shifting ICs. So if you really want so many bits, use other ICs which have more pins.
     
  17. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    It is clear you never have done that for a large number of shifting registers.

    You get problems at 8MHz, 30cm wire, and only 5 registers. How it would be at 24 MHz, 2m wire, and 32 registers...I do not know to be honest.
     
  18. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    One time you talk about a microcontroller, then you change now to mention PC serial port.

    Forget about parallel port. It is deprecated for a decade.

    Have you ever heard about USB? There are $1 chips now, no need a crystal even.

    12 KHz- use as many shifting registers as you like. It does not matter.

    Do you follow the clock signal is all parallel?
     
Loading...