Olá, bom dia;

Estou com lguns problemas com o modulo DS1307 assim que rodo o programa, baseado no seguinte codigo como exemplo, utilizando no arduino mega 2560:

#include <DS1307.h>

// Init the DS1307
DS1307  rtc(4, 5);

// Init a Time-data structure
Time  t;

void setup()
{
  // Initialize the rtc object
  rtc.begin();
 
  // Set the clock to run-mode
  rtc.halt(false);
 
  // Setup Serial connection
  Serial.begin(9600);

  // The following lines can be commented out to use the values already stored in the DS1307
  rtc.setDOW(SUNDAY);        // Set Day-of-Week to SUNDAY
  rtc.setTime(12, 0, 0);     // Set the time to 12:00:00 (24hr format)
  rtc.setDate(3, 10, 2010);   // Set the date to October 3th, 2010
}

void loop()
{
  // Get data from the DS1307
  t = rtc.getTime();
 
  // Send date over serial connection
  Serial.print("Today is the ");
  Serial.print(t.date, DEC);
  Serial.print(". day of ");
  Serial.print(rtc.getMonthStr());
  Serial.print(" in the year ");
  Serial.print(t.year, DEC);
  Serial.println(".");
 
  // Send Day-of-Week and time
  Serial.print("It is the ");
  Serial.print(t.dow, DEC);
  Serial.print(". day of the week (counting monday as the 1th), and it has passed ");
  Serial.print(t.hour, DEC);
  Serial.print(" hour(s), ");
  Serial.print(t.min, DEC);
  Serial.print(" minute(s) and ");
  Serial.print(t.sec, DEC);
  Serial.println(" second(s) since midnight.");

  // Send a divider for readability
  Serial.println("  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -");
 
  // Wait one second before repeating :)
  delay (1000);
}

   A hora aparece completamente errada, os minutos ficam em 85, os segundos em 85 as horas em 21, o ano fica em 2165, o mês em 85.

   O problema pode ser biblioteca, ou o modulo mesmo está com defeito?? Alguém pode me dar uma ajuda??


 

Exibições: 1190

Responder esta

Respostas a este tópico

Ola 

Isso ocorreu comigo, foi só substituir a bateria do modulo.

Verifica a tensão da bateria sua.

Deu tudo certo, obrigado pela ajuda, era  abateria ue estava entregando uma tensão maior que a que estava escrita no involucro.

Ok !

Miller boa tarde,

Por favor coloque antes do atual titulo do seu tópico a palavra RESOLVIDO, assim ele passar a ser uma base de dados solucionada, e pode servir para auxiliar a outros.

Obrigado.

Abs.

RSS

© 2024   Criado por Marcelo Rodrigues.   Ativado por

Badges  |  Relatar um incidente  |  Termos de serviço