ds1307 время торопится. Почему?

hong_10
Offline
Зарегистрирован: 30.10.2013

есть часы http://dvrobot.ru/shop/i196.modul_chasy.htm Прицепляю к ардуинке, заливаю вот этот код

#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif


#include <Wire.h>
#include <DS1307.h> // written by  mattt on the Arduino forum and modified by D. Sjunnesson

void setup()
{
  Serial.begin(9600);

  RTC.stop();
  RTC.set(DS1307_SEC,1);        //set the seconds
  RTC.set(DS1307_MIN,23);     //set the minutes
  RTC.set(DS1307_HR,13);       //set the hours
 // RTC.set(DS1307_DOW,4);       //set the day of the week
  RTC.set(DS1307_DATE,13);       //set the date
  RTC.set(DS1307_MTH,4);        //set the month
  RTC.set(DS1307_YR,14);         //set the year
  RTC.start();

}

void loop()
{

  Serial.print(RTC.get(DS1307_HR,true)); //read the hour and also update all the values by pushing in true
  Serial.print(":");
  Serial.print(RTC.get(DS1307_MIN,false));//read minutes without update (false)
  Serial.print(":");
  Serial.print(RTC.get(DS1307_SEC,false));//read seconds
  Serial.print("      ");                 // some space for a more happy life
  Serial.print(RTC.get(DS1307_DATE,false));//read date
  Serial.print("/");
  Serial.print(RTC.get(DS1307_MTH,false));//read month
  Serial.print("/");
  Serial.print(RTC.get(DS1307_YR,false)); //read year
  Serial.println();

  delay(1000);

}

Все прошивается, открываю сериал монитор и вот что он мне показывает. Из-за чего это может быть? подскажите плз.

13:24:1      13/4/2014
13:24:7      13/4/2014
13:24:13      13/4/2014
13:24:18      13/4/2014
13:24:24      13/4/2014
13:24:30      13/4/2014
13:24:36      13/4/2014
13:24:42      13/4/2014
13:24:48      13/4/2014
13:24:54      13/4/2014
13:25:0      13/4/2014
13:25:6      13/4/2014
13:25:12      13/4/2014
13:25:18      13/4/2014
13:25:24      13/4/2014
13:25:30      13/4/2014
13:25:36      13/4/2014
13:25:42      13/4/2014
13:25:48      13/4/2014
13:25:54      13/4/2014
13:26:0      13/4/2014
13:26:6      13/4/2014
13:26:12      13/4/2014
 
axill
Offline
Зарегистрирован: 05.09.2011

Нормальный вывод в сериал. Что не так? Или вы с секундомером проверяли?

NeiroN
NeiroN аватар
Offline
Зарегистрирован: 15.06.2013

Вывод не по возрастанию секунд может быть изза   delay(1000);

axill
Offline
Зарегистрирован: 05.09.2011

где вы видие не по возрастанию? все четко по взрастанию, но с пропусками. Есть ожидание у автора что один вызов Loop выполняеься одну секунду, но это не так. Согласен - одна из прияин это delay. Но если ее убрать этого будет мало. Возможно скорость Serial еще надо поднять в несколько раз

hong_10
Offline
Зарегистрирован: 30.10.2013

дело в том, что часы реально спешат! В прошивке устанавливаю время 18:00. Отключаю ардуинку, через 5 мин. включаю, а он мне показывает там примерно 18:10. Ну реально спешат. По-моему дело в самих часах. 

trembo
trembo аватар
Offline
Зарегистрирован: 08.04.2011

Поиск не пробовали?

http://arduino.ru/forum/apparatnye-voprosy/speshat-chasy-ds1307#comment-26046

Про конденсаторы... хотя про них есть и в pdf...

http://forum.arduino.cc/index.php?PHPSESSID=8lvve6nacphpb7d0sllg6mp095&topic=87846.msg659849#msg659849

X1, X2 – Connections for a standard 32.768kHz quartz crystal. The internal oscillator circuitry is
designed for operation with a crystal having a specified load capacitance (CL) of 12.5pF.

CLOCK ACCURACY
The accuracy of the clock is dependent upon the accuracy of the crystal and the accuracy of the match
between the capacitive load of the oscillator circuit and the capacitive load for which the crystal was
trimmed.

Также где-то читал что китайцы вовсю используют ЗАРЯЖАЕМЫЕ LIR2032.

Они выдают большее напряжение и согласно pdf :

VBAT–Battery input for any standard 3V lithium cell or other energy source. Battery voltage must be
held between 2.0V and 3.5V for proper operation.

The nominal write protect trip point voltage at which
access to the RTC and user RAM is denied isset by the internal circuitry as 1.25 x VBATnominal.

часы неправильно переключаются на дежурку.

http://forum.arduino.cc/index.php?PHPSESSID=r8u0um10li8j42s853r0imvq13&topic=177297.msg1396648#msg1396648

Кто-то ставит делитель, кто-то меняет батарейку на  обычную CR2032

http://forum.arduino.cc/index.php?PHPSESSID=fvflcsst18uu000h5jlal4ecj7&topic=177297.msg1420173#msg1420173

This rechargeable battery mess actually does not do much good - I opt for making the changes suggested by RoomHeli (getting rid of all the  charging circuitry and replacing the LIR2032 rechargeable battery with a regular CR2032 type one) to get the module as close to the simple, "typical" circuit design as possible.