Hello,
I try to use a ATMLU940 2FB 2.
First did I find it's I2C address by using the arduino sketch "i2c_scanner". It did found 0x20 (well, the i2c lcd) and 0x7C. The only problem: there was no other device then the lcd.
A day ago was there a i2c eeprom and I have used the address 0x7C. I did read it (each address was described with 87) but I wasn't able to write something.
Therefore did I test the behavior of the i2c eeprom. What I found was surprising:
I did remove the part - but the i2c scanner did find the 0x20 and the ox7C like bevore.
Then did I read the not existing i2c eeprom at the adress 0x7C: the same result as I get with the i2c eeprom. Additionally did I change the i2c address from 0x7c to other addresses (0x6D ....). And there was the same result. Finally I read until eeprom address 80000 (the i2c chip has only may be 10k) - no problem, the result was 87 in each cell.
Is there a expert who can me help?
What do I read and how can I install the device correctly?
Please post a link to the chips datasheet and post the code you're using to access it. Please also post a diagram of the wiring from the chip to the Arduino and the type of Arduino you're using.
I did hope, the program "I2C_scanner" would say what the i2c address is, but it seems not to be so.
The scanner found the correct lcd address (0x20) but for the eeprom device it write 0x7C - even if it is not connected.
The changed i2c eeprom (A0 = +, A1 and A2 = gnd should be 0x51) is not found by i2c_scanner but also not by the code.
But independent from that problem, why did my code shows some results from not working eeproms?
You commented out the explicit initialization for datenbyte. Why did you do that?
I did think it is of no importance because the value is definded later correctly.
Your read function will return whatever preexisting value is in the datenbyte memory >location, whether it takes a value from Wire.read() or not.
Yes I see. I have to insert something to detect a failure if there is nothing to read. May be if it reads the zero (zero is no valid value of measuring.
It remains the problem of detecting the i2c eeprom address. The i2c-scanner doesn't work and even not the method of oqibidipo (0b1010xxx)
I did think it is of no importance because the value is definded later correctly.
No, it isn't.
The wiring is "normally" I think without failure: Vcc, Gnd, sda, scl, wp (at gnd), 3 address-pins.(difficult to post a picture).
That are the pins of the EEPROM chip. Where did you connect them on the Leonardo? Do you have external pullups or do you just rely on the internal ones of the ATmega32U4?
Did you left the 3 address pins floating? Did you connect them to GND? To Vcc? There is no "normal" wiring. It may be correct or wrong but there are several wiring methods that are correct, depending on the rest of the system you have.
In your code you don't check the return values of the Wire methods (p.e. endTransmission() and requestFrom()), so you don't know if the device answered on the I2C bus.