You have no items in your shopping cart.

Subtotal: 0.00

AVR Development Board

The AVR Development Board is specifically designed to help students to master the required skills in the area of embedded systems. The kit is designed in such way that all the possible features of the microcontroller will be easily used by the students. The kit supports In-system programming (ISP) which is done through Parallel/Printer port.

ATMEL’s AVR (Atmega8535), AVR Development Kit is proposed to smooth the progress of developing and debugging of various designs encompassing of High speed 8-bit Microcontrollers.

I2C (Inter Integrated Circuit)

The I2C (Inter-IC) bus is a bi-directional two-wire serial bus that provides a communication link between integrated circuits (ICs).I2C is a synchronous protocol that allows a master device to initiate communication with a slave device. Data is exchanged between these devices.


EEPROM (electrically erasable programmable read-only memory) is user-modifiable read-only memory (ROM) that can be erased and reprogrammed (written to) repeatedly through the application of higher than normal electrical voltage. It is a type of non-volatile memory used in computers and other electronic devices to store small amounts of data that must be saved when power is removed, e.g., calibration tables or device configuration.

Originally, EEPROMs were limited to single byte operations which made them slower, but modern EEPROMs allow multi-byte page operations. It also has a limited life - that is, the number of times it could be reprogrammed was limited to tens or hundreds of thousands of times. That limitation has been extended to a million write operations in modern EEPROMs. In an EEPROM that is frequently reprogrammed while the computer is in use, the life of the EEPROM can be an important design consideration. It is for this reason that EEPROMs were used for configuration information, rather than random access memory.

Interfacing I2C - EEPROM

Fig. 1 shows how to interface the EEPROM with microcontroller through I2C. I2C is a Master-Slave protocol. I2C has a clock pulse along with the data. Normally, the master device controls the clock line, SCL. This line dictates the timing of all transfers on the I2C bus. No data will be transferred unless the clock is manipulated. All slaves are controlled by the same clock, SCL.

I2c bus supports many devices, each device is recognized by a unique address—whether it’s a micro-controller, LCD Driver, memory or keyboard interface and can operate as transmitter or receiver based on the functioning of the device. The controller designed controls the EEPROM device through I2C protocol. The I2C Controller here acts as a master device and controls EEPROM which acts as a slave. The read-write operations are accomplished by sending a set of control signals including the address and/or data bits. The control signals must be accompanied with proper clock signals.

Interfacing I2C - EEPROM to Microcontroller

Fig. 1 Interfacing I2C - EEPROM to Microcontroller


Interfacing I2C – EEPROM with AVR

We now want to Read, write and Erase EEPROM by using I2C in AVR Development Board. Wiring up an I2C based EEPROM to the I2C port is relatively simple. The basic operation of the I2C based EEPROM's is to send a command, such as WRITE, followed by an address and the data. In WRITE operation, the EEPROM to store the data.

In AVR Development Kit, 2 nos. of EEPROM lines are controlled by I2C Enabled drivers. I2C Lines serial clock of CLK (PORTC.0), serial data of DATA (PORTC.1) connected to the I2C based serial EEPROM IC. The EEPROM read & write operations are done in AVR Development Kit by using these SCK & DATA I2C lines.

Pin Assignment with AVR







Turn ON I2C Pin of CONFIG-II switch SW6.

Connect Serial cable between USART Section in the Board and PC.

Press RESET once

The string “World is mine!!!”

will be displayed in Hyper-

Terminal at 9600 baud.




Circuit Diagram to Interface I2C–EEPROM with AVR

Source Code

The Interfacing I2C – EEPROM with AVR Development program is very simple and straight forward that read, write and erase operations in EEPROM by using I2C & the value is displayed in serial port. A delay is occurring in every single data read or write in EEPROM. The delay depends on compiler how it optimizes the loops as soon as you make changes in the options the delay changes.

C Program with I2C – EEPROM using AVR Development


Title : Program to read, write & erase of I2C - EEPROM





#define TXIF UCSRA.5

#define BAUD 100000L //TWI frequency

#define FOSC 16000000L //Oscillator Frequency

#define Prescale 1 //Prescalar set to 1:1

#define I2C_Baud ((FOSC / BAUD-16)/(2*Prescale))

#define SLA_W 0xa0 //EEPROM write and read

#define SLA_R 0xa1

#define REP_START TWCR = 0xa4 //Following are TWI commands

#define START TWCR = 0xa4

#define STOP TWCR = 0x94

#define CLR_TWINT TWCR = 0x84

#define Wait() while((TWCR & 0x80)==0)

#define DATA TWDR

#define USART_Baud 9600

#define BaudH ((unsigned int)(((FOSC/16/USART_Baud)-1) >> 8))

#define BaudL ((unsigned int)(((FOSC/16/USART_Baud)-1) & 0xFF))

unsigned char data[17]={"World is mine!!!"}; unsigned char i=0;

void I2CWrite(void); void I2CRead(void);

void I2c_init(void); void Serial_init(void);

void main()







//call write routines delay_ms(100);







void I2CWrite()



//send start pulse START=0xa4 Wait();

//wait untill the TWINT bit set,if TWINT

//bit is ==1 process completed DATA = SLA_W;

//send SLave Address + write bit CLR_TWINT;

//clear TWINT bit by writing 1 into it Wait();

//wait untill the TWINT bit set DATA = 0x00;

//Send the starting address where we are

//going to write out data CLR_TWINT;





CLR_TWINT; Wait();




void I2CRead()







DATA = 0x00;











TWCR = 0xc4;




CLR_TWINT; printf(" ");

//we cann't read again


void I2c_init(void)


TWSR = 0x00;

TWBR = I2C_Baud;


void Serial_init(void)


UCSRA = 0x00;

//Status Register UCSRB = 0x18;

//Transmit Enable,ReceivE

//enable,interrupts disabled UCSRC = 0x86;

//8 databits,noparity,single stop UBRRH = BaudH;

UBRRL = BaudL;



#define _ALTERNATE_PUTCHAR_ void putchar(unsigned char Data)



UDR = Data;


To compile the above C code you need the CodeVision AVR software. The software has it’s own IDE and built-in AVR gcc- Compiler. They must be properly installed and a project with correct settings must be created in order to compile the code. To compile the above code, the C file must be added to the project.

In CodeVision AVR software, you can develop or debug the project without any hardware setup. You must compile the code for generating HEX file. In debugging Mode, you want to check the port output without microcontroller Board.

The AVR Code Blaster software is used to download the hex file into your microcontroller through Parallel port.

Testing the I2C – EEPROM with AVR Development

Give +12V power supply to AVR Development Board; the EEPROM device is connected with the AVR Development Board. First check the entire EEPROM device fixed properly. A serial cable is connected between the microcontroller and PC. In PC, open the Hyper Terminal for displaying the values from EEPROM through I2C.

The Read & Write operations are performed in EEPROM with EEPROM address. When the EEPROM address is correct, then only you can write, read, and erase data’s correctly in EEPROM.

General Information

    • For proper working use the components of exact values as shown in Circuit file.
    • Solder everything in a clean way. A major problem arises due to improper soldering, solder jumps and loose joints. Use the exact value crystal shown in schematic.
    • More instructions are available in following articles,

User Manual for ATMEGA Development Kit

How to create & Debug a Project in CodeVision AVR.