Friday, August 15, 2008

Interfacing RTC & serial EEPROM using i2c bus, with ATmega128 uC






















Hi friends,
here is my experiment with i2c bus for interfacing serial EEPROM (24C256) and RTC (DS1307) using AVR microcontroller ATmega128. The circuit is also provided with an RS232 port for connecting with PC to send commands for reading/writing EEPROM or setting date/time in RTC (Click on images to enlarge them).

Communication with PC is done through Hyper Terminal. A screen shot of the message sent to PC by microcontroller immediately after power ON is shown in the figure at the left, where the user is asked to enter choice from the menu options related to EEPROM and RTC. User can store data in EEPROM, or set RTC date and time by entering them using PC keyboard.
Hyper Terminal is used with 19200 Baud, No parity, No hardware flow control settings.

When the circuit is powered on, a welcome message is displayed on the Hyper Terminal window and a menu with 9 options (0-8) is displayed (refer to the figure). The options are explained here:

0: Erase EEPROM (fills eeprom with 0xff bytes)
1: Write EEPROM (starts writing eeprom starting with 0x0000 address)
2: Read EEPROM (reads eeprom starting with 0x0000 address)
3: Write eeprom page (writes one page of eeprom at specified page number)
4: Read eeprom page (Reads one page of eeprom at specified page number)
5: Display RTC Date (Displays current date from RTC)
6: Display RTC time (Displays current time from RTC)
7: Update RTC Date (Setting new date in RTC)
8: Update RTC time (Setting new time in RTC)

The option is selected from PC keyboard. While writing to eeprom or RTC the data is entered using PC keyboard as specified by the program.

The software routines include DS1307 library, 24C256 library & I2C library along with the main function.

The code is written in C using winAVR (inside AVRStudio). The complete project folder can be downloaded here in zip format (updated on 25-April-2009, earlier it was in ICCAVR format):

Here is running simulation on Proteus ISIS (click on image to enlarge it):


Downloads
------------------
Complete Source code (winAVR, AVRStudio-4 format)
Proteus Simulation Model


Datasheets:
ATmega128DS1307FM24C256,  MAX232

Thanks!

(last updated on 25-April-2009)
---------
ccd@dharmanitech.com

118 comments:

  1. Hi Dharmani, this is manoj. I want to know its function and brief explanation of the circuit if possible. And send the library function u have created, i will try to understand it. My ID manojlenin@gmail.com

    ReplyDelete
  2. Hi Dharmani, Iwanto try your project would you send me the complete files to bina.pratomo@yahoo.co.id
    Thanks.

    ReplyDelete
  3. Thanks for your interest,guys!! I've sent u the program files, hope u find them useful.. post here if any doubt is there..
    Thanks.

    ReplyDelete
  4. hi...i'm interested in this EEPROM..By the way, can i use it in Microchip PIC?
    Please send me the files at bbs_aries@yahoo.com for me to try it..thanks

    ReplyDelete
  5. Hi Aries,
    yes, you can use PIC micro with this EEPROM. Actually, any microcontroller having i2c bus can be interfaced with this EEPROM.
    I've sent you the files, they'll need some modifications as they're written for AVR controller.
    Thanks!

    ReplyDelete
  6. Hi Henric,
    I've sent you the source code and header files (total 6 files, zipped) at your mail id. Mail me or put up a comment here if any problem in receiving or any remarks about the libraries.

    Regards.

    ReplyDelete
  7. To Hossein:
    Hi, I've sent you the complete source code in zip format, as u requested by mail. If any problem in receiving the files, put up your comment here or write to me.

    Regards.

    ReplyDelete
  8. Hi Dharmani, I want to try your project. would you like to send me the complete files to andi2302@gmail.com
    Thanks.

    ReplyDelete
  9. Hi 'andi',
    I've sent you the code on your email id, check it out!

    Regards.

    ReplyDelete
  10. Hi Dharmani, this is Chetan from Mumbai.. I'm working on a project which involves Atmega128 and the storing of incoming data into its memory with the corresponding real time value. For this i wish to use the in-built RTC system at timer/counter 2 of Atmega128. But as it seems for your project, you have used an external RTC 'DS1307'. So, i was wondering if the internal RTC would lead us into some bugs. Would you guide us with the above confusion and suggest some alternate method for our requirement. Thank you.

    ReplyDelete
  11. hi Chetan,
    If you use internal Real Time Counter of ATmega128, the programming overhead increases as you have to write a code to keep counting the pulses, convert them into seconds, minutes, hours etc. Also, the program has to keep track of change of the day, month, 30 or 31 day month, leap year etc.
    Apart from this, you have to keep the MCU always powered ON. If you provide battery backup, it'll consume more power than an external RTC.

    If you use extrenal RTC like DS1307, all the calculation of day/date/month etc. are done inside. Whenevr you want to know the time, you've to just read the registers of the RTC and you'll get current time in hour/minute/sec with date/day and year.
    Plus, even if the system is powered off, the RTC keeps running with external 3v lithium cell (which can last for years). So, next time when you power on the system, you'll get current time ready!

    So, for your application, to have the real time-stamp on the data stored in memory, it would be much easier to use an ext. RTC. RTC chips are available cheap and they take only two pins of the microcontroller for communication.

    Regards.

    ReplyDelete
  12. Hi Dharmani, this is Shiv .I want to try your project can you send me the files regarding this project. My ID is hurricane.shiv@gmail.com

    Also help me with the programmer and the software needed for programming the IC and for establishing the connection between the PC n circuit.

    Thank you

    ReplyDelete
  13. Hi Dharmani, this is Chetan once again. I really appreciate your efforts to help me out. But, as you pointed out, let me tell you that my requrement is just for the time and not the day, month, etc. So, if the internal RTC can be easily programmed for the timing alone, then i may not have to switch to an external RTC.

    Secondly, as you said that the RTC consumes a lot of power and need to be switched on all the time, my application actually needs the system to be turned on all the time. So, i guess, the power consumption may not be an issue for me, but if the programming part is somewhat easy, then i was thinking of doing it with the internal RTC. Otherwise, if you think the other way, please let me know, and also, if you could help me with the coding of the external RTC, if required.
    Thanks once again.

    chetan8.jain@gmail.com

    ReplyDelete
  14. To Shiv:

    Hi, I've sent you the code by mail. check it out!

    ReplyDelete
  15. Hi dhramani sir,

    we r working with atmega 32. we r succefully initialise lcd. now we have confussion with adc.
    we want the information about temp conversion program with LM35

    ReplyDelete
  16. Hi Chetan,

    since you need only time and the system is powered on all the time, you can do it with the internal RTC also. You have to just take care of any power failure so that you don't loose the current time.

    For using internal RTC you have to use Timer/Counter0 (refer to datasheet). Set AS0 bit in ASSR register, connect 32.768KHz crystal between pins TOSC1 & TOSC2. Set timer0 prescaler to 128. This will make timer0 overflow at every 1 sec interval. You can then put in the code to count the seconds and convert them into minutes/hours.

    RTCs don't consume lot of power but they need constant power (regular supply or battery back-up) for maintaining time.

    If you want to use external RTC, I've given in this post the 'Download Code' link where you can get the DS1307 & I2C libraries.

    ReplyDelete
  17. Hi Swati,

    since LM35 gives voltage output (10mv/C), you can connect the output pin of LM35 with any ADC channel (if you are not using channel-0, then connect it to channel-0).

    Refer to my post:
    http://www.dharmanitech.com/2008/10/adc-project-with-atmega32.html

    There I've given code and schematic on how to use mega32 ADC for measuring voltages. Once you know the voltage o/p from LM35, just to divide it with the sensitivity (10mV/C) to get the temperature in Centigrade.

    ReplyDelete
  18. Hi Dharmani, this is Shiv .Can you suggest me a text book for -Programming of ATMEGA128(AVR) in both C language and ASSEMBLY language..or in case u have any E-Book regarding the same can u mail it to me at hurricane.shiv@gmail.com . I have a month time so i wanted to have through knowledge of the AVR programming.

    Thank you...!

    ReplyDelete
  19. Hi Shiv,
    there are some books on AVr, you'll find them if you search on net. But I won't be able to suggest any as I've never gone thru any book on AVR.
    I usually prefer to go thru the datasheet, download a compiler and go thru its example programs. Start with a simple port interfacing (like flashing an LED) and then keep learning other modules like UART, TWI, SPI by programming and referring to datasheet.
    It won't take longer as there is lot of help available on net for AVRs. You'll get code examples for almost anything in AVR.

    ReplyDelete
  20. Dharmani at India, I have old IC paralel EEPROM 27256 from my VGAcard (VIDEO BIOS?) could u design for me the scheme how to display 8 bit data from that? thanks (i want make matrix LED e-toy)

    ReplyDelete
  21. Hi satpambobo,
    27256 is an UV erasable EPROM. For reading from it you need a microcontroller.
    I think you want the toy to display variable patterns. If it is so, you can rather use a microcontroller with inbuilt flash (like the AVRs), this will eliminate the need of the 27256 and also, you can erase/rewrite it whenever you want electrically (rather than searching for UV light source to erase 27256).

    Regards.

    ReplyDelete
  22. thanks 4 u reply. but mine, doesn't have hole glass to erase with UVlight. i think it's Electronicaly EPROM. I found Alan Nishioka Page that use 4040 counter to play 27256.

    ReplyDelete
  23. hi Dharmani. if i wish to use 89c51 ..can u suggest what could be the possible changes in interfacing rtc n eprom u have used for atmega and also what would be the change in programs u have provided...!

    ReplyDelete
  24. To Shahi:
    Hi shiv, left the thought of using avr? :)
    Anyways, as 8951 doesn't have i2c in hardware, you'll have to create low level functions to handle i2c bus timings, using two i/o pins of 8951.
    In the program which i've provided, you'll have to replace the i2c library with your new library of software i2c. remaining routines you can use without changes.
    Search on the net, there are many examples on how to write software i2c routines.

    ReplyDelete
  25. can i use same programme for atmega 16? I want to store values of temperature,pressure and level in eeprom and want to display the same value at any time with date and time
    Name Amol Suryaji Chaudhari
    ID coolchaudhariamol@gmail.com

    ReplyDelete
  26. Hi amol,
    interfacing these RTC & EEPROM will need i2c bus, and since the atmega16 is having it, you can certainly use it.
    You'll have to change the program little bit, mostly the header file, to use it with ATmega16.

    ReplyDelete
  27. Hi Dharmani,
    I Used your RTC and i2c libraries and I'm very happy with it. I added a function to set the sqw output, my avr is now using the ds1307 rtc and it run a state machine, clocked by the ds1307 sqw on the ext int0 (sec). Very nice!
    Now I try to add functions to read and write to the ds1307 sram. For some reason, I do not get back what I write to it. Do have a sample for these functions lying around, or do have a hint why I don ot get the same value back that I wrote to a memory location?
    In RTC_routines I added functions for read and write like this:
    i2c_sendAddress(DS1307_W)
    i2c_sendData(address);
    i2c_sendData(IObyte);

    Best regards, Kopke

    ReplyDelete
  28. Sorry, made a type in my code, the return type was not good. All is working ok now! Thanks for the inspiration you brought me!

    ReplyDelete
  29. Glad to know you solved it soon!

    Regards.

    ReplyDelete
  30. hi Dharmani,
    I want complete my project monitoring humidity and temperature, result monitoring save on SD/MMC and display on LCD 20x2,,but i can't display date from ds1307 and valid data from SHT11,please give me complete code on c language i am use compiler codevision avr,,
    i am connect
    SHT11
    pin DATA to ATMega8535 port D2
    pin SCK to ATMega8535 port D3

    LCD
    pin LCD to ATMega8535 port C

    SD/MMC 1Gb
    ATMega8535 port B5(MOSI) to pin SDO SD/MMC
    ATMega8535 port B6(MISO) to pin SDI SD/MMC
    ATMega8535 port B7(SCK) to pin SCK SD/MMC
    ATMega8535 port B1(T1) to pin CS SD/MMC

    RTC DS1307
    pin SDA to ATMega8535 port B1
    pin SCL to ATMega8535 port B2

    serial port (USART) ATMega8535 to PC
    you can send code to my mail ardi_sandi302@yahoo.co.id

    tanks your attention and solution

    ReplyDelete
  31. Hi,
    nice project! I've sent you the source code files for my project given in here. The files are written in ImageCraft ICCAVR compiler. you can easily convert them into CodeVision by making a few changes.

    Regards.

    ReplyDelete
  32. sir I want the information regarding pressure sensor,
    level sensor and rpm measurement.
    give the sensor's names.

    ReplyDelete
  33. Hi....

    Im trying to interface EEPROM with 8051 in C language. I have written a code also for it, but its not working. Can u send some code related to this on this mail id-
    engg.embedded@gmail.com
    Thanks in advance...

    ReplyDelete
  34. Hi,
    I've sent you the EEPROM & ic libraries. But, since the AVR controllers are having inbuilt i2c(TWI) bus hardware, the AVR i2c library will not be of much use here. You have to replace it with the software i2c library written for 8051 controllers to use the EEPROM library functions I sent.

    ReplyDelete
  35. Hi Dharmani,
    Your Project is very good.I wanto try your project would you send me the complete files to xrizkix2000@yahoo.com
    Thanks.

    ReplyDelete
  36. Thanks Rizki! I've sent you the files.

    ReplyDelete
  37. hi,

    Your project is really good to learn from. Thank you!

    Could you explain just a bit how the multiplexing of the I2C from the microcontroller to the RTC chip and the FRAM chip is done? It looks like that when you initiate I2C protocal to the FRAM chip, the RTC chip would be affected as well and vice versa. Thanks.

    ReplyDelete
  38. If you go thru the I2C bus details, you'll find that every device on the I2C bus has a unique address. The microcontroller sends the address on the bus before sending any data, so only the device whose address is matching will respond to the data. All other devices on the same bus would just ignore it.
    This is the advantage of using I2C bus, with just two wires, you can connect multiple devices with different addresses. You do not need a separate 'chip select' signal for every device to enable or disable it.

    ReplyDelete
  39. I am getting problem with serial communication i have used atmega16 8 Mhz crystal and boud rate 9600
    hyper terminal shows only '@@@@@@'
    plz solve it

    ReplyDelete
  40. hi dharmani, i have digitalclock project.
    use RTC ds1307 and AT89s51, display 7segment. i wnt to make 5 slave and send with serial communication use rs485. please help me.
    thanks

    ReplyDelete
  41. Hi! Dharmani,
    I found your site to be very useful. I've managed to interface DS1307 RTC with 89C51RD2 successfully and also able to read & write to the 56Byte RAM available. I want to write the date/ time stamp and temperature to AT24C512 Serial EEPROM. Some how I'm getting an Error. When I run my EEPROM routines It works fine, in combinatio with RTC it fails showing garbage values. Can you please help me with the EEPROM routines? I want to write in locations 0 to 30,000.

    If you have any eeprom program please email me

    Thanks in advance!

    ReplyDelete
  42. Hi! Dharmani,
    I found your site to be very useful. I've managed to interface DS1307 RTC with 89C51RD2 successfully and also able to read & write to the 56Byte RAM available. I want to write the date/ time stamp and temperature to AT24C512 Serial EEPROM. Some how I'm getting an Error. When I run my EEPROM routines It works fine, in combinatio with RTC it fails showing garbage values. Can you please help me with the EEPROM routines? I want to write in locations 0 to 30,000.

    If you have any eeprom program please email me at 17.moses@gmail.com

    Thanks in advance!

    ReplyDelete
  43. hi dharmani, i have digitalclock project.
    use RTC ds1307 and AT89s51, display 7segment. i wnt to make 5 slave and send with serial communication use rs485. please help me.
    thanks
    send me at: imron.polines@gmail.com

    ReplyDelete
  44. hi dharmani, i have digitalclock project.
    use RTC ds1307 and AT89s51, display 7segment. i wnt to make 5 slave and send with serial communication use rs485. please help me.
    thanks
    imron.polines@gmail.com

    ReplyDelete
  45. hi dharmani, i have digitalclock project.
    use RTC ds1307 and AT89s51, display 7segment. i wnt to make 5 slave and send with serial communication use rs485. please help me.
    thanks
    imron.polines@gmail.com

    ReplyDelete
  46. hi,

    i need to try your porject, could you send me the files? my email is luix_mac@hotmail.com


    thanks for your time
    luis

    ReplyDelete
  47. Hi Dharmani, I'm interested in the DS307 library you mentioned.

    Can you send me the files.
    Thanks a lot!

    Here is my email :

    v2102ap@gmail.com

    ReplyDelete
  48. Also, if you don't mind, what is the program you used for drawing the schematics? Where can I download it?

    Thanks again!

    ReplyDelete
  49. Hi, I've sent you the files.
    I use EAGLE for drawing schematics, you can download it from this link:
    http://www.cadsoft.de/download.htm

    ReplyDelete
  50. hello

    i am using your program and have worked on. But there is a problem how to write data in RAm of DS1307. when i write data in RAm it stops upgrading time. plz help me to solve this

    ReplyDelete
  51. you can reply me on asif164@ohtmail.com

    ReplyDelete
  52. I want to try to implement this RTC and serial EEPROM using I2C bus. Could you plaes send me the complete project files (schematics+sources+libs)
    Regards,
    Althaf
    msheikalthaf@yahoo.com

    ReplyDelete
  53. would you send me the complete project file. i just want to learn your project, it seem very interesting.
    Regards,
    Iman
    iman_parta_kusuma@yahoo.com

    i will wait for your e-mail...thanks

    ReplyDelete
  54. Great Article ! Can you please help me change the header files to use atmega32 instead of 1280 . i would be greatful if you can send me modified files to webrains@gmail.com

    cheers
    sumeet

    ReplyDelete
  55. please tell me how to interface i2c to atmega 8535 as i didn't find any sda and scl pin in it

    ReplyDelete
  56. how to interface i2c to atmega 8535

    ReplyDelete
  57. Hi Rahul,
    Atmega8535 is having i2c bus (TWI) on-chip. Pin22 & 23 are SCL & SDA pins respectively. You can use i2c functions provided in this post.

    ReplyDelete
  58. Hi Dharmani sir,
    I am from jodhpur presently student of MBM Engg college.
    I used your rtc interfacing code for atmega8 and it really worked very
    good. I am very thankful to you for this help. Sir, I want to share my
    further problem regarding to my project please help me.

    It uses timer1 in ctc mode at almost 500ms delay. Each time
    it flips a volatile uint8_t TIMER_FLAG. An another code in main program
    activates whenever TIMER_FLEG is not zero read rtc and display SS/MM/HH
    to hyper terminal. This code also flip a LED each time also. It works quite
    well.

    Along with timer1 It also uses INT1 in falling edge trigger mode. INT1 ISR
    disturbs the previous code and bring the compiler out of previous and send
    another message to hyper terminal. It also works quite well.

    Problem is that sometime (after few minutes or several minutes) all of
    sudden LED stops flipping as uC were gone in sleep mode. As soon as INT1 is
    applied LED again starts flipping. I have take a number of tests for debuging
    but failed to find fault. microcontroller uses internal 8MHz oscillator.
    INT1 is applied through a TSOP1738 (Vout of TSOP is connected at pin D3) and
    a normal TV remote. It is not using any type of sleeping mode.

    //////////////////////////////////////////////////////////
    /* I used timer in no prescale mode for pssible removal of
    problem so I used LED_cnt to increase delay*/
    ////////////////////////////////////////////////////
    ISR(TIMER1_COMPA_vect)
    { if(LED_cnt>=50)
    {
    LED_cnt=0;
    TIMER_FLAG=1;
    }
    else
    LED_cnt++;
    }
    ////////////////////////////////////////////////////////////
    SIGNAL(SIG_INTERRUPT1)
    /* signal handler for external interrupt int1 */
    {
    INT_flag=1;
    }
    ////////////////////////////////////////////////////////////

    //////// main program///////////////////////
    void main():
    {
    while(1)
    {
    while(!INT_flag)
    {
    if(TIMER_FLAG)
    {
    TIMER_FLAG=0;
    bit_flip(PORTD,1);
    ....... .
    ////////////code to send SS/MM/HH to hyper terminal////////////
    ........
    .......
    ////////////////////////////////////////////////////////////
    }
    }
    uartsendstring("interrupt called");
    INT_flag=0;
    }
    }

    Please suggest me some solution to remove this problem.

    ReplyDelete
  59. hi, this is poonam .i ma working on same project.can you tell me that why eeprom is used with RTC
    can you send me details on poonamkothawade@yahoo.co.in

    ReplyDelete
  60. Hi i am working on with the rtc1307 with 8051. When i tried entering the time through serial com port through the pc the controller resets again.
    I have taken the code from the 1307 datasheet. Plz help
    dis is d link of the code

    http://www.maxim-ic.com/appnotes.cfm/an_pk/95

    and dis is my email:
    plz reply

    pradeep.mirchandani@gmail.com

    ReplyDelete
  61. Hello! I send mail to author and repost my troubles here
    I'm using ATMega16 and AT24C128 EEPROM. Also, I use this datasheet www.atmel.com/atmel/acrobat/doc0670.pdf
    First of all I'd want to clarify erasing algorithm. As I see, you use "page write" algorithm to write 0xFF bytes to whole memory. But it's not writing to whole memory, it's write only first page. In datasheet on page 10 quote

    If more than 64 data words are
    transmitted to the EEPROM, the data word address will “roll over” and previous data will be
    overwritten. The address “roll over” during write is from the last byte of the current page to the
    first byte of the same page.

    I'v write new erasinc procedure, that erasing by pages. If I'm not right - correct me.
    Second moment - delay between stop and start conditions. If I try to write two bytes in sequence, MCU hangs up when waiting start condition for second write procedure. But if I make delay between two write procedures, everything is Ok. In datsheet somsing about ACKNOWLEDGE POLLING on page 10 but I don't know how to embed it in your code. But your routines help me great - thank you. Could you help me in my two troubles?

    ReplyDelete
  62. Hi mr Dharmani and hello from Canada.
    I find your article very usefull and well written, and I am trying right now to port the code to an ATmega 644.
    I have changed a few things but it still does not work. I am not completely new to atmega but I am to AVRstudio and I am a bit lost!! can you help me on that one. I understand I have to modify the ports allocation: i2c on port C and rs232 on port D.
    Then I went on the project settings, in fact I created a new project with a 644 at 20mhz clock. It compiles with no errors but I get those messages in the message window:
    Loaded plugin STK500
    Loaded plugin AVR GCC
    Loaded partfile: C:\Program Files\Atmel\AVR Tools\PartDescriptionFiles\ATmega128.xml

    I am not to sure about the implications of these, can you clarifie this to me.
    AVRstudio is truly a great suite but finding my way around is somewhat complicated by the fact that I am completely new to GCC and that sort of things, I whish there was a single for it!
    Thanks, Luc

    ReplyDelete
  63. Hello

    My name is John and I am trying to store and then display nmea strings from a gps using the mega324p with an i2c eeprom.

    I have managed to write all the nmea strings to the eeprom, my problem is now to try and read and display them in Hyper Terminal.

    At the moment in my circuit simulator I am able to see the data being stored, but when I try and read the data that has been stored it does not go the eeprom addres I was expecting.

    I am using a RS232 conection to the pc.

    Here is the c code:

    #define EEPROM_RD 0xA1
    #define EEPROM_WR 0xA0

    TWI_Start();
    TWI_Write(EEPROM_WR); // write command
    TWI_Write(0x00); //MSB
    TWI_Write(0x01); //LSB
    TWI_Start();
    TWI_Write(EEPROM_RD); // read command
    // TWI_Write(0x00); // Address what I


    TWI_Read();


    TWI_Stop();

    /*Functions for write and read from the EEPROM*/

    void TWI_Start(void)
    {
    TWCR = 1<< TWINT|1<<TWSTA|1<<TWEN;// repeated start condition
    while(!(TWCR & 1<<TWINT));
    }

    void TWI_Write(uint8_t data)
    {

    TWDR = data;
    TWCR = 1<< TWINT|1<<TWEN;
    while(!(TWCR & 1<<TWINT));

    }

    void TWI_Stop(void)
    {

    TWCR = 1<< TWINT|1<<TWSTO|1<<TWEN;
    _delay_ms(1);
    }

    //* TWI Read Function *//

    uint8_t TWI_Read(void)
    {

    // start read transmission
    TWCR = 1 << TWINT | 1 << TWEN;
    while (!(TWCR & 1 << TWINT));
    return(TWDR);// returns the data from the written file.

    }
    my email address is tuckerj1@aston.ac.uk.

    Please feel free to give me some tips.

    Many thanks for your time.

    John

    ReplyDelete
  64. Hi Dharmani, this is kumar. from past week we tying to interface ds1307 with atmega32 we have tried al the codes ...but can't.so please help us

    ReplyDelete
  65. hi dharmani, Can you give examples of programs with codevision. The same with your schematic. this is email(amin3vdc@gmail.com)

    ReplyDelete
  66. Hi Dharmani sir,this is Mithilesh. we are working on a project,data logger into micro sd card , but we are facing problem with interfacing it with microcontroller.Can you please help us out..my email id is mithilesh1dhupia@gmail.com

    ReplyDelete
  67. Check out my post on microSD card interface with AVR:
    http://www.dharmanitech.com/2009/01/sd-card-interfacing-with-atmega8-fat32.html

    ReplyDelete
  68. please help me on how to interface micro SD card to ATMEGA8535..kindly please let me know..:)

    ReplyDelete
  69. hello sir,i am a beginner in Embeddedsystem.can u send me notes on Embedded C and how to write sourcecode for a task.my id is punit05.namdeo@gmail.com

    ReplyDelete
  70. Hi Dharmani,
    Quick question, the erase function does not work for me, any idea if I should be adding the repeat start ondition in the for loop, cause as per the simulation in ISIS only the first page i.e page 0 seems to get erased. All other pages stay intact even after erase.

    ReplyDelete
  71. hlo dharmani.
    I am building a room scanner bot using atmega16 and want to interface rtc and eeprom as you did. Kindly send me the complete description on mani2246@gmail.com it will help me a lot

    ReplyDelete
  72. can u please post one sample program for analog comparator using atmega162.

    ReplyDelete
  73. Hello Sir,i am working on project where I am using RTC 1307 and EPROM 24c04 to display time and when interrupt come, controller should capture that time and save it on eprom memory.Would you please tell me the c code for it.I am working with AT89C51 controller.

    ReplyDelete
  74. hi dharmani sir, this eeprom function is used only one eeprom (24c256). but i want connect 4 eeprom. how to write coding sir, eeprom has four difference address modes, so how to select purticular address of eeprom and write sir, please help me

    ReplyDelete
  75. hey guyz iam ssebabi godfrey,
    can u pliz get the full c code for interfacing PIR sensor with MCU atmega128 avr

    ReplyDelete
  76. hi dhramani
    i want to interface atmel eprom AT27LV010A OTP EPROM for my project
    and i don't know how b/c on the data sheet in programing mode it needs 13v vpp so how to do this with atmega 32 please help me

    ReplyDelete
  77. Dear Dharmani,
    Can you send me all the files,function codes to my mail drtvskuthsav@gmail.com
    Thanks in Advance
    -Kuthsav Thattai

    ReplyDelete
  78. Thank you very much!!!

    ้http://www.10logic.com

    ReplyDelete
  79. Hi! Dharmani,

    this is Michael!
    i was looking to your web and i found what i m looking for,
    i m trying to save captured frame from a camera device to the 256K EEPROM,the cam frequency is 13.5MHZ and in your code you didn't mentioned anything about the TWI frequency neither you imported the ,please leave a reply on mickel-haddad@hotmail.com,

    thanks in advance,

    Michael .

    ReplyDelete
  80. hai dharmani,

    My self ravi...

    i would like to interface rtc DS1307 and EEPROM 24C04 to 8051 micro controller using i2c communication i have written individual codes for both working fine but when i am combining both it is not working can u please help me.....

    my mail id: ravidegala74@gmail.com

    ReplyDelete
  81. Hey, this works great... but I have maybe a noob question ... but.. why it is not the max232 ic on proteus? I test it and it works without it but when I connect it to a max232 (on proteus) it doesn't work... should I use always serial comunication on proteus without max232?

    ReplyDelete
  82. @Jcrx:
    In proteus, the virtual terminal supports direct UART signals, not RS232 level signals. Hence, you need to use the terminal without MAX232. If you want to use MAX232, you need to use two of them for converting the UART level to RS232 level and then back to UART, just the way it happens when you connect the actual circuit to PC.

    ReplyDelete
  83. Sir, is it applicable to PIC 16877A??

    ReplyDelete
  84. Hello dharmani

    Your blog is pretty good.

    This is very useful project for me.

    I tried to to download but the link is not working.

    Can you refresh the link or send me all the files?

    My e-mail : emrah3535@gmail.com

    Thank you very much.

    ReplyDelete
  85. Hi Emrah,

    I checked, the download links are working. But anyways, I'm sending the files to your email address!

    ReplyDelete
  86. Hai Dharmani,
    I am gokulraj. I am using rtc1307 interfaced with at89c52 controller. I have a problem of displaying the garbage values. When i start the simulation the rtc will set accordingly and it will run well. But after few seconds it will display the garbage the values in lcd display as well as in the rtc time displaying window..... Pls help me to resolve this problem...

    Thanks in advance.

    ReplyDelete
  87. I can't find configuration Fuse
    please send me.
    best regards.

    ReplyDelete
  88. can i do this i2c interfcng using atmega32 ???

    ReplyDelete
  89. what hardware components are required if i just have universal programmer wid me?

    ReplyDelete
  90. Hi Dharmani, your project is very helpful. Please send me all the supporting files to abhijeet.tawar007@gmail.com. Thank You.

    ReplyDelete
  91. HELLO SIR '; please can you send me
    all files @ vermashailendra403@gmail.com

    ReplyDelete
  92. Hi Dharmani, i trying to convert this
    "Interfacing RTC & serial EEPROM using i2c bus, with ATmega128 uC" code into atmega32, i have modified the code but still i m not getting output in proteus. so please can u help me with this ? can u send me the modified code of atmega32 nd proteus file too ?

    ReplyDelete
  93. And my email id is hva12@entc.maepune.ac.in
    -->Vrushali

    ReplyDelete
  94. hi sir i have tried this code on atmega16 ..but it shows error....plz send me the modified code for atmega 16...my email-tazmin18@gmail.com

    ReplyDelete
  95. Could anybody tell me what changes to make in the header file to make it work with atmega32 ?

    ReplyDelete
  96. Hi!

    It`s a very nice project!! I`m creating something very similar but I`m kinda stock in how to know the address of each device. I'm connecting an Arduino328 (master), a PIC12F675 (slave)an EEPROM and a RTC but I don't know how to get the Address of the last two ones.

    I would really appreciate your help! My email is msn at dorianmtz.com

    Thank you in advance!

    ReplyDelete
  97. @Dorian you can get address of the device from their datasheet.
    For RTC(DS1307) it is 0xD0 and for EEPROM (24LC128) it is 0xA0 provided that you connect A0,A1,A2 pins of EEPROM to ground. you should change the last bit according to your operation whether it is a read(1) or write(0).
    reply if you need any other help: Sandeepsinghdeora1994 at gmail.com

    ReplyDelete
  98. hai sir,

    this is sasi. i am using Atmega128 interfacing with EEPROM 24LC512. I am using Codevision AVR compiler. i need to adapt your AVR Studio project file to codevision AVR c code. please send me project file in codevision AVR to sasirekaece@gmail.com

    Thanks,
    sasi

    ReplyDelete
  99. hi sir, i want reference code to write my own eeprom accessing code, and i am using Atmega2560 (Not arduino) and i have i2c attach files, please can you send me a reference links : sanjisrinivas@gmail.com

    ReplyDelete
  100. Mr CC Dharmani please I need your help
    I try to do your project but it does executed I use ImageCraft ICCV8 for AVR it told that he has problem with library waht can I do
    PlEAAAAAAASe help me

    ReplyDelete
  101. Hi Dharmani sir, i want to try your project, would you please me the complete files to vaswanipratik@gmail.com,,,,,

    ReplyDelete
  102. Dear Concern,
    I a hobbyist. So i am interested to make a sample project . which is below:
    1.writing variable length floating value in atmega32 internal eeprom.
    2.reading that value and display it in LM044L LCD. now if power is off in mc. after that it will again display that previous saved

    value.

    Please tell your suggestion.
    Awaiting for your reply.

    ReplyDelete
  103. hello,
    Thanks for the great work your doing. I have one question from the file EEPROM_routines.c

    while((data = receiveByte()) != 0x0d)
    {
    transmitByte(data);
    if(data == 0x0d)
    transmitByte(0x0a);
    errorStatus = i2c_sendData(data);
    if(errorStatus == 1)
    {
    transmitString_F(PSTR("EEPROM write data failed.."));
    i2c_stop();
    return(1);
    }
    }

    What to the lines above do especially:

    - why do you use the condition ((data = receiveByte()) != 0x0d) in the while, what are you trying to do

    From that section I figure your trying to read each character being entered from the terminal but i've not yet figured out how your doing it.

    ReplyDelete
  104. Also, why do you transmit the data received back to the computer:
    while((data = receiveByte()) != 0x0d)
    {
    transmitByte(data);

    ReplyDelete
  105. HI,
    I think i get the code now
    the condition ((data = receiveByte()) != 0x0d) in the while is checking if the data user pressed the enter key

    the
    data = receiveByte(); transmitByte(data);
    is transmitting the data received so that it can be echoed on the terminal


    Thanks again for the good work

    ReplyDelete
  106. Hello sir, I am prajwala. I will like to do thise project can you please send me deatiled code and information of this project
    Emial id- prajwaladedoe@gmail.com

    ReplyDelete
  107. hi sir , this is chandrasekar
    can you please send me Lcd_routines for the above project.

    mail id : chandrasekar.79@gmail.com

    your postings are really good.

    thank you.

    ReplyDelete
  108. hi sir , this is chandrasekar
    can you please send me Lcd_routines for the above project.

    mail id : chandrasekar.79@gmail.com

    your postings are really good.

    thank you.

    ReplyDelete
  109. PdfBama PdfBama website serves as a reference for downloading academic books, articles and pamphlets and student projects.

    ReplyDelete
  110. Dharmanitech is an innovation blog giving quick data and updates about different parts of innovation, including devices, programming, and industry patterns. With an emphasis on demystifying complex tech points, this blog plans to make innovation open and separation before divorce reasonable for perusers. Whether you're a tech devotee or searching for down to earth tech exhortation, Dharmanitech offers an important asset for tech-related bits of knowledge and direction cuanto cuesta un abogado de divorcio en new jersey.

    ReplyDelete
  111. Processing payments for medical services can be made easier and more convenient with the use of Medical Credit Card Processing. This innovative solution allows healthcare providers to securely accept payments from patients using their credit cards. By implementing this system, medical practices can streamline their payment processes, reduce administrative tasks, and improve overall patient satisfaction.

    ReplyDelete

  112. "Design with Microcontrollers" is an invaluable resource that demystifies the world of microcontroller-based design. The book combines comprehensive insights with practical examples, making it accessible for both beginners and experienced engineers. With a focus on real-world applications, it guides readers through the intricacies of microcontroller programming and interfacing. Theseguro dui clear and concise explanations, coupled with hands-on projects, ensure a holistic learning experience. Whether you're diving into embedded systems or looking to enhance your skills, "Design with Microcontrollers" stands out as an essential guide in the realm of electronic design.

    ReplyDelete
  113. In this project, an ATmega128 microcontroller is interfaced with a Real Time Clock (RTC) and a serial EEPROM over the I2C bus protocol. This is a popular and useful use in embedded systems where non-volatile memory storage and precise timekeeping are crucial. These parts can be connected to the ATmega128 via the I2C bus, allowing the microcontroller to access the EEPROM for long-term data storage and to communicate with the RTC to read and update the time. The system as a whole can operate with greater stability and dependability because to this integration. Enabling successful communication across the I2C bus requires proper component addressing and configuration. All things considered, this project demonstrates the adaptability and effectiveness of using the I2C bus to interface numerous devices withinGeneral law encompasses rules and regulations established by governments to maintain order, protect rights, and ensure justice. It includes civil, criminal, and administrative law, governing areas like contracts, property, and personal conduct. Law serves to resolve disputes, penalize unlawful actions, and provide a framework for societal functioning, ensuring fairness and security within the community.
    trucking accident law firms

    ReplyDelete
  114. In the context of divorce, the term "50/50 divorce" refers to an equal division of marital assets between spouses. While some states follow this model, most use equitable distribution, which aims for a fair, but not necessarily equal, division of property based on various factors.what states are 50/50 divorce

    ReplyDelete
  115. mobile repair Dubai services have become increasingly essential as technology continues to evolve. With an ever-growing number of smartphone users, the demand for efficient and reliable repair solutions has surged. Residents and visitors alike can find a variety of services, ranging from screen replacements and battery repairs to software troubleshooting and data recovery.

    Many repair shops offer swift turnaround times, often completing repairs within a few hours, allowing customers to stay connected without significant disruption. Trusted technicians utilize high-quality parts and cutting-edge techniques to ensure that devices are restored to optimal performance, meeting the needs of a diverse clientele.

    ReplyDelete