Maker Pro
Maker Pro

ds1307 with atmega32 in assembly

Toruk.makto

Feb 12, 2014
2
Joined
Feb 12, 2014
Messages
2
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
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
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!
 

Toruk.makto

Feb 12, 2014
2
Joined
Feb 12, 2014
Messages
2
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!

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
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
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.
 
Top