PDA

View Full Version : Eeprom 24lc256



chip_select
- 23rd March 2008, 16:13
Hi,
This program works well whit EEPROM 24LC02B street I2C with the pic16F84A.
With the EEPROM 24LC256 and 24C32 don't work.
There are not other EEPROM in fall therefore byte of control is "% 10100000."
Help..


'16F84A scrittura su EEPROM
INCLUDE "Modedefs.bas"
DEFINE CHAR_PACING 10
DEFINE OSC 4


SCL Var PORTA.1
SDA Var PORTA.0
Addr Var byte
E_ByteOut Var Byte
E_ByteIn Var Byte

serout PORTB.4,2,[12,1]

For Addr = 0 To 50
E_ByteOut = Addr*3
I2CWRITE SDA,SCL,%10100000,Addr,[E_ByteOut]
Pause 10
Next Addr

pause 1000

For Addr = 0 To 50
I2CREAD SDA,SCL,%10100000,Addr,[E_ByteIn]
serout PORTB.4,2,["Indirizzo = "]
serout PORTB.4,2,[#Addr,10,13 ]
serout PORTB.4,2,[" EEPROM = "]
serout PORTB.4,2,[#E_ByteIn ]
Pause 100
serout PORTB.4,2,[12,1]
Next Addr
end

chip_select
- 23rd March 2008, 16:16
Hi,
This program works well whit EEPROM 24LC02B street I2C with the pic16F84A.
With the EEPROM 24LC256 and 24C32 don't work.
There are not other EEPROM in fall therefore byte of control is "% 10100000."
Help..


'16F84A write on EEPROM

INCLUDE "Modedefs.bas"
DEFINE CHAR_PACING 10
DEFINE OSC 4


SCL Var PORTA.1
SDA Var PORTA.0
Addr Var byte
E_ByteOut Var Byte
E_ByteIn Var Byte

serout PORTB.4,2,[12,1]

For Addr = 0 To 50
E_ByteOut = Addr*3
I2CWRITE SDA,SCL,%10100000,Addr,[E_ByteOut]
Pause 10
Next Addr

pause 1000

For Addr = 0 To 50
I2CREAD SDA,SCL,%10100000,Addr,[E_ByteIn]
serout PORTB.4,2,["Indirizzo = "]
serout PORTB.4,2,[#Addr,10,13 ]
serout PORTB.4,2,[" EEPROM = "]
serout PORTB.4,2,[#E_ByteIn ]
Pause 100
serout PORTB.4,2,[12,1]
Next Addr
end
----------------------------------
THX chip_s

chip_select
- 23rd March 2008, 16:17
Hi,
This program works well whit EEPROM 24LC02B street I2C with the pic16F84A.
With the EEPROM 24LC256 and 24C32 don't work.
There are not other EEPROM in fall therefore byte of control is "% 10100000."
Help..


'16F84A write on EEPROM

INCLUDE "Modedefs.bas"
DEFINE CHAR_PACING 10
DEFINE OSC 4


SCL Var PORTA.1
SDA Var PORTA.0
Addr Var byte
E_ByteOut Var Byte
E_ByteIn Var Byte

serout PORTB.4,2,[12,1]

For Addr = 0 To 50
E_ByteOut = Addr*3
I2CWRITE SDA,SCL,%10100000,Addr,[E_ByteOut]
Pause 10
Next Addr

pause 1000

For Addr = 0 To 50
I2CREAD SDA,SCL,%10100000,Addr,[E_ByteIn]
serout PORTB.4,2,["Addr = "]
serout PORTB.4,2,[#Addr,10,13 ]
serout PORTB.4,2,[" EEPROM = "]
serout PORTB.4,2,[#E_ByteIn ]
Pause 100
serout PORTB.4,2,[12,1]
Next Addr
end
----------------------------------
THX chip_s

Jumper
- 23rd March 2008, 16:33
Maybe you should consider if a byte is really enough for the addressing. It could be that a really tiny ee2 has a byte as address but the bigger ones might need a word.

you can probably see this in the datasheet :-)

24lc02b (256 * 8 bit) so a byte is nice for this.
24lc32 (4K *8 bit ) so here we need more than a byte for addressing

/me

chip_select
- 23rd March 2008, 16:45
Then as I can modify my program?
chip_s

Acetronics2
- 23rd March 2008, 17:29
Hi,

Just look at how the 3 MSB addresses must appear ... ( AKA ... see datasheet ! )

I think a SEARCH will show you the subject is well known ...

Alain

skimask
- 23rd March 2008, 17:38
I think a SEARCH will show you the subject is well known ...
Or unknown apparently! :)

JD123
- 23rd March 2008, 19:19
The address is a word on this eeprom, not a byte. PBP catches this automatically. Just change the address to a word (2 byte address data size)

Addr Var byte > Addr Var word

Oh, and STOP the spam!