I purchased this RTC: http://www.adafruit.com/products/264
But when I go to set the time using the Toolbox.NETMF.Hardware.DS1307 I get the following error:
"Something went wrong setting the time. Did you use proper pull-up resistors and is there a 3V battery connected?"
The wiring is pretty simple and I've double checked it (see pic).The kit has the resistors and the battery, any ideas?
Here is the code where it fails:
DS1307 RTC = new DS1307();
RTC.SetTime(2013, 7, 29, 23, 14, 0);
here is the toolbox code where the call is throwing an exception
public void SetTime(DateTime Time)
{
// Writing 7 bytes to the buffer, starting at address 0
int BytesTransferred = this._Device.Write(new byte[] {
0x00,
(byte)Tools.Hex2Dec(Time.Second.ToString()),
(byte)Tools.Hex2Dec(Time.Minute.ToString()),
(byte)Tools.Hex2Dec(Time.Hour.ToString()),
(byte)Tools.Hex2Dec(((int)Time.DayOfWeek).ToString()),
(byte)Tools.Hex2Dec(Time.Day.ToString()),
(byte)Tools.Hex2Dec(Time.Month.ToString()),
(byte)Tools.Hex2Dec((Time.Year - 2000).ToString())
});
if (BytesTransferred != 8) throw new ApplicationException("Something went wrong setting the time. Did you use proper pull-up resistors and is there a 3V battery connected?");
}