Go Down

Topic: EEPROM - 24c08, need some guidance (Read 2874 times) previous topic - next topic

mikecurry

Jan 19, 2011, 03:59 pm Last Edit: Jan 19, 2011, 04:25 pm by mikecurry74 Reason: 1
So I have some 24C08 EEPROM's sitting around, and wanted to try and integrate them in for some counter storage.

The datasheet can be found here: http://www.datasheetarchive.com/24C08-datasheet.html

I was looking at the playground, at the source for the 24C256, and found a lot of differences (obviously).  


Here are the chip differences...

Code/Function
NC = Not connected
A0-A2 = Address Inputs
SDA = Serial Data I/O
SCL = Serial Clock Input
WP = Write Protect
PRE = Write Protect Enable
E = Chip Enable Input
MODE = Multibyte/Page Write Mode (C version)
WC = Write Control (W version)
VCC = Supply Voltage
VSS = Ground

The pin layouts on the 24c256 are:
(1) A0
(2) A1
(3) A2
(4) VSS
(5) SDA
(6) SCL
(7) WP
(8) VCC

the pin layouts on my 24c08's are:
(1) PRE
(2) NC
(3) E
(4) VSS
(5) SDA
(6) SCL
(7) MODE
(8) VCC

I think once I get the wiring setup, I can take the rest on my self - will probably take the code here: (http://www.arduino.cc/playground/Code/I2CEEPROM24C1024) and modify it to work.

Can someone help me out with the wiring?  And perhaps an insite of what I will need to do with the code addressing?

Update:

So it seems the base wiring is going to be the same... SDA/SCL/VSS/VCC - however, not sure about the rest.

Grumpy_Mike

Assuming you have a 5V part (I haven't checked the data sheet)
You wire the SDA and SCL to the I2C pins on analogue 4 & 5 and wire 4k7 pull up resistors on each pin.
There is no address pin on your device so it will use a fixed I2C address.
The mode, PRE can be wires to arduino output pins id you want to change the mode of operation otherwise you can just hard wire them to Vcc or ground. The E can be wired to an arduino output pin so you can enable it in software.

mikecurry

Thanks, would the fixed I2C address be 0x50?

retrolefty

#3
Jan 19, 2011, 04:51 pm Last Edit: Jan 19, 2011, 04:54 pm by retrolefty Reason: 1
Quote
Thanks, would the fixed I2C address be 0x50?


Addressing I2C devices using the standard Arduino TWI library is a little tricky. Manufactures will publish their devices address(es) using a full 8 bit address, where bit 0 is the read/write indicator. The TWI expects only a 7 bit address with no read/write bit.

Example, if a manufacturer list it's device address as = 0x50, then one needs to mentally perform a one bit shift right on that value, which would result in a hex address of 0x28, and use that value for the I2C commands that the arduino uses. I wish that the TWI library would have been written to work with the 'standard' published I2C address but that is the way it is.  ;) I guess there is nothing to keep someone from defining constants using the manufactures I2C address and performing the bit shift in ones setup code and using the modified address when calling the TWI functions. I think that's how I will do it in the future.

Lefty

mikecurry

Ok, I am missing the 4k7 pull ups.  What are they?  Normal 1/4 volt 4.7k ohm resistors?

retrolefty

Quote
Normal 1/4 volt 4.7k ohm resistors?


Yes, but make that Normal 1/4 watt 4.7k ohm resistors? A 1/4 volt resistor would be rather...limited in usage.  ;)

mikecurry

haha, ok.  This is all new to me!  Do you think not having the 4.7k resistors would prevent me from using the device completely?

retrolefty

Quote
Do you think not having the 4.7k resistors would prevent me from using the device completely?


The Arduino TWI library does activate the internal pullup for those two signals, but they are on the order of 40+K ohms. That works fine for my I2C real time clock chip, 1307 type. But that doesn't mean it will work for your device or with your length of wiring. Try it and see.

Lefty

mikecurry

Ok, I have only 3" of wiring.  I don't have any resistors at all on the board, I am assuming this is why I am having issues.

retrolefty

Quote
I am assuming this is why I am having issues.


Assumptions have a way of not becoming facts. Only further testing and experimenting will determine if you have hardware, software, or even perhaps both kind of problems. Just keep plugging away.

mikecurry

Here is my sketch:

Code: [Select]
#include <Wire.h>

int data = 41;
byte high = 0x00, low = 0x01;

void setup()
{
 
 Wire.begin();
 Serial.begin(9600);

 Wire.beginTransmission(0x50);
 Wire.send(high);
 Wire.send(low);
 Wire.send(byte(41));
 Wire.endTransmission();
 delay(10);
 
 data = 0;
 
 Wire.beginTransmission(0x50);
 Wire.send(high);
 Wire.send(low);
 Wire.endTransmission();
 Wire.requestFrom(0x50, 1);
 delay(10);
 
 Serial.print(int(Wire.receive()));
 
}

void loop()
{

}


My wiring is:

Pins: 1,2,3,4 = Ground
Pin: 5 -> SDA (pull up 4k7)
Pin: 6 -> SCL (pull up 4k7)
Pin: 7 -> (tried not wiring, and tried to ground)
Pin: 8 -> VCC

My output is:

0

Should be 65 (or not 0)

Any ideas?

Go Up