Hello Readers, welcome to my Blog BloggerTipsTricks. com - A Blog For Bloggers By A Blogger. I'm Arun, an entrepreneur Blogger from India.

AT24C01 EEPROM Byte Read & Write with ATmega16 and LED Display

848
Mark as Favourite

In this project, we will learn How to read and write a byte of data in AT24C01 EEPROM with AVR ATmega16 microcontroller and LED Display. Here, we will write a byte of data into the AT24C01 EEPROM memory and then we will read this one byte of data from the AT24C01 EEPROM memory and we will display the read value in a 1X8 LED array. AT24C01 has a storage capacity of 1Kbit(128 bytes). The 128 byte memory is divided into pages of 8 byte each. The data communication between AVR ATmega16 microcontroller and AT24C01 EEPROM takes place through TWI communication protocol. The AVR ATmega16 microcontroller will write a byte of data(in our case 0xAA) into the 0x00 memory location of AT24C01 EEPROM memory through TWI communication. Then it will read the one byte data from the 0x00 memory location of AT24C01 EEPROM memory through TWI communication and it will display the read value in the 1X8 LED array.

Softwares Required

Hardwares Required

Name / Unit Price Quantity Total Price
AVR Trainer Board-100 with ATmega16
Rs. 700.00
1pc
Rs.700.00
AVR USB Programmer
Rs. 350.00
1pc
Rs.350.00
12V, 1A DC SMPS Adaptor
Rs. 130.00
1pc
Rs.130.00
EEPROM & RTC Board with AT24C01
Rs. 300.00
1pc
Rs.300.00
10 to 10 FRC Female to Female Connector
Rs. 15.00
3pc
Rs.45.00
TOTAL Rs.1525.00

Circuit Diagram

C Program

Fullscreen
 

//**************************************************************//
//System Clock                       :2MHz
//Software                               :Atmel Studio 6
//TWI Frequency                    :100KHz
//**************************************************************//

#include<avr/io.h>
/*Includes io.h header file where all the Input/Output Registers and its Bits are defined for all AVR microcontrollers*/

#define           F_CPU           2000000
/*Defines a macro for the delay.h header file. F_CPU is the microcontroller frequency value for the delay.h header file. Default value of F_CPU in delay.h header file is 1000000(1MHz)*/

#include<util/delay.h>
/*Includes delay.h header file which defines two functions, _delay_ms (millisecond delay) and _delay_us (microsecond delay)*/

#define          EEPROM           AT24C01
/*Defines a macro for at24cxx.h header file. EEPROM macro is the EEPROM used for interfacing. Default EEPROM is AT24C01*/

#include<avr/at24cxx.h>
/*Includes at24cxx.h header file which defines different functions for AT24CXX series EEPROMs. AT24CXX header file version is 1.1*/

int main(void)
{

DDRB=0xff;
/*All the 8 pins of PortB are declared output (LED array is connected)*/

twi_init();
/*TWI initialisaiton*/

at24cxx_byte_write(0x00,0xA0, 0xAA);
/*Writting 1 byte data (0xAA) to the first memory location 0x00. 0xA0 is the device address of EEPROM(AT24C01)*/

_delay_ms(3);
/*Delay of 3ms*/

PORTB=at24cxx_random_location_byte_read(0x00,0xA0);
/*Reading the first memory location (0x00) data and displaying the data in LED array*/

}
/*End of program*/

  

//**************************************************************//
//System Clock                       :2MHz
//Software                               :Atmel Studio 6
//TWI Frequency                    :100KHz
//**************************************************************//

#include<avr/io.h>
/*Includes io.h header file where all the Input/Output Registers and its Bits are defined for all AVR microcontrollers*/

#define           F_CPU           2000000
/*Defines a macro for the delay.h header file. F_CPU is the microcontroller frequency value for the delay.h header file. Default value of F_CPU in delay.h header file is 1000000(1MHz)*/

#include<util/delay.h>
/*Includes delay.h header file which defines two functions, _delay_ms (millisecond delay) and _delay_us (microsecond delay)*/

#define          EEPROM           AT24C01
/*Defines a macro for at24cxx.h header file. EEPROM macro is the EEPROM used for interfacing. Default EEPROM is AT24C01*/

#include<avr/at24cxx.h>
/*Includes at24cxx.h header file which defines different functions for AT24CXX series EEPROMs. AT24CXX header file version is 1.1*/

int main(void)
{

DDRB=0xff;
/*All the 8 pins of PortB are declared output (LED array is connected)*/

twi_init();
/*TWI initialisaiton*/

at24cxx_byte_write(0x00,0xA0, 0xAA);
/*Writting 1 byte data (0xAA) to the first memory location 0x00. 0xA0 is the device address of EEPROM(AT24C01)*/

_delay_ms(3);
/*Delay of 3ms*/

PORTB=at24cxx_random_location_byte_read(0x00,0xA0);
/*Reading the first memory location (0x00) data and displaying the data in LED array*/

}
/*End of program*/

Connection Guide

The step-by-step connection guide for AT24C01 EEPROM Byte Read & Write with ATmega16 and LED Display is as follows:

  • Insert the DC Pin of 12V, 1A DC Adapter to the DC Socket of AVR Trainer Board-100.

    Steps - 1 ( 0f 7 )

  • Connect PortB header with LED data header in AVR Trainer Board-100 with a 10 to 10 FRC Female Connector.

    Steps - 2 ( 0f 7 )

  • Connect the EEPROM & RTC header of EEPROM & RTC with PortC header of AVR Trainer Board-100 with a 10 to 10 FRC Female Connector.

    Steps - 3 ( 0f 7 )

  • Connect the ISP header of AVR Trainer Board-100 with AVR USB Programmer header of AVR USB Programmer with a 10 to 10 FRC Female Connector.

    Steps - 4 ( 0f 7 )

  • Connect the AVR USB Programmer to the PC/Laptop's USB Port directly or with the help of USB AM-AF Cable.

    Steps - 5 ( 0f 7 )

  • Switch on the power with the help of Power Switch of AVR Trainer Board-100.

    Steps - 6 ( 0f 7 )

  • Download AT24C01 EEPROM Byte Read & Write with ATmega16 and LED Display Hex file to AVR Trainer Board-100 with the help of SinaProg Hex downloader and AVR USB Programmer.

    Steps - 7 ( 0f 7 )

  • Insert the DC Pin of 12V, 1A DC Adapter to the DC Socket of AVR Trainer Board-100.

    Steps - 1 ( 0f 7 )

  • Connect PortB header with LED data header in AVR Trainer Board-100 with a 10 to 10 FRC Female Connector.

    Steps - 2 ( 0f 7 )

  • Connect the EEPROM & RTC header of EEPROM & RTC with PortC header of AVR Trainer Board-100 with a 10 to 10 FRC Female Connector.

    Steps - 3 ( 0f 7 )

  • Connect the ISP header of AVR Trainer Board-100 with AVR USB Programmer header of AVR USB Programmer with a 10 to 10 FRC Female Connector.

    Steps - 4 ( 0f 7 )

  • Connect the AVR USB Programmer to the PC/Laptop's USB Port directly or with the help of USB AM-AF Cable.

    Steps - 5 ( 0f 7 )

  • Switch on the power with the help of Power Switch of AVR Trainer Board-100.

    Steps - 6 ( 0f 7 )

  • Download AT24C01 EEPROM Byte Read & Write with ATmega16 and LED Display Hex file to AVR Trainer Board-100 with the help of SinaProg Hex downloader and AVR USB Programmer.

    Steps - 7 ( 0f 7 )

Downloads

AT24C01 EEPROM Byte Read & Write with ATmega16 and LED Display C File
  • 0 downloads
  • 2 Kb
AT24C01 EEPROM Byte Read & Write with ATmega16 and LED Display Circuit Diagram
  • 0 downloads
  • 85 Kb
AT24C01 EEPROM Byte Read & Write with ATmega16 and LED Display Hex File
  • 0 downloads
  • 2 Kb
TWI Header File v1.0
  • 313 downloads
  • 2 Kb
AT24CXX Header File v1.0
  • 68 downloads
  • 2 Kb

Comments