Ds1302

Jan 24, 2006 14 Replies

Have any one ever used a DS1307 RTC ?



give me the technical tips in handling it and also coding hints to interface it with Aduc841 microconverter.



Help please.



Thanks nava



Have any one ever used a DS1302 RTC ?

give me the technical tips in handling it and also coding hints to interface it with Aduc841 microconverter.

Help please.

Thanks nava

wrote

I'm sure plenty of people have, including myself.

When handling it, try to limit the amount of static electricity you expose it to. Also try not to bend the pins too much.

I don't know anything about Aduc841 microcontrollers, but if it has I2C capability you should have no trouble talking to it. I'm using a PIC

16F88 and manually bit-banging the I2C and it works perfectly. I have a DS1307 and two serial eeproms on the I2C bus. Every 30 seconds, the PIC takes a temperature reading (LM34), reads the clock and logs the data to the eeproms. It's been running for many months on a breadboard without issue. As long as you read the datasheet and follow its advice, you shouldn't have any trouble getting it to work. I have a lithium backup battery hooked up as well as a 5V supply that is switched on and off. I use the square wave output of the DS1307 to wake the PIC every second. Everything works just as it should. Currently, it is also blinking (50% duty) a blindingly bright, green LED (NTE-30038 10,500mcd typical) once per second.

The biggest problem I had in getting it to work was not using stiff enough pull-up resistors. I2C is pretty hateful about that kinda stuff. ;-)

there are some tips at:

formatting link
that may help

Don...

-- Don McKenzie E-Mail Contact Page:

formatting link

Micro,TTL,USB to 1.5" color LCD

formatting link
USB,RS232 or TTL to VGA Monitor
formatting link
World's smallest USB 2 TTL Conv
formatting link

Sir

I have tried i2c betwn two Aduc's.I have just only transmitted from the master and no receive process is done.

So the slave will receive the data and not transmits at all.

This is kept in interrupt polling in slave routine such as, when slave receives data from master the i2ci bit set in the I2CCON register of aduc841.(slave mode)

so in the interrupt routine i have just compliment a port pin to indicate that the slave had receive or responded to the master's request.

whether my procedure is correct?

____________________

steps for slave routine ____________________

configur aduc841in slave mode

enable interrupts

wait till interrupt occurs /* interrupt occurs when the master transmits to slave and the slave responds to it. */

if (interrupt) { cpl port // to indicate the slve's response }

is this is correct?

Note: Master transmission is checked only in simulation.when 0x80 given in code the shifted data such as 0x40 occurs in the simulation. This is keenly explained in (Aplli. Note uc001)from analog devices.

In my master routine i am sending address and data continuously. But there is no interrupt sense in slave. how to check this and whether any changes to be done. Kindly help me to solve the same.

reply expected eagerly

Thanking you, Nava.

How do you know the slave is listening? Are you sending the proper address?

I don't understand. It sounds like you have 2 microcontrollers, is that correct? Can you post a schematic of your circuit?

whether

You have to send the "address" of the device you are trying to communicate with.

Here is the PIC assembler code I use to communicate with the DS1307 RTC.

; To read the rtc, we have to set the address by pretending to do a write. Once ; we set the address, we abort the write by doing a STOP instead of transferring a ; byte to be written.

; Set address by starting a write procedure and then aborting it

call I2C_Start

movlw b'11010000' ; I2C /Write command to RTC call I2C_WriteByte call I2C_Ack

movfw rtcregister ; Set address to slot number call I2C_WriteByte call I2C_Ack

call I2C_Stop ; Abort the write after setting address pointer

; Now read from current address

call I2C_Start

movlw b'11010001' ; I2C Read command call I2C_WriteByte call I2C_Ack

call I2C_ReadByte ; Read in a byte movwf rtcvalue ; and save it

call I2C_SendNAck

call I2C_Stop ; Done

schreef in bericht news: snipped-for-privacy@g14g2000cwa.googlegroups.com...

What has that to do with a DS1302? DS1302 does not have a I2C interface.

Thanks, Frank. (remove \'q\' and \'.invalid\' when replying by email)

Respected Sir

Thanks for ur kind reply

regards Navaneethan.

DS1307 doesn't keep accurate time without an external capacitor - runs a few seconds a day out.

See latest datasheet.

David

David Collier

email can be sent to Dexdyne.com , under name from_usenet@

Respected Sir Please find my (Block Diagram) in your mail.

Regards Navaneethan.

wrote

That will not work, I do not post my real e-mail address to Usenet for obvious reasons. You need to post your diagram to alt.binaries.schematics.electronics, or use ASCII art to post it here.

You might find this useful:

formatting link

It is the "famous" Andy's ASCII-circuit program for producing ASCII art schematics.

a

Could you please elaborate more on that? I just download the datasheet and I don't see what you're talking about. The sheet I downloaded is REV 071405. There is no mention of an external capacitor in the document text nor in any of the schematics. BTW, I would expect a 20ppm crystal, combined with other factors to be off by as much as 2 seconds/day anyway.

Searched this for "capcitor" with no results:-

formatting link

Geo

Respected Sir

Please find the block diagram in

formatting link

Apllication note:uc001. for Aduc841 to Aduc841 communication through i2c. Regards Navaneethan

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required