Go Down

Topic: 74HC166 pinouts (shiftIN) (Read 9974 times) previous topic - next topic

Beardy241

Nov 01, 2010, 10:54 pm Last Edit: Nov 01, 2010, 11:41 pm by Beardy241 Reason: 1
I've been playing with shiftOUT and shiftIN - successfully using a 74HC165 for the shiftIN.  (I had one mysteriously in my box-o-bits)

Now my order of 74HC166 chips has arrived I have found that the pinouts are not only different but have different names.  Grr.  

The 165 was quite easy (I thought) but the 166 datasheet has gotten me a little foxed.

This is what I have so far...
(modified as incorrect)


Could anyone confirm if QH is indeed used for serial IN (looped in from the next chip along)?

Many thanks

Grumpy_Mike

No pin 13 is an output not an input.
It should be connected to the input pin of the arduino or the serial input of a cascading chip.
What else in the data sheet are you having trouble with?

cmiyc

Well if you look at the datasheet from NXP (which bought Phillips, who generally did the 74HC series chips):
http://ics.nxp.com/products/hc/datasheet/74hc166.74hct166.pdf

Pin 1 is Serial In and Pin 13 is Serial Out (which is opposite of what you have drawn.)
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Grumpy_Mike

Pin 6 is the clock inhibit and should be connected to ground for correct operation.

Beardy241

Thank you gents!  That's exactly what I needed to know.

James' datasheet link yields a somewhat friendlier datasheet than the one I'd found from TI.  (can't find the source again now)

PIN 1 -- serial data IN

PIN 13 -- serial data OUT

Shall be sure to ground CLK INH.  Thanks Mike.


For those that follow, the correct pinouts are...

cmiyc

Quote
James' datasheet link yields a somewhat friendlier datasheet than the one I'd found from TI.

TI and Phillips datasheets use different naming conventions.  The pins all work the same, just named different things.

Sometimes the Phillips datasheet will have better timing diagrams, sometimes the TI.  
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Beardy241

#6
Nov 01, 2010, 11:47 pm Last Edit: Nov 01, 2010, 11:48 pm by Beardy241 Reason: 1
Yep, I'm getting that.   :\

The naming on the TI datasheet had me stumped - along with a lack of description of the QH pin.

The image in my diagram had come from the TI datasheet.  </frustration>

Thanks again.  I hope this serves others too.

Party on!

Grumpy_Mike

I have found that TI data sheets are always very thorougher but steeped in their own convention. Phillips ( or NXP as they are now) can be a bit wordy but are easier to follow.

Beardy241

...and so it came to pass, that the project was brought back online and LO! it didn't work!    Grr.

I did have all this working nicely with a 165 chip: http:// http://marcellenormand.blogspot.com/2010/10/all-together-now.html
but as I resurrected the project I found the 165 setup wasn't working but decided to move to the 74HC166 chip so I'm on the same page as my chum whom I'm developing this for.

I've stripped back my code to troubleshoot it.  (no shiftOUT or vUSB)

All I'm getting back is zeros - even when I bring one of the input pins high with a flying lead from +5V

I'm missing something.  Does anyone have a keener eye than me?

Code: [Select]
int latchIN = 8;  //   PE  pin 15  74HC166
int clockIN = 9;  //            CP       7
int dataIN = 10;  //           DS       13

int LED = 13;

void setup() {
 pinMode(latchIN, OUTPUT);
 pinMode(clockIN, OUTPUT);
 pinMode(dataIN, INPUT);
 digitalWrite(latchIN, HIGH);
 Serial.begin(57600);
}


void loop(){
 read();
 delay(111);
}


//////////////////////////////////////
void read(){
 digitalWrite(LED, HIGH);
 digitalWrite(clockIN, HIGH);
 digitalWrite(latchIN, LOW);  // loads her up to be read
   delay(11);
 digitalWrite(latchIN, HIGH);  // (on a rising signal)
 for (int i=0; i <= 7; i++){  // count through the items (bits) in the array
   shiftIN(i);     // call the function to set the bit in the array
   delay(11);
 }
 Serial.println(); ///////// ==========
 digitalWrite(LED, LOW);
 digitalWrite(latchIN, HIGH);  // close her down and switch to display mode
}

//////////////////////////////////////

void shiftIN(int i){
 digitalWrite(clockIN, LOW);
 int TEMP = digitalRead(dataIN);
 digitalWrite(clockIN, HIGH);
 Serial.print(TEMP); ///////// ==========
}
//////////////////////////////////////



I've added a couple of delays along the way to slow things down in case it was all moving too fast.  It made no difference.  Serial monitor outputs lines of 8 ZEROS.  (exception - jiggling the breadboard wiring sometimes outputs a line of ONES.

Answers on a postcard to...

thanks
[m]

Beardy241

Thanks.

Yep.  At first I tried modifying the wiring then I stripped it all out and started over.

Maybe I've got the input pin pull-down resistors the wrong way round!?  ;)

[m]

pwillard

Just out of curiosity... what made you change from 165 to 166?

Beardy241

My friend and I had both ordered some 166s but during the shipping wait I happily found a 165 in my stash of bits.  Don't know where it came from.  Hence, I ran it all up with the 165 and got on quite well with it.

I started this thread whilst trying to get my head around the different pin labeling on the 166.  We didn't get time to make the swap back then but the project is back on the table now and we're both stumped as to why it's not working.

Just going to try pegging Master Reset to HIGH...

Beardy241

All ZEROS with Master Reset pegged LOW or disconnected...

...but with it pegged HIGH...

01010000
10100001
01010000
10100001
01000000
10100001
01000010
10100001
01000010
10000001
01000010
10000101
01000010
10000101
00000010
10000101
00001010
10000101
00001010
00000101
00001010
00000101
00001010
00000101
00001010
00010101

Pretty patterns!  ;D  >:(

From the timing sequence diagram in the datasheet (Philips) it looked as though MR should be held HIGH.

Stumped.

Beardy241

#13
Jan 06, 2011, 02:27 pm Last Edit: Jan 06, 2011, 02:31 pm by Beardy241 Reason: 1
I don't know if this helps... sorry, it's a mess.

The most misleading part of this image however is that the blue lead from Arduino GND looks like it goes to PIN 15 on the 166 - it actually goes to the ground rail and PIN 15 is connected to Ard 8, but is hidden.

The connections to the Arduino are:




Arduino pin8910
FunctionLatchClockData
Cable colour  BlueOrangeWhite
166 pin15713





Grumpy_Mike

You will probably find a line over the words Master Reset. This indicates that the pin should have a zero to activate the name of the function. That is to reset it you need to put it low. Therefore to take it out of reset you place it high. This is the way most chips work.

Go Up