When latching or clocking a shift register from a microcontroller, should there be a delay in between setting the clock or latch pin to high and then resetting it to low? How long is this delay typically? For example if I set the data pin, and then set the clock to high and then immediately back to low in the next line of code, would that be sufficient to clock in the data?

  • \$\begingroup\$ Yes, but how long depends on the exact part number of the shift register; if you post an example datasheet we can point out which value it is. \$\endgroup\$
    – pjc50
    Commented Jul 28, 2013 at 19:27
  • \$\begingroup\$ @pjc50 I'm using these two types of shift registers: ti.com/lit/ds/symlink/sn74hc595.pdf ti.com/lit/ds/symlink/tpic6b595.pdf The former is used to source, the latter is used to sink. They are being controlled by a Raspberry Pi \$\endgroup\$
    – hesson
    Commented Jul 28, 2013 at 19:39

1 Answer 1


There are no typical delays, just the datasheet...

A quick glance through the two datasheets learns that at 5V none of the required delays is more than 100 ns, so you could use that and be on the safe side.

  • \$\begingroup\$ Thanks, but I don't think it's possible to make a delay at the nanoscale for the Raspberry Pi. \$\endgroup\$
    – hesson
    Commented Jul 28, 2013 at 21:44
  • \$\begingroup\$ On second thought, there is a nanosleep() function in time.h that might be useful. \$\endgroup\$
    – hesson
    Commented Jul 28, 2013 at 22:01
  • \$\begingroup\$ You did not mention the Pi in your original question (you mention a microcontroller, which the Pi isn't). BTW you can do ns level sleeps on a Pi if you program it bare-metal (without the OS). \$\endgroup\$ Commented Jul 29, 2013 at 6:22
  • \$\begingroup\$ Would nanosleep not work well with Raspberry Pi? I would prefer to keep the OS because I need to do some high-level tasks such as web scraping as well. \$\endgroup\$
    – hesson
    Commented Jul 30, 2013 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.