Go Down

Topic: 74F675A problem (Read 1 time) previous topic - next topic

BN.barak

Hello,
I am trying to output 16 bits with the 74F675A.

I am using this tutorial.
I connected:
SI -> D2
SHCP ->D3
STCP ->D5
CS -> 5V


I cant make this chip work.

CrossRoads

Where'd you find the chip? I thought they had been obsoleted.

Anyway, defining the pins like this following the names on page 2 of the datasheet:
SI = dataPin
SHCP = clockPin
STCH = latchPin
CS = chipselect
RW = connect to Gnd for write only usage
then to write data to the part:
Code: [Select]

digitalWrite (chipselect, LOW); // select the part for data transfer
digitalWrite (latchPin, LOW); // set up to move the data to the output register

shiftout (dataPin, clockPin, MSBFIRST, highByte (your_int_data) ); // shift in the data
shiftout (dataPin, clockPin, MSBFIRST, lowByte (your_int_data) );

digitalWrite (latchPin, HIGH); // move data to output register on low to high edge
digitalWrite (chipselect, HIGH);  // deselect the chip

A potential problem could be that serial data is clocked in with the clockpin going from High to Low.
Would have to look at how shiftout() is written and see if it does the equivalent of this:

digitalWrite (dataPin, next_data_bit);
digitallWrite (clockbit, LOW);
digitalWrite (clockbit, HIGH);

and if so you'd be okay.

I prefer to use SPI.transfer() and use the ATMega hardware to shift stuff out faster, I think it has a mode that lets you select the data to be valid on falling clock edges, instead of rising clock edges.
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.

BN.barak

I connected this chip like you said and upload this code:
Code: [Select]
const int latchPin = 5;
const int chipselect = 4;
const int clockPin = 3;
const int dataPin = 2;

void setup()
{
    pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT); 
  pinMode(clockPin, OUTPUT);
    pinMode(chipselect, OUTPUT);
  Serial.begin(9600);
  Serial.println("reset");
}
void loop()
{
      if (Serial.available() > 0) {
    int bitToSet = Serial.read() - 48;
    registerWrite(bitToSet);
    Serial.println(bitToSet);
  }

}

void registerWrite(int your_int_data)
{
  digitalWrite (chipselect, LOW); // select the part for data transfer
digitalWrite (latchPin, LOW); // set up to move the data to the output register

shiftOut (dataPin, clockPin, MSBFIRST, highByte (your_int_data) ); // shift in the data
shiftOut (dataPin, clockPin, MSBFIRST, lowByte (your_int_data) );

digitalWrite (latchPin, HIGH); // move data to output register on low to high edge
digitalWrite (chipselect, HIGH);  // deselect the chip
}


all leds are off.

Any thing wrong with my code?

CrossRoads

May not matter:

int bitToSet = Serial.read() - 48;

Does this end up as an int or a byte?

Like I noted:
"A potential problem could be that serial data is clocked in with the clockpin going from High to Low."

You might try sending the data out using SPI.transfer() instead, with the clock mode set correctly.

Go to Atmel.com and read
AVR151: Setup And Use of The SPI
you'll see what I mean about clock modes.
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.

Docedison

Something else to consider is the F qualifier, Those are FAST chips and Will oscillate at any excuse at all. Especially with poorly bypassed power leads, another is pins left un terminated (open). I once made a ring oscillator with a '240 or 241 (the inverting bus transmitter/bus driver) it drew 400+ ma of current until I grounded the unused inputs. With regular C series or CD4XXX series it is a no-no but not generally fatal. The only thing that saved that one was that I had used a 78L05 for the 5V regulator, it shut down and prevented a melt-down.

Doc
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

BN.barak

What's the best module  for my purpose (Connecting a 16 bit lcd) ?

CrossRoads

Which LCD? Start with that.
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.


Docedison

I bought a shield that looks like (very much) the same connector, from ElecFreaks.com... (Ebay) SD Card, Touch and of course TFT LCD, I think it was about $10 - $12.00, for another 2.4" Glcd that I bought from Ebay... The GLCD was only about $8 or $10.00, a good deal less than I could have bought the same part complete W / Shield for... IMO

Doc
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

CrossRoads

Follow the links!
http://www.geeetech.com/wiki/index.php/3.2TFT_LCD
Shows pinouts/connections needed for a Mega and an Uno and talks about the Arduino library for it.
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.

BN.barak

I dont want to use this option. Its usng all arduino's pins.
I want to use a serial shifter. Whats the best shifter for ths application?

CrossRoads

Three 74HC595's? Give you 24 bits to play with.
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