2013年11月28日星期四

Using a 74HC595 output shift register as a port-expander

A cheap and simple way of expanding your processor's output capability is by using a "shift register" like the 74HC595 described here.
Example of it in use, displaying 8 LEDs:




Pin outs

The pin-outs for the 74HC595 are:
You can find it on HQEW datasheet.



You can "daisy-chain" them to connect multiple ones together, thus giving you 8, 16, 24, 32 or more extra output ports, by simply connecting the "overflow" bit of one register to the "data in" of the next.


Schematic



The 10K pull-down resistor on the SS (Slave Select) is designed to keep the registers from clocking in bits while the main processor is booting, and the SS line might be "floating" and in an indeterminate state.

Master reset

I have tied /MR (master reset) high, so the chips are never in a reset state. If you needed to reset them from time to time you could parallel up those pins and connect them to a processor pin.

Output enable

I have tied /OE (output enable) low, so the chips are always in output mode. If you needed to have them high impedance (neither high nor low) you could parallel up those pins and connect them to a processor pin (eg, D9).




Example of 4 shift register chips breadboarded with 32 LEDs:



There are about 8 x 0.1 uF decoupling capacitors there between +5V and Gnd, to keep it all stable.

There are 1K resistors on the board in series with the LEDs.

没有评论:

发表评论