1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

ds1307 in assembly

Discussion in 'AVR' started by Toruk.makto, Feb 12, 2014.

  1. Toruk.makto

    Toruk.makto New Member

    Joined:
    Feb 12, 2014
    Messages:
    1
    Likes:
    0
    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. Mike odom

    Mike odom Active Member

    Joined:
    Feb 21, 2010
    Messages:
    670
    Likes:
    52
    Location:
    Kansas City, KS, U.S.A.
    This is from the DS1307 data sheet... vbat min = 2.0V, max = 3.5V
     

    Attached Files:

  3. Mike odom

    Mike odom Active Member

    Joined:
    Feb 21, 2010
    Messages:
    670
    Likes:
    52
    Location:
    Kansas City, KS, U.S.A.
    I don't suppose you have an oscilloscope you could check the waveforms with? Else, you need to slow down and do one thing at a time. I would suggest you first put the RTC in start mode, and make sure it responds. Your program looks like the sample in the data sheet, except you don't check the status flag. Instead of trying to write, read, then display, start with using a couple of LEDs as Status indicators. Turn one on to show you are operating, then when you check the status flag, if you get an error, then turn it off and turn the second one on. That way, you'll know if your going into start mode was successful, with both your micro setting the start mode, and the RTC responding to it (checking the status register is the only way to know that the RTC responded on the ACK line during the 9th bit time.
     

Share This Page