You can easily wire this breakout to any microcontroller, we'll be using an Arduino
-
Connect Vcc to the power supply, 3V or 5V is fine. Use the same
voltage that the microcontroller logic is based off of. For most
Arduinos, that is 5V
- Connect GND to common power/data ground
- Connect the SCL pin to the I2C clock SCL pin on your Arduino. On an UNO & '328 based Arduino, this is also known as A5, on a Mega it is also known as digital 21 and on a Leonardo/Micro, digital 3
- Connect the SDA pin to the I2C data SDA pin on your Arduino. On an UNO & '328 based Arduino, this is also known as A4, on a Mega it is also known as digital 20 and on a Leonardo/Micro, digital 2
Download Adafruit_FRAM_I2C
To begin reading and writing data to the chip, you will need to download Adafruit_FRAM_I2C from our github repository. You can do that by visiting the github repo and manually downloading or, easier, just click this button to download the zip
Rename the uncompressed folder Adafruit_FRAM_I2C and check that the Adafruit_FRAM_I2C folder contains Adafruit_FRAM_I2C.cpp and Adafruit_FRAM_I2C.h
Place the Adafruit_FRAM_I2C library folder your arduinosketchfolder/libraries/ folder.
You may need to create the libraries subfolder if its your first library. Restart the IDE.
We also have a great tutorial on Arduino library installation at:
http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use
Place the Adafruit_FRAM_I2C library folder your arduinosketchfolder/libraries/ folder.
You may need to create the libraries subfolder if its your first library. Restart the IDE.
We also have a great tutorial on Arduino library installation at:
http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use
Load Demo
Open up File->Examples->Adafruit_FRAM_I2C->MB85RC256V and upload to your Arduino wired up to the sensor
Thats it! Now open up the serial terminal window at 9600 speed to begin the test.
The test is fairly simple - It first verifies that the chip has been found. Then it reads the value written to location #0 in the memory, prints that out and write that value + 1 back to location #0. This acts like a restart-meter: every time the board is reset the value goes up one so you can keep track of how many times its been restarted.
Afterwards, the Arduino prints out the value in every location (all 256KB!)
The test is fairly simple - It first verifies that the chip has been found. Then it reads the value written to location #0 in the memory, prints that out and write that value + 1 back to location #0. This acts like a restart-meter: every time the board is reset the value goes up one so you can keep track of how many times its been restarted.
Afterwards, the Arduino prints out the value in every location (all 256KB!)
Library Reference
The library we have is simple and easy to useYou can create the FRAM object with
Adafruit_FRAM_I2C fram = Adafruit_FRAM_I2C();Then when you begin(), pass in the i2c address. The default is 0x50 so if you don't put any value in the default is used.
If you have different addresses, call something like
fram.begin(0x53)for example.
Then to write a value, call
fram.write8(address, byte-value);to write an 8-bit value to the address location
Later on of course you can also read with
fram.read8(address);which returns a byte reading.
Page last edited May 19, 2014
Text editor powered by tinymce.