Remarks

AT24Cxx
Status Not Working
Source code GitHub
NuGet package Not Published

The AT24Cxx series of chips provide a mechanism for storing data that will survive a power outage or battery failure. These EEPROMs are available in varying sizes and are accessible using the I2C interface.

Purchasing

Code Example

public class MeadowApp : App<F7Micro, MeadowApp>
{
    public MeadowApp()
    {
        var eeprom = new AT24Cxx(0x57);

        var memory = eeprom.Read(0, 16);
        for (ushort index = 0; index < 16; index++)
            Console.WriteLine("Byte: " + index + ", Value: " + memory[index]);

        eeprom.Write(3, new byte[] { 10 });
        eeprom.Write(7, new byte[] { 1, 2, 3, 4 });

        memory = eeprom.Read(0, 16);
        for (ushort index = 0; index < 16; index++)
            Console.WriteLine("Byte: " + index + ", Value: " + memory[index]);


        Thread.Sleep(Timeout.Infinite);
    }
}

Sample projects available on GitHub

Wiring Example

The chip used to develop this library is one that is available on a common DS3231 RTC module with EEPROM memory module:

Characteristic Locus
Inheritance System.Object > At24Cxx
Inherited Members System.Object.ToString() System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.ReferenceEquals(System.Object, System.Object) System.Object.GetHashCode() System.Object.GetType() System.Object.MemberwiseClone()
Namespace Meadow.Foundation.ICs.EEPROM
Assembly AT24Cxx.dll

Syntax

public class At24Cxx

Constructors

View Source

At24Cxx(II2cBus, Byte, UInt16, UInt16)

Create a new AT24Cxx object using the default parameters for the component.

Declaration
public At24Cxx(II2cBus i2cBus, byte address = 80, ushort pageSize = 32, ushort memorySize = 8192)

Parameters

Type Name Description
II2cBus i2cBus
System.Byte address

Address of the At24Cxx (default = 0x50).

System.UInt16 pageSize

Number of bytes in a page (default = 32 - AT24C32).

System.UInt16 memorySize

Total number of bytes in the EEPROM (default = 8192 - AT24C32).

Methods

View Source

Read(UInt16, UInt16)

Force the sensor to make a reading and update the relevanyt properties.

Declaration
public byte[] Read(ushort startAddress, ushort amount)

Parameters

Type Name Description
System.UInt16 startAddress

Start address for the read operation.

System.UInt16 amount

Amount of data to read from the EEPROM.

Returns

Type Description
System.Byte[]
View Source

Write(UInt16, Byte[])

Write a number of bytes to the EEPROM.

Declaration
public void Write(ushort startAddress, byte[] data)

Parameters

Type Name Description
System.UInt16 startAddress

Address of he first byte to be written.

System.Byte[] data

Data to be written to the EEPROM.