24AA256 I2C EEprom

General questions about Firewing...

24AA256 I2C EEprom

Postby AndrewB » Thu Nov 02, 2017 11:59 am

Has anyone used this 24AA256 IC?

I'm using the DS1307 memory locations at the moment and would like to change this due to the battery.

Is there another way to save data other than a SD card?
AndrewB
 
Posts: 94
Joined: Thu Jan 02, 2014 3:38 pm

Re: 24AA256 I2C EEprom

Postby David John Barker » Thu Nov 02, 2017 1:03 pm

Have you take a look at some I2C modules
User avatar
David John Barker
 
Posts: 491
Joined: Thu Nov 08, 2012 12:21 pm

Re: 24AA256 I2C EEprom

Postby David John Barker » Thu Nov 02, 2017 1:05 pm

I'll try and dig some out - I posted an SPI module by mistake - oops
User avatar
David John Barker
 
Posts: 491
Joined: Thu Nov 08, 2012 12:21 pm

Re: 24AA256 I2C EEprom

Postby AndrewB » Thu Nov 02, 2017 1:06 pm

Thanks David.

Will look at that.
AndrewB
 
Posts: 94
Joined: Thu Jan 02, 2014 3:38 pm

Re: 24AA256 I2C EEprom

Postby David John Barker » Thu Nov 02, 2017 1:08 pm

This might be better. I have not used the device you mentioned, but this works for a 24LC128

Code: Select all
Imports I2C

Sub Main()
   Const I2C_EEPROM As Byte = &HA0  ' target 24LC128 I2C EEPROM device...
   Dim Value As Byte                ' Value that is read back from device
   Dim Address As UShort = 0        ' EEPROM address

   ' initialise the I2C module...
   I2C.Initialize()

   ' write some data...
   I2C.Start()                         
   I2C.WriteByte(I2C_EEPROM)             
   I2C.WriteByte(Address.Byte1)       
   I2C.WriteByte(Address.Byte0)       
   I2C.WriteByte("X")                 
   I2C.Stop()

   ' allow external EEPROM to write data...
   DelayMS(10)

   ' read the data back...
   I2C.Start()
   I2C.WriteByte(I2C_EEPROM)
   I2C.WriteByte(Address.Byte1)       
   I2C.WriteByte(Address.Byte0)       
   I2C.Restart()                         
   I2C.WriteByte(I2C_EEPROM + 1)
   Value = I2C.ReadByte()
   I2C.Acknowledge(IsNotAcknowledge)
   I2C.Stop()

   ' output the result
   Console.WriteLine("Value = ", Value)
End Sub
User avatar
David John Barker
 
Posts: 491
Joined: Thu Nov 08, 2012 12:21 pm

Re: 24AA256 I2C EEprom

Postby AndrewB » Thu Nov 02, 2017 1:56 pm

Thanks
AndrewB
 
Posts: 94
Joined: Thu Jan 02, 2014 3:38 pm


Return to Questions

Who is online

Users browsing this forum: No registered users and 1 guest

cron

x