Connect with us

ds1307 with atmega32 in assembly

Discussion in 'Microcontrollers, Programming and IoT' started by Toruk.makto, Feb 12, 2014.

Scroll to continue with content
  1. Toruk.makto

    Toruk.makto

    2
    0
    Feb 12, 2014
    i want drive a ds1307 with ATmega32 in assembly

    (ATmega32 works in 8 MHZ internal oscillator mode)

    i use this simple program for drive ds1307 and its not working ...

    leds randomly turn on and off the purpose of this program is first

    send primary Values to ds1307 (second/minute/hour/day/month/year)

    and then reading second and send it to porta.(to show on leds)

    would you please correct this program or write another simple program like this one

    (i am beginner in assembly and i searched internet and found nothing )

    attention: this mode i used in my program called hardware i2c mode which is used

    pc0 and pc1 as scl and sda.

    the program:
    http://www.mediafire.com/view/q2jvdprp4u3micz/ds1307+.asm


    schematic:
    http://img4u.ir/upload/427ds1307+.JPG
     
  2. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,271
    Nov 28, 2011
    Hello and welcome to Electronics Point.

    I can't help with your program because I'm not familiar with the ATmega32's I2C peripheral, but I did notice something you should fix.

    In the DS1307 data sheet, page 7, the description of Vbat pin says "If a backup supply is not required, Vbat must be grounded." Your circuit shows the Vbat pin floating.

    It is possible to monitor the activity on the I2C bus with another device, such as a fast microcontroller running some I2C capturing software. Also, some oscilloscopes can decode and display I2C activity. Do a Google search. Good luck!
     
  3. Toruk.makto

    Toruk.makto

    2
    0
    Feb 12, 2014
    i connect vbat to ground and leds show something else but it is not understandable and this is not enough and its not working at all
     
  4. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,500
    2,840
    Jan 21, 2010
    Are you using the arduino development environment? (It's not relevant whether you're using an arduino or a bare ATMega chip, I'm just interested in the software environment).

    If so, look here.

    Even if you're not, you could peruse the various libraries and code samples to see how they do it.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-