View Full Version : Shift Register Help Please

01-03-2009, 06:22 AM
Hi Everyone,

I have a very newbie question here, so please excuse my ignorance.
I am trying to interface 40 momentry push buttons and 4 x 6 position rotary switches to the prop chip using 74HC165 shift registers, and then led indicators for all of the switch contacts via 74HC595 chips. I found the attached schematics on the internet and have made a board for the switches and another board for the leds.
My question is, how do I hook the signals SO, SC, RC for the 595 and SI, SC, RC for the 165 to the prop? I am supplying the 5V and 0V for my prop board (I have a seperate 7805 reg for the 5V). I have read that I should put a 1K resistor in series with the signals, but do I do this for all three of the signals from each chip. Do I use 6 pins of the prop for this(three for each chip), or is there some way I can daisy chain the 595's and the 165's together? If anyone has a schematic they are willing to share it would help greatly.

Thanks for your help


01-03-2009, 07:34 AM
Helo Andrew,

both chips work within 2V-6V so why not supplying them with 3.3V ?
I did this with 74HC595 and 74HC597 and it worked great

It might be possible to do switch one prop-IO-pin between input and output but therefore I think a pull-up-resistor is required
To make sure that the IO-state of the shared serialdata-pin do NOT interfere with each other you have to take a very close look
onto the logic table of both chips. You have to avoid that both chips get a "load parallel" signal. the 165 loads in whenever PL is low
RCK of 595 is triggered on a low-high-transistion

I guess you need an inverter to transform the low-high-transition of the 165 into a high-low-transition of the 595. AND it must be possible
to have the "load-parallel"/store parallel pin then "the other" state and everything else (data in/output shift-clocking) is still working

As I made a QUICK look at the truth-table it should be possible to share the pins when between Prop-IO "palallel-load" and 595 is an inverter.
But I would test this INTENSIVLY before manufacturing a PCB.

best regards


Peter Jakacki
01-03-2009, 10:33 AM
If you want you can save a lot of lines by doing it this way. Assume you are using 3 lines for the lot, that's CLK, DAT, and LD. You need to isolate the data coming from the 74HC165 via a high value resistor so that the Propeller can make DAT an output without interference when it needs to talk to the 74HC595. You would clock data normally to the 74HC595 chips then take LD low then high to clock the data into the output registers. Since you have taken LD low it will have latched the 74HC165 inputs at that time so all you need to do now is to make DAT an input and clock the 74HC165 data in to the Prop. To save an extra I/O pin you can steal the SCL for the CLK if need be as long as you aren't trying to do both at the same time of course.


QH ---------10K----------->DAT
CLK <-------------------------CLK
LD <-------------------------LD (active low will read inputs then)

74HC595-------------------- PROP
SER <----------------------- DAT
SCLK <---------------------- CLK
RCLK <---------------------- LD (low to high) (double up with 74HC165)

01-03-2009, 11:48 AM
Andrew, put a separate series resistor on each pin from the prop.
As for the signals:
SC (shift clock) both chips shift the data on the low to high transition of the clock so it can be shared. Use a low to high pulse.

RC (register load clock) the 165 loads the register when it is low, and 595 loads the output register on the low to high transition so it can be shared if you use a low to high pulse.

If the data bits going out to the leds are in the same order as those coming in from the 165 then you will not need an output pin. You can connect the output from the 165 to the input of the 595 and the prop input pin. Otherwise you will need an output pin from the prop connected to the input of the 595.

Be aware that:
J2 is the serial input to the 165 chain and J1 is the serial output.
J1 is the serial input to the 595 chain and J2 is the serial output.
This is only relevant if you want to connect the serial out from the 165 to the input of the 595. SC and RC are common to both connectors.

01-03-2009, 11:57 AM
Sorry Andrew, one mistake.

RC (register load clock) the 165 loads the register when it is low, and 595 loads the output register on the low to high transition so it can be shared if you use a **** high to low***** pulse.

01-03-2009, 12:34 PM
Hi Guys,
Thanks for all the replys.
I have plenty of I/O left on the prop so I have no problems using 3 pins for inputs and another three for outputs, if that is ok to do.
I will run them driectly from the 3.3V from the prop (nice and simple).
I will make a board up now, and wil give it a try. Thanks again for everyones help.


01-03-2009, 11:37 PM
Three for input and three for output is fine. Actually makes the code simpler. Running everything on 3.3V is also a good idea.

Good luck,

Peter Jakacki
01-04-2009, 05:18 AM
Oh yeah, that's right, if you try to run the chips at 5V then the logic levels from the Prop will not be high enough to satisfy 74HC's Vih. I mention this because sometimes it's better to run the LED registers from what may be a beefier 5V supply. In that case use 74HCT or 74CHC parts for compatible logic levels or just run the 74HC parts at 3.3V.

I'm normally squeezing every last breath out of the I/O pins and things like LEDs and switches don't need dedicated lines. If it was just the leds then I would connect the clock and data to the I2C lines and just use one other I/O for the load.

As for the code being simpler or more complex I find that there is hardly any difference anyway, just simple clock and data as normal.