Pages: [1]   Go Down
Author Topic: Using 74HC165N w/ SPI  (Read 877 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 626
Posts: 34122
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 146
Posts: 5494
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Pin 15 - the "CE" pin.
Logged

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

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 626
Posts: 34122
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 537
Posts: 27068
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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);
Logged

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.

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: March 22, 2013, 02:43:16 pm by BiohazrD » Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 537
Posts: 27068
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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.

Pages: [1]   Go Up
Jump to: