How to Reading DS1307 RTC single address?

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When i'm send Read DS1307 command through I2C,
DS1307 reply all data its have.(Time,Date,Data Register)

 

But i just want to know the time only.

whats the procedure thats give me only Time's data?

 

-
eRony

শূন্য  - The ZeRo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So you already have "read all" working?  Surely it is just a matter of specifying which register(s) you might want. 
Show your driver code, and sample complete test program.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why not just use the time data returned and throw away the rest? 

 

 

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

eRony wrote:

But i just want to know the time only.

whats the procedure thats give me only Time's data?

 

-
eRony

Your answer can be found on page 12 of this DATASHEET.

Look in section: 2. Slave Transmitter Mode (Read Mode):

And look at figure 5.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you use void functions,  you will get void answers.

 

It is a bit like driving a car blindfolded.    You might get to your destination.

 

Install a respected library.   Use the return values.    Get your program working.

 

Now that you have it working with round wheels,   you can start your square wheel development project.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

All of your I2C functions are void.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can solve your problem in 5 minutes by typing "AVR ds1307" into google and doing the slightest bit of research, or clicking on this LINK  where you can download a working library and follow the tutorial. The code you posted absolutely can not work. Sorry, I'm out.