Remarks
At24Cxx | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
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
At24Cxx eeprom;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
//256kbit = 256*1024 bits = 262144 bits = 262144 / 8 bytes = 32768 bytes
//if you're using the ZS-042 board, it has an AT24C32 and uses the default value of 8192
eeprom = new At24Cxx(i2cBus: Device.CreateI2cBus(), memorySize: 32768);
return base.Initialize();
}
public override Task Run()
{
Resolver.Log.Info("Write to eeprom");
eeprom.Write(0, new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
Resolver.Log.Info("Read from eeprom");
var memory = eeprom.Read(0, 16);
for (ushort index = 0; index < 16; index++)
{
Thread.Sleep(50);
Resolver.Log.Info("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++)
{
Thread.Sleep(50);
Resolver.Log.Info("Byte: " + index + ", Value: " + memory[index]);
}
return base.Run();
}
Sample project(s) available on GitHub
Wiring Example
To wire a At24Cxx to your Meadow board, connect the following:
At24Cxx | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
It should look like the following diagram:
Characteristic | Locus |
---|---|
Inheritance | object > At24Cxx |
Implements | II2cPeripheral |
Inherited Members | object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() |
Namespace | Meadow.Foundation.ICs.EEPROM |
Assembly | At24Cxx.dll |
Syntax
public class At24Cxx : II2cPeripheral
Constructors
At24Cxx(II2cBus, byte, ushort, ushort)
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 | I2CBus connected to display |
byte | address | Address of the At24Cxx (default = 0x50). |
ushort | pageSize | Number of bytes in a page (default = 32 - AT24C32). |
ushort | memorySize | Total number of bytes in the EEPROM (default = 8192 - AT24C32). |
Remarks
At24Cxx | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
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
At24Cxx eeprom;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
//256kbit = 256*1024 bits = 262144 bits = 262144 / 8 bytes = 32768 bytes
//if you're using the ZS-042 board, it has an AT24C32 and uses the default value of 8192
eeprom = new At24Cxx(i2cBus: Device.CreateI2cBus(), memorySize: 32768);
return base.Initialize();
}
public override Task Run()
{
Resolver.Log.Info("Write to eeprom");
eeprom.Write(0, new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
Resolver.Log.Info("Read from eeprom");
var memory = eeprom.Read(0, 16);
for (ushort index = 0; index < 16; index++)
{
Thread.Sleep(50);
Resolver.Log.Info("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++)
{
Thread.Sleep(50);
Resolver.Log.Info("Byte: " + index + ", Value: " + memory[index]);
}
return base.Run();
}
Sample project(s) available on GitHub
Wiring Example
To wire a At24Cxx to your Meadow board, connect the following:
At24Cxx | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
It should look like the following diagram:
Fields
i2cComms
I2C Communication bus used to communicate with the peripheral
Declaration
protected readonly II2cCommunications i2cComms
Field Value
Type | Description |
---|---|
II2cCommunications |
Remarks
At24Cxx | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
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
At24Cxx eeprom;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
//256kbit = 256*1024 bits = 262144 bits = 262144 / 8 bytes = 32768 bytes
//if you're using the ZS-042 board, it has an AT24C32 and uses the default value of 8192
eeprom = new At24Cxx(i2cBus: Device.CreateI2cBus(), memorySize: 32768);
return base.Initialize();
}
public override Task Run()
{
Resolver.Log.Info("Write to eeprom");
eeprom.Write(0, new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
Resolver.Log.Info("Read from eeprom");
var memory = eeprom.Read(0, 16);
for (ushort index = 0; index < 16; index++)
{
Thread.Sleep(50);
Resolver.Log.Info("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++)
{
Thread.Sleep(50);
Resolver.Log.Info("Byte: " + index + ", Value: " + memory[index]);
}
return base.Run();
}
Sample project(s) available on GitHub
Wiring Example
To wire a At24Cxx to your Meadow board, connect the following:
At24Cxx | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
It should look like the following diagram:
Properties
DefaultI2cAddress
The default I2C address for the peripheral
Declaration
public byte DefaultI2cAddress { get; }
Property Value
Type | Description |
---|---|
byte |
Remarks
At24Cxx | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
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
At24Cxx eeprom;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
//256kbit = 256*1024 bits = 262144 bits = 262144 / 8 bytes = 32768 bytes
//if you're using the ZS-042 board, it has an AT24C32 and uses the default value of 8192
eeprom = new At24Cxx(i2cBus: Device.CreateI2cBus(), memorySize: 32768);
return base.Initialize();
}
public override Task Run()
{
Resolver.Log.Info("Write to eeprom");
eeprom.Write(0, new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
Resolver.Log.Info("Read from eeprom");
var memory = eeprom.Read(0, 16);
for (ushort index = 0; index < 16; index++)
{
Thread.Sleep(50);
Resolver.Log.Info("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++)
{
Thread.Sleep(50);
Resolver.Log.Info("Byte: " + index + ", Value: " + memory[index]);
}
return base.Run();
}
Sample project(s) available on GitHub
Wiring Example
To wire a At24Cxx to your Meadow board, connect the following:
At24Cxx | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
It should look like the following diagram:
MemorySize
Number of bytes in the EEPROM module
Declaration
public ushort MemorySize { get; }
Property Value
Type | Description |
---|---|
ushort |
Remarks
At24Cxx | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
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
At24Cxx eeprom;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
//256kbit = 256*1024 bits = 262144 bits = 262144 / 8 bytes = 32768 bytes
//if you're using the ZS-042 board, it has an AT24C32 and uses the default value of 8192
eeprom = new At24Cxx(i2cBus: Device.CreateI2cBus(), memorySize: 32768);
return base.Initialize();
}
public override Task Run()
{
Resolver.Log.Info("Write to eeprom");
eeprom.Write(0, new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
Resolver.Log.Info("Read from eeprom");
var memory = eeprom.Read(0, 16);
for (ushort index = 0; index < 16; index++)
{
Thread.Sleep(50);
Resolver.Log.Info("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++)
{
Thread.Sleep(50);
Resolver.Log.Info("Byte: " + index + ", Value: " + memory[index]);
}
return base.Run();
}
Sample project(s) available on GitHub
Wiring Example
To wire a At24Cxx to your Meadow board, connect the following:
At24Cxx | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
It should look like the following diagram:
PageSize
Number of bytes in a page
Declaration
public ushort PageSize { get; }
Property Value
Type | Description |
---|---|
ushort |
Remarks
At24Cxx | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
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
At24Cxx eeprom;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
//256kbit = 256*1024 bits = 262144 bits = 262144 / 8 bytes = 32768 bytes
//if you're using the ZS-042 board, it has an AT24C32 and uses the default value of 8192
eeprom = new At24Cxx(i2cBus: Device.CreateI2cBus(), memorySize: 32768);
return base.Initialize();
}
public override Task Run()
{
Resolver.Log.Info("Write to eeprom");
eeprom.Write(0, new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
Resolver.Log.Info("Read from eeprom");
var memory = eeprom.Read(0, 16);
for (ushort index = 0; index < 16; index++)
{
Thread.Sleep(50);
Resolver.Log.Info("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++)
{
Thread.Sleep(50);
Resolver.Log.Info("Byte: " + index + ", Value: " + memory[index]);
}
return base.Run();
}
Sample project(s) available on GitHub
Wiring Example
To wire a At24Cxx to your Meadow board, connect the following:
At24Cxx | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
It should look like the following diagram:
Methods
Read(ushort, ushort)
Force the sensor to make a reading and update the relevant properties.
Declaration
public byte[] Read(ushort startAddress, ushort amount)
Parameters
Type | Name | Description |
---|---|---|
ushort | startAddress | Start address for the read operation. |
ushort | amount | Amount of data to read from the EEPROM. |
Returns
Type | Description |
---|---|
byte[] |
Remarks
At24Cxx | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
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
At24Cxx eeprom;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
//256kbit = 256*1024 bits = 262144 bits = 262144 / 8 bytes = 32768 bytes
//if you're using the ZS-042 board, it has an AT24C32 and uses the default value of 8192
eeprom = new At24Cxx(i2cBus: Device.CreateI2cBus(), memorySize: 32768);
return base.Initialize();
}
public override Task Run()
{
Resolver.Log.Info("Write to eeprom");
eeprom.Write(0, new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
Resolver.Log.Info("Read from eeprom");
var memory = eeprom.Read(0, 16);
for (ushort index = 0; index < 16; index++)
{
Thread.Sleep(50);
Resolver.Log.Info("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++)
{
Thread.Sleep(50);
Resolver.Log.Info("Byte: " + index + ", Value: " + memory[index]);
}
return base.Run();
}
Sample project(s) available on GitHub
Wiring Example
To wire a At24Cxx to your Meadow board, connect the following:
At24Cxx | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
It should look like the following diagram:
Write(ushort, params byte[])
Write a number of bytes to the EEPROM.
Declaration
public void Write(ushort startAddress, params byte[] data)
Parameters
Type | Name | Description |
---|---|---|
ushort | startAddress | Address of he first byte to be written. |
byte[] | data | Data to be written to the EEPROM. |
Remarks
At24Cxx | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
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
At24Cxx eeprom;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
//256kbit = 256*1024 bits = 262144 bits = 262144 / 8 bytes = 32768 bytes
//if you're using the ZS-042 board, it has an AT24C32 and uses the default value of 8192
eeprom = new At24Cxx(i2cBus: Device.CreateI2cBus(), memorySize: 32768);
return base.Initialize();
}
public override Task Run()
{
Resolver.Log.Info("Write to eeprom");
eeprom.Write(0, new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
Resolver.Log.Info("Read from eeprom");
var memory = eeprom.Read(0, 16);
for (ushort index = 0; index < 16; index++)
{
Thread.Sleep(50);
Resolver.Log.Info("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++)
{
Thread.Sleep(50);
Resolver.Log.Info("Byte: " + index + ", Value: " + memory[index]);
}
return base.Run();
}
Sample project(s) available on GitHub
Wiring Example
To wire a At24Cxx to your Meadow board, connect the following:
At24Cxx | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
It should look like the following diagram: