user8060: I would like to use the DS1302, as a count up timer.
My goal is to have the arduino time the amount of me driving my car.
So it DS1302 will be used a count-up timer ie accumulate time. however when the car is switched off, I don't want to lose the value, and when I use my car again I would like to the time to continue accumulating. The resolution can be in minutes, as this will probably be the best.
I would like something like an odometer of a car, except its going to be the time, instead of distance.
Q: Can this be done with the DS1302 Module? and also how can I do this? Is there a sample code for a count-up timer?

user313: What you're describing is the equivalent of a digital Hobbs hour meters. You can read up about them if your are interested. The old ones (not digital in today's sense) clicked an odometer-like movement every 0.1 hours (typically). I don't think you need a real-time clock module as long as you're not interested in when you drove the car, but only in the accumulated duration.
A simple way would be a 1-minute delay loop that increments a counter and writes it to EEPROM. The EEPROM has a write-endurance spec of 100,000 writes, equivalent to over 800 hours, used this way. You'll lose the last fraction of a minute, whether it's a few seconds or nearly a while minute, whenever you shut down the Arduino. There are ways around this, if it matters, but that's an "exercise left for to the reader" as my textbooks used to say. Clock your micro with a crystal, not with its internal resonator, for best accuracy.

user2881: Do you mean only accumulate during powered/driving, or also during standing still? 
If the former, just get the start time in setup, then in loop continuously get the time and calculate the difference between it and the time read in setup. Since you don't know when power is lost you need to continually write the elapsed time to some form of non-volatile memory. You could use the Arduinos EEPROM, but that can wear out over time. It's better the use the DS1302s 31 byte of battery backed RAM. Next time the arduino starts up you need to read out this value and add this to the difference. 
In case of the latter, you can halt the DS1302 so it stops incrementing time.

8060: <p>I would like to use the <a href="http://playground.arduino.cc/Main/DS1302" rel="nofollow">DS1302</a>, as a count up timer.
My goal is to have the arduino time the amount of me driving my car.
So it DS1302 will be used a count-up timer ie accumulate time. however when the car is switched off, I don't want to lose the value, and when I use my car again I would like to the time to continue accumulating. The resolution can be in minutes, as this will probably be the best.</p>

<p>I would like something like an <a href="https://en.wikipedia.org/wiki/Odometer" rel="nofollow">odometer</a> of a car, except its going to be the time, instead of distance.</p>

<p><strong>Q:</strong> Can this be done with the DS1302 Module? and also how can I do this? Is there a sample code for a count-up timer?</p>
 313: <p>What you're describing is the equivalent of a digital Hobbs hour meters. You can read up about them if your are interested. The old ones (not digital in today's sense) clicked an odometer-like movement every 0.1 hours (typically). I don't think you need a real-time clock module as long as you're not interested in <em>when</em> you drove the car, but only in the accumulated duration.</p>

<p>A simple way would be a 1-minute delay loop that increments a counter and writes it to EEPROM. The EEPROM has a write-endurance spec of 100,000 writes, equivalent to over 800 hours, used this way. You'll lose the last fraction of a minute, whether it's a few seconds or nearly a while minute, whenever you shut down the Arduino. There are ways around this, if it matters, but that's an "exercise left for to the reader" as my textbooks used to say. Clock your micro with a crystal, not with its internal resonator, for best accuracy.</p>
 2881: <p>Do you mean only accumulate during powered/driving, or also during standing still? </p>

<p>If the former, just get the start time in setup, then in loop continuously get the time and calculate the difference between it and the time read in setup. Since you don't know when power is lost you need to continually write the elapsed time to some form of non-volatile memory. You could use the Arduinos EEPROM, but that can wear out over time. It's better the use the DS1302s 31 byte of battery backed RAM. Next time the arduino starts up you need to read out this value and add this to the difference. </p>

<p>In case of the latter, you can halt the DS1302 so it stops incrementing time.</p>
