Go Down

Topic: Using 74HC165N w/ SPI (Read 982 times) previous topic - next topic

BiohazrD

I'm currently trying to create a project that can read and write to lots of different GPIO pins. I currently have the output working using a series of 74HC595s on SPI and wanted to use the same SPI setup with a different SS conencted to the 74HC165Ns. But for the life of me, I can't figure out what pin on the 165 would be the SS pin, and how I would chain them together.

Any ideas?

Grumpy_Mike

If SS is slave select then use pin 15 the CE or chip enable pin.

fungus

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

BiohazrD

So in that case would I use MOSI to SH/!LD? Write a 0 to load the values and then set SS (CE) to low and begin reading on MISO?

Grumpy_Mike

No, you need to pulse PL and then clock the data in. So you could do this by hand before letting the SPI read it in.

CrossRoads

http://www.ti.com/lit/ds/symlink/sn74hc165.pdf

// capture data
digitalWrite(shPin, LOW); // 74HC165 pin 1
digitalWrite(shPin, HIGH);

// read in data
digitalWrite(ssPin, LOW); // 74HC165 pin 15 (but with no Output enable, can be low all the time)
incomingByte = SPI.transfer(0); // shift-in register output connects to arduino's MISO pin
digitalWrite(ssPin, HIGH);
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

BiohazrD

#6
Mar 22, 2013, 08:38 pm Last Edit: Mar 22, 2013, 08:43 pm by BiohazrD Reason: 1

http://www.ti.com/lit/ds/symlink/sn74hc165.pdf

// capture data
digitalWrite(shPin, LOW); // 74HC165 pin 1
digitalWrite(shPin, HIGH);

// read in data
digitalWrite(ssPin, LOW); // 74HC165 pin 15 (but with no Output enable, can be low all the time)
incomingByte = SPI.transfer(0); // shift-in register output connects to arduino's MISO pin
digitalWrite(ssPin, HIGH);



I'm confused, isn't pin 15 output enable? I mean, they call it CLK INH, but when it's pulled low, the register begins to output data.

I've seen some examples of pin 15 always tied low, and SS set to SH/LD.

CrossRoads

Pin is not output enable - it is Clock Inhibit. It needs to be low to allow the CLK line to toggle within the chip.  Look at the datasheet.
The output pin is active all the time.

"While SH/LD is low, the parallel inputs to the register are enabled independently of the levels of the CLK, CLK INH, or serial (SER) inputs."
See the timing diagram on page 3.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Go Up