Pages: 1 [2]   Go Down
Author Topic: rtc DS1307 will not display in serial monitor  (Read 1568 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 96
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok srry if i was a bit harsh just frustrated finally got the library part taken care of i work alot so spare time is far between. i am using the code from http://www.emartee.com/product/41951/Arduino%20RTC%20DS1307%20Shield wich is who i got the chip from according to  thier web site when the code is uploaded you should open the serial monitor and see the result. theres a pic of the result on the page it showes the time scrolling with date. the code is this



#include <WProgram.h>
#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,12);       //set the hours
  RTC.set(DS1307_DOW,4);       //set the day of the week
  RTC.set(DS1307_DATE,15);       //set the date
  RTC.set(DS1307_MTH,7);        //set the month
  RTC.set(DS1307_YR,10);         //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);
}
when i uploaad this code and run serial monitor the monitor display is blank
am i missing something pls help me out
and if i unplug the chip i get 0:0:0  0/0/2000

« Last Edit: September 12, 2011, 01:04:14 am by drab » Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 72
Posts: 7163
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Don't know what's going on with this chip. If you try running the code with the RTC plugged in it shows nothing. What if at this moment you unplug it, will the serial monitor start display the zeros? Can you show me a picture how you connected the RTC to your arduino? We can't exclude a possibility that you screwed up the wiring smiley (very unlikely since the sockets are shrouded.
Logged


Offline Offline
Jr. Member
**
Karma: 0
Posts: 96
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes if i unplug the chip it shows zeros. If u follow the link in my post and look at the page i have it hooked into the sensor shield and the shield set for the I2c as shown on the page from emartee.
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 72
Posts: 7163
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes if i unplug the chip it shows zeros. If u follow the link in my post and look at the page i have it hooked into the sensor shield and the shield set for the I2c as shown on the page from emartee.

Just a random thought, is the battery inserted correctly with the right polarity? What happens if you connect the RTC without battery?
Logged


Offline Offline
Jr. Member
**
Karma: 0
Posts: 96
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

well i got it workin the wonerful chinese screwed up the wire that i bought with it. they wired the vcc and grnd to the opssitie side it needed to be on where it plugs into the chip. lol fixed it and works nice now. thx everyone.
Logged

Pages: 1 [2]   Go Up
Jump to: