Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/21/09 16:46
Read: times


 
#171830 - Timer not ticking
Responding to: ???'s previous message
David Prentice said:

If you read the data sheet for the DS1307, you will see that most of the registers return data in BCD. So performing decimal arithmetic will produce garbage.
David.


Thanks for the tip David. Now I do this:
second = DS1307_get(SEC);
FirstDigit = second & 0xF;

 


But I keep getting the same value all the time (the value that I have originally set). I am not sure the timer has started... even though I start it with


void DS1307_startTimer()
{
	I2C_start();
	I2C_write(DS1307_ID); /* connect to DS1307 */
	I2C_write(0x00); /* Request RAM address at 00H */
	I2C_write(0x80); /* Set CH bit ie. 7th bit og 0x00 to start timer*/
	I2C_stop();           /* Stop i2c bus */
}

 



List of 5 messages in thread
TopicAuthorDate
89V51 and DS1307            01/01/70 00:00      
   Convention is no code in .H files            01/01/70 00:00      
      Timer not ticking            01/01/70 00:00      
         Read the data sheet.            01/01/70 00:00      
            Nice decomposition.            01/01/70 00:00      

Back to Subject List