Comments on: Arduino and the Maxim DS1306 Real Time Clock https://blog.nearfuturelaboratory.com/2006/12/14/arduino-and-ds1306-real-time-clock/ Clarify Today, Design Tomorrow Fri, 18 Aug 2017 18:03:03 +0000 hourly 1 https://wordpress.org/?v=5.5.1 By: Abraham Martínez https://blog.nearfuturelaboratory.com/2006/12/14/arduino-and-ds1306-real-time-clock/#comment-128 Sat, 28 May 2011 02:25:47 +0000 http://diversifiedcuriosities.com/2006/12/14/arduino-and-ds1306-real-time-clock/#comment-128 Exelente amigo me fue de muchisisma ayuda le hice algunas mejoras, para tener acceso a registros completos y mostrar la información más detalla; sin embargo, no estoy trabajando con Arduino, este proyecto lo hago con un ATmega16 que tiene mucha similitud al que utilizas con arduino (ATmega8).

Gracias por la información,

]]>
By: Embedded Development on OSX. » Blog Archive » Windward Notes. https://blog.nearfuturelaboratory.com/2006/12/14/arduino-and-ds1306-real-time-clock/#comment-127 Fri, 30 Apr 2010 21:41:43 +0000 http://diversifiedcuriosities.com/2006/12/14/arduino-and-ds1306-real-time-clock/#comment-127 […] Best code example is at .http://www.nearfuturelaboratory.com/2006/12/14/arduino-and-ds1306-real-time-clock/ […]

]]>
By: Julian https://blog.nearfuturelaboratory.com/2006/12/14/arduino-and-ds1306-real-time-clock/#comment-126 Sat, 30 Jan 2010 19:43:22 +0000 http://diversifiedcuriosities.com/2006/12/14/arduino-and-ds1306-real-time-clock/#comment-126 In reply to John.

That might be weird, or it might not. Hard to tell from the information you’ve got. You do know that the clock and calendar are meant to be read as binary coded data and not proper base 2 numbers? If by “60” you mean 60d, that could be 12 o’clock, but I’m not 100% convinced. 60d = 0b111100 which is only 6 bits of that register. Assuming that that’s what you have, then you might have 0b1100 -> 12 in the hours field. Still seems squirrely. Keep plugging away.

]]>
By: John https://blog.nearfuturelaboratory.com/2006/12/14/arduino-and-ds1306-real-time-clock/#comment-125 Sat, 30 Jan 2010 06:12:59 +0000 http://diversifiedcuriosities.com/2006/12/14/arduino-and-ds1306-real-time-clock/#comment-125 In reply to Julian.

well i tried putting
write_rtc_register(0x82, 1<<6|1<<5 );
but then the hours say 60. I really don't understand what i need to do.

]]>
By: Julian https://blog.nearfuturelaboratory.com/2006/12/14/arduino-and-ds1306-real-time-clock/#comment-124 Fri, 29 Jan 2010 05:16:09 +0000 http://diversifiedcuriosities.com/2006/12/14/arduino-and-ds1306-real-time-clock/#comment-124 In reply to John.

Check out the manual — in the table of RTC Registers, Bit 5 of the register at address 0x02 (Read) and 0x82 (Write) allows you to set AM/PM if you set Bit 6 to use a 12 hour clock. Otherwise, it’s irrelevant if you’re using a 24 hour clock.

]]>
By: John https://blog.nearfuturelaboratory.com/2006/12/14/arduino-and-ds1306-real-time-clock/#comment-123 Fri, 29 Jan 2010 04:54:35 +0000 http://diversifiedcuriosities.com/2006/12/14/arduino-and-ds1306-real-time-clock/#comment-123 How would you set the am and pm though?

]]>
By: Matt https://blog.nearfuturelaboratory.com/2006/12/14/arduino-and-ds1306-real-time-clock/#comment-122 Mon, 07 Sep 2009 02:24:52 +0000 http://diversifiedcuriosities.com/2006/12/14/arduino-and-ds1306-real-time-clock/#comment-122 In reply to Julian.

Thanks alot for responding fairly quick and thanks for the code.

]]>
By: Julian https://blog.nearfuturelaboratory.com/2006/12/14/arduino-and-ds1306-real-time-clock/#comment-121 Mon, 31 Aug 2009 03:06:03 +0000 http://diversifiedcuriosities.com/2006/12/14/arduino-and-ds1306-real-time-clock/#comment-121 In reply to Matt.

It’s pretty easy. Look at the register map table above. A(M)/P(M) are indicated by the register at address 02H (0x02), bit 5. This is also how you would set AM/PM. Alternatively, you could stick to 24 hour time and infer based on the same bit.

You can check whether a bit is set by using some bit masking and a conditional. You also need to be sure you put the chip in the right mode — 12-hour or 24-hour. As the spec sheet describes, bit 6 of the hours register (0x02) is defined as the 12- or 24-hour mode select bit.

int reg = read_rtc_register(0x02);
int mask = 1 << 5;
if (mask & reg) {
// it is PM
} else {
// it is AM
}

]]>
By: Matt https://blog.nearfuturelaboratory.com/2006/12/14/arduino-and-ds1306-real-time-clock/#comment-120 Sat, 29 Aug 2009 02:26:53 +0000 http://diversifiedcuriosities.com/2006/12/14/arduino-and-ds1306-real-time-clock/#comment-120 How would you access am and pm?

]]>
By: lisarden https://blog.nearfuturelaboratory.com/2006/12/14/arduino-and-ds1306-real-time-clock/#comment-119 Thu, 09 Apr 2009 19:36:47 +0000 http://diversifiedcuriosities.com/2006/12/14/arduino-and-ds1306-real-time-clock/#comment-119 Thanks great for this code! I’ve spent a few days struggling the SPI at Atmega16. The DS1306 never wanted to show me the correct time! Now I’m happy, the RTC works as expected even charging the supercap!

Thanks a lot guys! You did a real useful job!

]]>