Loading...
  Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Storage / Re: Problem writting I2C 24Cxx Eeprom on: April 14, 2013, 11:40:14 am
As it's been said earlier, the pull-up resistor are necessary (I'm using 4-5kOhm) despite it can work without because of the Arduino's internal pull-up resistor of I think 40kOHm.
But in case of capacitive line, it would not work properly (longer line or more than 1 I2C device on the same bus)

It seems the  "EEPROM_READ" you're using is to read the Arduino's internal Eeprom.

To read I2C Eeprom, you must use the wire.h library.

The pin 7 (WC) must be HIGH only if you want to be sure not to overwrite the Eeprom by mistake.
I usually put pin 1, 2, 3, 4, and 7 to ground to not let them floating (in case)
2  Using Arduino / Storage / Re: How to read 24Cxx I2C Eprom bigger than 2Kb (ie 4kb) on: April 11, 2013, 04:47:30 pm
It have a configuration so you can run 2 (or more?) eeproms at the same i2c address, so two 24lc32 becomes one 24lc64

Oh nooooo !

You're making things even more complicated now ! Are you sure this is possible that way ?
3  Using Arduino / Storage / Re: How to read 24Cxx I2C Eprom bigger than 2Kb (ie 4kb) on: April 11, 2013, 09:27:44 am
you can use the EEPROM24 library.
I've used it a lot and it's easy to interface with, and doesn't take a lot of space either.
you can download it here: http://rweather.github.io/arduinolibs/classEEPROM24.html

So I think this library can work only for the 1 Eeprom = 1 device Eeprom style.
No for for the 1 Eeprom = 2 devices Eeprom style.

I'm really confused about this.
4  Using Arduino / Storage / Re: How to read 24Cxx I2C Eprom bigger than 2Kb (ie 4kb) on: April 11, 2013, 04:29:04 am
Would you excuse me for insisting so much, but the 24LC1025 shouldn't it be seen only as 2 devices ?

The 24LC512 is seen as 1 device. Right ?
2 bytes is 16 bits that gives 65536 possibilities for block's address.
and the 24LC512 has 512*1024/8 = 65536 block addresses. right ?

So the 24LC1025 should be seen only as 2 devices. (2 x 24LC512)

Or am I wrong.
5  Using Arduino / Storage / Re: How to read 24Cxx I2C Eprom bigger than 2Kb (ie 4kb) on: April 11, 2013, 03:02:23 am
What makes me mistaken is that I've been using 24c02 and 24C04 that are addressed on only 1byte.

You'll say, the 24C04 can't be addressed on only 1 byte. But it is ! Well not really.

In fact, the address block is on 1byte, the 24C04 is seen as 2 devices (1 on 0x50 and 1 on 0x51), the A0 pin has no function (no connect) and there is a 9th bit somewhere that I can't yet understand how it works and where it is.
This means that a 24C04 is using 2 devices addresses !

Bigger I2C Eeprom have their block address coded on 2 bytes, that mean up to 64kB on the same device I think (24C512)

The link you gave previously talks about a 24LC1025 24LC1026 of 128kB !
Twice more addresses than 2^16 (2 bytes addresses possibilities).

Is it using the same trick as for the 24C04 ?

This is quite confusing to me indeed !
6  Using Arduino / Programming Questions / Is Arduino ANSI compatible ? on: April 08, 2013, 03:47:58 pm
Hello.

Well, that's my question.

One of the reason I choosed Arduino is that it was programmed in Arduino wich was supposed cloth to C.

But Now I have a doubt whether an Arduino code can easily be put on another uC.

I've read somewhere that the C compiler has to be ANSI compatible to make the move on different uC easy. And it seams that not all C compiler are .
7  Using Arduino / Programming Questions / Re: variable declaration on: April 06, 2013, 06:42:56 pm
I've always wished for -

Code:
typedef const uint8_t   pin_t;


What's that ?
8  Using Arduino / Programming Questions / Re: variable declaration on: April 06, 2013, 05:47:39 pm
It's right that 'uint8_t' is easier to read when we know about it.

How do I change "int" to the same way. Is it "sint16-t" or "int16_t"
And "unsiigned long" as "uint32_t", is that right ?
9  Using Arduino / Programming Questions / Re: variable declaration on: April 06, 2013, 05:05:34 pm
Better again:

Code:
const byte ledpin = 13;

It won't change, right? So now it takes no memory at all, as the compiler will turn references to it to "load literal".

Hi Nick, would you explain :
"as the compiler will turn references to it to "load literal"." If not to difficult and useful for beginner.
Thanks.
10  Using Arduino / Programming Questions / Re: variable declaration on: April 06, 2013, 05:02:05 pm
I see, I see.

But when we don't know about it, the different way we can find in coding can be confusing.

So,
Code:
int ledpin = 13;
is ok.

better is :
Code:
byte ledpin = 13;
even better is
Code:
const byte ledpin = 13;
and even better would be
Code:
cont uint8_t ledpin = 13;
The last solution would make the code more portable, isn't it ?
11  Using Arduino / Programming Questions / variable declaration on: April 06, 2013, 04:18:03 pm
Hello.

I was studying Arduino reference to go deeper through and I have a question about variable declaration.

I usually see and use :
Code:
int ledpin=13;


I wonder, as 13 would fit on 8bit or in 1 byte, why we're using int (integer) wich use 2 octets ?

Wouldn't it be more rational tu use byte instead ?
Code:
byte ledpin=13;
12  Using Arduino / Programming Questions / Re: Why am I having so much trouble working with I2C EEPROMs? on: April 04, 2013, 02:26:06 pm
Code:
while(1) {
      Wire.beginTransmission(i2caddr);
      if(Wire.endTransmission() == 0)break;
    }

What is that doing?

Read this: http://www.gammon.com.au/i2c-summary

It's not necessary, whatever you think it is doing. Omit it.

http://www.gammon.com.au/i2c


So it's better to use a "delay(5);" instead, as it is suggested in the datasheet witch gives plenty time for byte by byte writing or page writing as we can notice on your test.
Ok
13  Using Arduino / Programming Questions / Re: Why am I having so much trouble working with I2C EEPROMs? on: April 04, 2013, 05:28:25 am

So you have a 24C02 and a 24C04.


Right, I'm quite sure of that now. Thank s for confirming the fact.


Let's start with the 24C02. Take a look at the datasheet, it has a "MODE" pin for Multibyte (4 bytes) or page select (8 bytes) to write more bytes.
But if you read and write single bytes, you don't have to use that.
It uses a single byte for the register address of 0...255.


From the datasheet link you sent me I can read §5.1.1 and §5.1.2 it is possible to write byte by byte or by pages up to 16 Bytes !
What I understand from the datasheet is that there is no difference between writting by Byte or writting by Pages till 16 Bytes. What makes the difference is whether or not, the master send the Stop condition after the ACK condition of the last Data (see figure 5 on datasheet)

For instance :
 if the Byte address is 0000 0000, I can write up to 16 Bytes of data. Data1 will be written at block address 0000 0000, Data2 at block address 0000 0001......Data 16 at block address 0000 1111. Must end with the Stop condition after the last ACK condition.

If the Byte address is 0000 0100, I can write up to only 12 Bytes of data. Data1 will be written at block address 0000 0100, Data2 at block address 0000 0101......Data 12 at block address 0000 1111. Must end with the Stop condition after the last ACK condition.

if the Byte address is 0000 0100, I can write up to 12 Bytes of data, but I can also write only 1 or 2 data. Data1 will be written at block address 0000 0100, Data2 at block address 0000 0101 and I end with a Stop condition.

So I don't see any "MODE" pin.
Am I right ?


I'm sorry to say, but I'm not happy with your code.
Could you show a function to read a single byte and a function to write a single byte. So I can comment on that.

You don't have to feel sorry, just say it. I'm beginner and am ready to ear all kind of constructive criticism.
As I said somewhere, I'm new at coding and have specific difficulties with the I2C library to understand what I'm doing. In fact till now, I've been copying piece of code found in different places.


The 24C04 has twice the memory. You can read the datasheet how they did that.
The register address is still with a single byte, but the I2C device address selects the missing address bit.
It's a dirty trick, it seems as if there are two I2C devices, each with 256 byte.

24C04, http://www.st.com/web/catalog/mmc/FM76/CL1276/SC112/PF63770


Sorry I didn't find anything concerning how "they did that"
14  Using Arduino / Storage / Re: How to read 24Cxx I2C Eprom bigger than 2Kb (ie 4kb) on: April 04, 2013, 03:17:54 am
OK guies.

I missed some replies and I must study them before you give more information.

Many thanks to all.

I've been doing so many mistake and so giving so many wrong information in my previous post.
Hopefully you made me figuring them out but I hope it won't confuse other beginners.

In fact, I 'm using a 2kb and a 4kb Eeprom and the 4kb must be seen as 2 devices (thanks to Nicks' I2C scanner) and it needs the pull up resistor despite the Arduino has small 40kohm ones (too weak for more capacitive circuit, like long line or more than one Eeprom....I'm learning...
15  Using Arduino / Storage / Re: How to read 24Cxx I2C Eprom bigger than 2Kb (ie 4kb) on: April 03, 2013, 04:23:12 pm
Hi.

As I can hardly read on the package and the result I get with Nick Gammon's  I2C scanner Sketch, It is a 24C04.

Why do you think it would be a 24C32 ?

But most of the time, Eeprom I2C Arduino's Sketches are done to work with address on 2 bytes like here.

http://www.hobbytronics.co.uk/arduino-external-eeprom

Is only the 24C04 that work as 2 devices 0x50 and 0x51 and address on 1 byte only ? I've only a 24c02 and a 24c04 to play with at the moment.
Pages: [1] 2 3 4