EEPROM Driver for AVR with RAM using ATtiny15 microcontroller

Download the test program with driver:  i2cm030710F.asmI had been putting off writing a driver for some 24LC64 and 24LC256 EEPROMS I was thinking about using, when I came across a temperature logger application written by Sean Ellis. The Temperature logger was posted on on www.avrfreaks.net on January 10, 2002, project ID 49.  The original application was written for the ATtiny15,  which has a small hardware stack, so when extracting the I2C code, I massaged it a little bit to make it more compact when running on processors equipped with a RAM stack while making it a little easier to customize for new applications. The block write was omitted. If you need higher writing throughput, have a look at the original code onwww.avrfreaks.net.
The resulting code was run in a small test program in an AT90S2313.
Customiztion and use

Pull-up resistors are required on SDA and SCL lines. See the I2C spec. for details.
The subroutine, I2CInit, needs to be called during initialization, preferable after the I/O ports are initialized but before calling any I2C read or write routines. I2CInit will set up the I2C I/O pins and initialize the bus.
The EEPROM code needs to be customized to deal with the I/O pins being used and the  processor clock speed in each particular application. All constants and registers that need to be modified are found  in the I2C Memory Driver section. Check and if necessary, change the I/O assignments to I2CPORT, I2CDDR,  I2CPIN, bSDA, and bSCL in the I2C Memory Driver sect
Delays to accommodate various bus speed and processor clock rates are controlled by the constant I2CDelayConstant.
 
For more detail: EEPROM Driver for AVR with RAM using ATtiny15 microcontroller


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top