• Witaj na Forum Arduino Polska! Zapraszamy do rejestracji!
  • Znajdziesz tutaj wiele informacji na temat hardware / software.
Witaj! Logowanie Rejestracja


Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
RTC DS1302
#8
(26-12-2021, 14:28)kaczakat napisał(a): Zastosowany uC nie ma znaczenia, zerowanie czasu odbywa się bo:
a) robi to program, którego kodu nie pokazujesz.
b) bateria nie podtrzymuje działania RTC.
Hej. Bateria ma poprawne napięcie. Testowałem też z 18650. Bibliotekę załączyłem a to cześć kodu:

Kod:
#include <virtuabotixRTC.h>                                                                              //|
                                                                                                         //|
//=======================================================================================================//|
//                                                                                                       //|
//                          Include files required for Program Function End                              //|
//                                                                                                       //|
//=======================================================================================================//|

// Creation of the Real Time Clock Object
virtuabotixRTC myRTC(6, 7, 8);

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

// Set the current date, and time in the following format:
// seconds, minutes, hours, day of the week, day of the month, month, year
  myRTC.setDS1302Time(00, 59, 23, 6, 10, 1, 2014);
}

//=======================================================================================================//|   
//                                                                                                       //|  
//                         Printout by accessing Single Element objects BEGIN                            //|  
//                                                                                                       //|  
//=======================================================================================================//|  
//                                                                                                       //|  
//  This example utilizes the Serial.print function to access individual data elements, this allows for  //|
//  user defined output format.                                                                          //|
//                                                                                                       //|  
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//| 
void loop()  {                                                                                           //|
// This allows for the update of variables for time or accessing the individual elements.                //|
  myRTC.updateTime();                                                                                    //|
                                                                                                         //|
// Start printing elements as individuals                                                                //|  
  Serial.print("Current Date / Time: ");                                                                 //|
  Serial.print(myRTC.dayofmonth);                                                                        //|
  Serial.print("/");                                                                                     //|
  Serial.print(myRTC.month);                                                                             //|
  Serial.print("/");                                                                                     //|
  Serial.print(myRTC.year);                                                                              //|
  Serial.print("  ");                                                                                    //|
  Serial.print(myRTC.hours);                                                                             //|
  Serial.print(":");                                                                                     //|
  Serial.print(myRTC.minutes);                                                                           //|
  Serial.print(":");                                                                                     //|
  Serial.println(myRTC.seconds);                                                                         //|
                                                                                                         //|
// Delay so the program doesn't print non-stop                                                           //|
  delay( 5000);                                                                                          //|
}

Sprawdzę jeszcze na "gołym" układzie bez innych elementów.
 
Odpowiedź
  


Wiadomości w tym wątku
RTC DS1302 - przez chrzanio - 08-09-2019, 08:34
RE: RTC DS1302 - przez error105 - 08-09-2019, 10:22
RE: RTC DS1302 - przez -adamek - 08-09-2019, 11:09
RE: RTC DS1302 - przez kaczakat - 08-09-2019, 14:00
RE: RTC DS1302 - przez chrzanio - 08-09-2019, 14:48
RE: RTC DS1302 - przez Stawu - 26-12-2021, 12:08
RE: RTC DS1302 - przez kaczakat - 26-12-2021, 14:28
RE: RTC DS1302 - przez Stawu - 26-12-2021, 15:45
RE: RTC DS1302 - przez kaczakat - 26-12-2021, 20:50
RE: RTC DS1302 - przez Stawu - 27-12-2021, 10:29
RE: RTC DS1302 - przez kaczakat - 27-12-2021, 14:42
RE: RTC DS1302 - przez Stawu - 27-12-2021, 19:12

Skocz do:


Przeglądający: 1 gości