eeprom address
Tumbler
Posts: 323
Hi
I want to use a second eeprom with the address pins A0= 3,3v, A1=gnd and A2=gnd
and John's i2c demo.
I think i have to change this line in the DAT section, but i don't know what this line means.
EE = $A0 | (%001 << 1)
Can somebody help me with this?
thx
I want to use a second eeprom with the address pins A0= 3,3v, A1=gnd and A2=gnd
and John's i2c demo.
I think i have to change this line in the DAT section, but i don't know what this line means.
EE = $A0 | (%001 << 1)
Can somebody help me with this?
thx
Comments
EE = %101000000 OR %00000010
EE = %10100010
EE = $A2
A0= 3,3v, A1=gnd and A2=gnd
This means this EEPROM's address A0. Your 2nd EEPROM is A2? If so, A2 should be pull-up.
I'm not sure what you mean by an address of "A2". The address pins are used to assign the EEPROM one of eight possible addresses.
The address of the EEPROM has this format.
p1010AAAX (I have to use a "p" instead of the percent sign because the forum software has a fit with the percent sign.)
The "AAA" part corresponds to which address pins are pulled high. Pin A2 is the most signifiicant of these bits.
"X" indicates if the command is to read or write.
The original EEPROM on the Prop has all address pins connected to ground so the address is "p1010000X".
If pin A0 is pulled high, then the address is "p1010001X" (or setting the last bit to zero initially, you'd use "p10100010").
The first four bits of the address "p1010" is the device address. Since the following three bits can be changed by setting one or more of the address pins high, it's possible to have eight EEPROMs on the same I2C bus.
This address information is covered pretty well in the datasheet. Microchip's datasheet has this information in section 5.0 "Device Addressing" (page 8).
and line 51:
EE = $A0 | (p001 << 1) ' device address
That's for an eeprom with the A0 pin high, not the boot eeprom.
A typo?
The above sets EE to $A2, which would be the address for an EEPROM with the A0 pin high.
With all address pins low (as with the boot EEPROM), the address should be $A0.
http://forums.parallax.com/showthread.php?129700
-- http://obex.parallax.com/objects/528/ (link corrected)
You probably understand by now that the slave id for an I2C exchange is formatted thusly
-- TTTTAAAM
...where TTTT is the device type (%1010 for EEPROMs and similar devices), AAA is the 3-bit address for the device (if addressable; RTCs, for example, are not and fixed at %000), and M is the mode bit (0 for write, 1 for read).
Your link needs to be this:
http://obex.parallax.com/objects/528/
The one you posted only works for the submitter of the object.
Cheers
Richard