Product | Shields | EEPROM Shield With 512K AT24C512
EEPROM Shield With 512K AT24C512
EEPROM Shield With 512K AT24C512
41949
More than 10
 
US$13.98 Loading ...
 
Share/Save/Bookmark

 

Arduino EEPROM Shield With 512K AT24C512




If you need to do some data storage in Arduino, then using the EEPROM is probably the most simple practices. In actual,Arduino used ATmega chip itself has certain EEPROM memory, but only limited number. We design the external EEPROM memory module which use I2C bus line to connect with Arduino, and with pluggable chip, insert in this series, so it will easy to expand capacity, basically just need to insert a bigger capacity of EEPROM chip.

The storage module is based on EEPROM chips of AT24C series, 512K bit capacity, that's 64k bytes. The EEPROM module communicate with Arduino through the I2C interface.It will be better to use with Arduino-Sensor-Shield-V4.0 and the Arduino-I2C-COM-Cable.


This module can be used with Arduino Special Sensor Shield V4.0.
You can do some simple design about it,it support“plug and play”。

The storage module is based on AT24C series of EEPROM chips, which the I2C base address is 0×50, and the last three addresses can be set according to need.
So we should set the last three address when we firstly use, it is through the A2, A1 and A0 of the four position DIP switch. Dial the DIP switch to up,the corresponding is 1; Dial the DIP switch to down,the corresponding is 0. Namely,if move the A2, A0, A1 to up, the corresponding address is 0×57, But if move the A2, A0, A1 to down, the corresponding address is 0×50.




 
The other place which need to be set is switch RS of this storage module, it is used to set that whether connect the SDA and SCl of I2C bus line with pull-up resistors. We know that the I2C is called bus line, just because it can connect multiple the I2C equipment, according to the provisions of this agreement, the I2C allowed that we only be permitted to connect pull-up resistors with one I2C device that is the nearest from controllor. Here you may already know, if there are multiple this storage module Arduino connected to the I2C bus line, we must set the RS switch of storage module of the nearest from Arduino to the position "ON", and the other RS of other storage module can not be set to ON location:
 
 

 


If you are using Arduino sensor shield V4 board, pay attention to that the position of IIC/COM jump line should be set up to the IIC side, because we need to use the I2C connection mode :





Then connect with Arduino Special Sensor Shield V4.0.





Testing Code : 

#include <Wire.h>
#define EEPROM_ADDR 0x50           // I2C Buss address of 24LC256 256K EEPROM

void setup()
{
  Wire.begin();                        // join I2C bus (address optional for master)
  Serial.begin(9600);

  // TESTS FOR EACH FUNCTION BEGIN HERE
  Serial.println("Writing Test:");
  for (int i=0; i<20; i++){            // loop for first 20 slots
    i2c_eeprom_write_byte(EEPROM_ADDR,i,i+65);   // write address + 65 A or 97 a
    Serial.print(". ");
    delay(10);                         // NEED THIS DELAY!
  }
  Serial.println("");
  delay(500);

  Serial.println("Reading Test:");
  for (int i=0; i<20; i++){            // loop for first 20 slots
    Serial.print(i2c_eeprom_read_byte(EEPROM_ADDR, i),BYTE);
    Serial.print(" ");
  }

  // setup for page tests . . .
  byte PageData[30];                   // array that will hold test data for a page
  byte PageRead[30];                   // array that will hold result of data for a page
  for (int i=0; i<30; i++){            // zero both arrays for next test
    PageData[i] = 0;
    PageRead[i] = 0;
  }
  Serial.println("");
  for (int i=0; i<30; i++) PageData[i] = i+33;  // fill up array for next test char 33 = !

  Serial.println("Writing Page Test:");
  i2c_eeprom_write_page(EEPROM_ADDR, 100, PageData, 28 ); // 28 bytes/page is max

  Serial.println("Reading Page Test:");
  i2c_eeprom_read_buffer( EEPROM_ADDR, 100, PageRead, 28);
  for (int i=0; i<28; i++){
    Serial.print(PageRead[i],BYTE);    // display the array read
    Serial.print(" ");
  }
}

void loop()
{
}

void i2c_eeprom_write_byte( int deviceaddress, unsigned int eeaddress, byte data )
{
  int rdata = data;
  Wire.beginTransmission(deviceaddress);
  Wire.send((int)(eeaddress >> 8));    // Address High Byte
  Wire.send((int)(eeaddress & 0xFF));  // Address Low Byte
  Wire.send(rdata);
  Wire.endTransmission();
}

// Address is a page address, 6-bit (63). More and end will wrap around
// But data can be maximum of 28 bytes, because the Wire library has a buffer of 32 bytes
void i2c_eeprom_write_page
( int deviceaddress, unsigned int eeaddresspage, byte* data, byte length )
{
  Wire.beginTransmission(deviceaddress);
  Wire.send((int)(eeaddresspage >> 8)); // Address High Byte
  Wire.send((int)(eeaddresspage & 0xFF)); // Address Low Byte
  byte c;
  for ( c = 0; c < length; c++)
    Wire.send(data[c]);
  Wire.endTransmission();
  delay(10);                           // need some delay
}

byte i2c_eeprom_read_byte( int deviceaddress, unsigned int eeaddress )
{
  byte rdata = 0xFF;
  Wire.beginTransmission(deviceaddress);
  Wire.send((int)(eeaddress >> 8));    // Address High Byte
  Wire.send((int)(eeaddress & 0xFF));  // Address Low Byte
  Wire.endTransmission();
  Wire.requestFrom(deviceaddress,1);
  if (Wire.available()) rdata = Wire.receive();
  return rdata;
}

// should not read more than 28 bytes at a time!
void i2c_eeprom_read_buffer( int deviceaddress, unsigned int eeaddress, byte *buffer, int length )
{
  Wire.beginTransmission(deviceaddress);
  Wire.send((int)(eeaddress >> 8));    // Address High Byte
  Wire.send((int)(eeaddress & 0xFF));  // Address Low Byte
  Wire.endTransmission();
  Wire.requestFrom(deviceaddress,length);
  //int c = 0;
  for ( int c = 0; c < length; c++ )
    if (Wire.available()) buffer[c] = Wire.receive();
}

The Result is :









 
 

下载txt文档资料.txt

Write a review
*Review title
Please enter subject.
*Your review
Please enter review.
*Rating
(Click star icon to comment)
 
Display name
*Enter security code

CAPTCHA

Please enter code
Loading ...

Best Sellers
Newsletter

Join our newsletter today, to get latest product information and promotion code.

Join
Loading ...