No the screen is independent of the RTC module and just displays whatever you send to it. The reason why I needed you to confirm that the RTC is working with our own library is because your setup was getting a little confusing what with having two types of RTC module and different libraries. I have tried the sketch you have posted with the appropriate library and I get the same thing. As we have established that the DS1307 module does work, then this now points to a problem with the henningkarlsen library. Unfortunately as we didn't write this library it is difficult for us to debug it but my suspicion would be that it assumes the module is on a different I2C address. I have quickly mashed together our LCD keypad shield example together with our DS1307 RTC example that uses our own library:
Code: Select all
/* Include the wire library */
#include "Wire.h"
/* Include the Hobby Components RTC library */
#include <HCRTC.h>
/* Define the I2C addresses for the RTC and EEPROM */
#define I2CDS1307Add 0x68
/* Include the standard LiquidCrystal library */
#include <LiquidCrystal.h>
/* DIO pin definitions */
#define LCD_DATA4 4 /* LCD data DIO pin 4 */
#define LCD_DATA5 5 /* LCD data DIO pin 5 */
#define LCD_DATA6 6 /* LCD data DIO pin 6 */
#define LCD_DATA7 7 /* LCD data DIO pin 7 */
#define LCD_RESET 8 /* LCD Reset DIO pin */
#define LCD_ENABLE 9 /* LCD Enable DIO pin */
#define LCD_BACKLIGHT 10 /* LCD backlight DIO pin */
/* Initialise the LiquidCrystal library with the correct DIO pins */
LiquidCrystal lcd(LCD_RESET, LCD_ENABLE, LCD_DATA4, LCD_DATA5, LCD_DATA6, LCD_DATA7);
/* Used in example as an index pointer */
byte index;
/* Create an instance of HCRTC library */
HCRTC HCRTC;
void setup()
{
Serial.begin(9600);
/* Use the RTCWrite library function to set the time and date.
Parameters are: I2C address, year, month, date, hour, minute, second,
day of week */
HCRTC.RTCWrite(I2CDS1307Add, 13, 4, 24, 14, 21, 0, 3);
/* Set the correct display size (16 character, 2 line display) */
lcd.begin(16, 2);
}
void loop()
{
/* Continuously read the current time and date from the RTC */
while(true)
{
/* Read the current time from the RTC module */
HCRTC.RTCRead(I2CDS1307Add);
lcd.setCursor(0,0);
lcd.print("Seconds:");
lcd.setCursor(0,1);
lcd.print(HCRTC.GetSecond());
/* Wait a second before reading again */
delay(1000);
}
}
This is a very basic sketch that will output the 'second' reading from the DS1307 and display it on the LCD. This will at least confirm that your setup is fine (which it appears to be) and give you and idea on how to do this using our library.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.