logo elektroda
logo elektroda
X
logo elektroda

How does a Bidirectional Shift Register work and how to control 10x 74HC595 in parallel?

222 15
ADVERTISEMENT
  • #1 21667781
    yp ng
    Anonymous  
  • ADVERTISEMENT
  • #2 21667782
    stephen Van Buskirk
    Anonymous  
  • ADVERTISEMENT
  • #3 21667783
    Eugene Lisovy
    Anonymous  
  • ADVERTISEMENT
  • #4 21667784
    stephen Van Buskirk
    Anonymous  
  • ADVERTISEMENT
  • #5 21667785
    Eugene Lisovy
    Anonymous  
  • #7 21667787
    Mark Harrington
    Anonymous  
  • #8 21667788
    Mark Harrington
    Anonymous  
  • #9 21667789
    yp ng
    Anonymous  
  • #10 21667790
    Mark Harrington
    Anonymous  
  • #11 21667791
    Mark Harrington
    Anonymous  
  • #12 21667792
    Amri Fauzan
    Anonymous  
  • #13 21667793
    stephen Van Buskirk
    Anonymous  
  • #14 21667794
    stephen Van Buskirk
    Anonymous  
  • #15 21667795
    Frank Bushnell
    Anonymous  
  • #16 21667796
    Mark Harrington
    Anonymous  

Topic summary

✨ A bidirectional shift register shifts data in both directions, allowing data to be shifted in and out from either end; however, the 74HC595 is a unidirectional shift register and does not support bidirectional shifting. The 74HC595 can be cascaded to control multiple outputs by connecting the serial output of one register to the serial input of the next, enabling control of many outputs with few microcontroller pins. For controlling 10 parallel 74HC595 shift registers, cascading is the standard approach, where one acts as the master and the others as slaves, sharing clock and latch signals. Integration with 74HC165 parallel input shift registers is possible for combined input/output expansion. Practical application includes controlling multiple RGB and bi-color LEDs with limited microcontroller I/O pins, such as using a PIC18F45K22 microcontroller. Designing such systems requires careful hardware planning, including schematic diagrams, flowcharts, and understanding of binary operations and shift register datasheets. Software control is emphasized for flexibility, and multiplexing may be a preferable alternative depending on the application. Resources such as interactive shift register simulators and datasheets are recommended for deeper understanding.

FAQ

TL;DR: 10× 74HC595 gives 80 outputs, and “A 74HC595 is not bidirectional.” Use daisy‑chain outputs or multiplex LEDs instead. [Elektroda, stephen Van Buskirk, post #21667782]

Why it matters: This helps hobbyists and students decide between cascading shift registers or multiplexing when building LED-heavy projects like Mastermind with limited MCU pins.

Quick Facts

What is a bidirectional shift register?

A bidirectional shift register can shift data left or right, allowing serial loading and serial readback. The 74HC595 is not bidirectional; it only shifts data in and presents it on parallel outputs. If you need readback, add an input shift register like the 74HC165 on the same clock and latch lines. [Elektroda, stephen Van Buskirk, post #21667782]

Is the 74HC595 bidirectional?

No. As one expert put it, “A 74HC595 is not bidirectional.” It provides serial‑in shifting and parallel latch outputs, plus a serial Q7′ to daisy‑chain more parts. Use a companion input device (74HC165) if you require inbound serial data from switches. [Elektroda, stephen Van Buskirk, post #21667782]

How do I control 10× 74HC595 in parallel for 80 outputs?

Daisy‑chain the parts: connect the microcontroller to SER, SRCLK, and RCLK of all chips, and route each chip’s Q7′ to the next chip’s SER. Clock in 80 bits, then toggle RCLK once to update all outputs simultaneously. This keeps wiring simple and synchronous across the chain. [Elektroda, Eugene Lisovy, post #21667783]

How do I daisy‑chain two or more 74HC595s?

Wire microcontroller SER to the first 74HC595. Connect its Q7′ to the next chip’s SER. Share SRCLK and RCLK across the chain. Shift out N×8 bits, then latch once. This cascaded configuration is the standard way to expand outputs cleanly. [Elektroda, Eugene Lisovy, post #21667783]

Can I read button inputs while using 74HC595 for LEDs?

Yes. Add cascaded 74HC165 input shift registers. Share the clock and latch lines between 74HC595 and 74HC165 to minimize pins. Read the inputs by latching the 165s, then clocking data back to the MCU while the same lines also drive the 595 chain. [Elektroda, Eugene Lisovy, post #21667785]

Should I use multiplexing instead of many 74HC595s for LEDs?

Often, yes. Multiplexing reduces hardware and wiring. One approach can drive 128 LEDs with about 15 MCU lines. It suits displays that tolerate duty cycling. “I’d just multiplex the LEDs” is sound advice for large LED arrays with limited pins. [Elektroda, stephen Van Buskirk, post #21667793]

How many control lines do RGB and bi‑color LEDs need?

Plan for 3 lines per RGB LED if you drive each color individually, and 2 lines per bi‑color LED. For a Mastermind layout, 10 rows × 4 RGB implies addressing 120 LED nodes if not multiplexed, so multiplexing or shift registers are essential. [Elektroda, stephen Van Buskirk, post #21667793]

What refresh rate should I target when multiplexing LEDs?

Aim for at least 50 Hz per display to avoid flicker. With eight multiplexed groups, update the groups around 800 Hz total, yielding a 1/8 duty cycle. Many designs use ultra‑bright LEDs to maintain perceived brightness at reduced duty cycle. [Elektroda, stephen Van Buskirk, post #21667793]

How do I clock data into a cascaded 74HC595 chain (3 steps)?

  1. Shift: Output each data bit on SER and pulse SRCLK once per bit.
  2. Repeat: Send N×8 bits for N chained chips, MSB/LSB as your code expects.
  3. Latch: Pulse RCLK once to transfer the shift register to outputs simultaneously. [Elektroda, Eugene Lisovy, post #21667783]

What is the 74HC165, and why pair it with 74HC595?

The 74HC165 is a parallel‑in/serial‑out shift register. It captures eight input bits and shifts them to the MCU. Pair it with 74HC595 to both drive outputs and read inputs using shared control lines, reducing pin usage significantly. [Elektroda, Eugene Lisovy, post #21667785]

Can I use my PIC’s SPI (MSSP) to drive the 74HC595 chain?

Yes. Configure the MSSP in 3‑wire SPI mode. Connect SDO to SER, SCK to SRCLK, and a GPIO to RCLK. Send bytes over SPI to fill the chain, then toggle RCLK to update outputs. Reserve two or three pins for these signals. [Elektroda, Mark Harrington, post #21667790]

What are the risks of overdriving LEDs in multiplexing?

Pulsed operation permits higher peak current, but stay within LED datasheet limits. Excess current can reduce lifetime or cause failure. Even with increased peak current, the lower duty cycle often controls average brightness effectively. Design current limiting per channel and verify thermals. [Elektroda, stephen Van Buskirk, post #21667793]

Does my Mastermind build really need 10× 74HC595?

Not always. For 10 rows of 4 RGBs (120 nodes) plus 4 bi‑color feedback per row, multiplexing can slash hardware. One contributor used 8 high‑side and 16 low‑side drivers to update at a 1/8 duty cycle with strong indoor brightness. [Elektroda, stephen Van Buskirk, post #21667793]

When would an FPGA make sense here?

A participant raised FPGA as an option. For this scope, a microcontroller with shift registers or multiplexing is simpler and cheaper. Choose FPGA only if you need complex timing, parallel processing, or very high I/O bandwidth beyond MCU capability. [Elektroda, Mark Harrington, post #21667790]

Any build tips to keep changes easy during development?

Push complexity into firmware. Keep hardware minimal and consistent. Multiplex where practical and avoid large jumper bundles. Software changes are faster than rewiring, and a clean update path reduces debugging time dramatically during iterations. [Elektroda, stephen Van Buskirk, post #21667794]
ADVERTISEMENT