rtc ds1302 code problem

so I have a rtc modle and im trying to get it working bt the code is sitting lot of errors, iv downloaded the library from here and installed bt no worky.
this is one of he examples,any
any ideas of what im doing wrong//

/*

  • TimeRTC.pde
  • example code illustrating Time library with Real Time Clock.

*/

#include <Time.h>
#include <Wire.h>
#include <DS1307RTC.h> // a basic DS1307 library that returns time as a tim

#include <DS1307RTC.h>  // a basic DS1307 library that returns time as a time_t

You are using a DS1307 library with a DS1302. They are very different devices.

Find a DS1302 library.

ok your totally right my bad,
I have gotten the right library now but what is hapening is the time just jumps around and the date is not what the code sais.
what am i doing wrong?
here is my code

#include <LiquidCrystal.h>
#include <DS1302.h>
#include <Wire.h>
// Init the DS1302
DS1302 rtc(2, 3, 4);

// Init the LCD
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup()
{
// Set the clock to run-mode, and disable the write protection
rtc.halt(false);
rtc.writeProtect(false);

// Setup LCD to 16x2 characters
lcd.begin(16, 2);

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

void loop()
{
// Display time centered on the upper line
lcd.setCursor(4, 0);
lcd.print(rtc.getTimeStr());

// Display abbreviated Day-of-Week in the lower left corner
lcd.setCursor(0, 1);
lcd.print(rtc.getDOWStr(FORMAT_SHORT));

// Display date in the lower right corner
lcd.setCursor(6, 1);
lcd.print(rtc.getDateStr());

// Wait one second before repeating :slight_smile:
delay (1000);
}

I have a rtc modle

Please provide documentation on the rtc module you have.

Also, can you provide a like to the DS1302 library you are using.

a link to the module i have..

Forgot to mention that it is flashing on and off like a clock that has not been set too.

I have attached the library files as well

DS1302.cpp (9.94 KB)

DS1302.h (3.22 KB)

Because you are using a well used library, we can assume that the problem is in your set up or the hardware, and not the software.

Regarding the software, you should be running the exact examples which come with the library to get up and running. The code you posted (please use code tags if you post again) contains <wire.h> which is not in the basic lcd example of the library. For starters, use the most basic example which is DS1302_Serial_Easy and don't make any changes.

  1. Check your connections. For your module CE pin 2 is RST; I/O pin 3 is DAT; and SCLK pin 4 is CLK. I would recommend using the external power and ground in case your battery is bad.

Check that the jumpers and wires you use are good. There have been several recent posts where the jumpers have been defective.

  1. Check over the module. A broken lead or bad solder on the crystal oscillator is a possibility. Check that the chip is securely seated in the socket.

Thank you for the help, I will try after work.
If I try to run the lcd code without the <wire.h> I come up with errors, Thats why I put that in there.

For the next time, What do you mean by code tags (what are you refering to)?

Chris

So I got it to work by hooking up the power,
Hot do I get it to stop flashing the time and then 00:00:00:0000:0000:00:0000