Toolbox.NETMF.Hardware.DS1307


Toolbox.NETMF.Hardware.DS1307(Address = 0x68, ClockRateKhz = 100)
  • Address The I²C identifier of the RTC module
  • ClockRateKhz The speed of the module

Methods

  • SetTime(time) Uploads the time to the module
  • SetTime(Year, Month, Day, Hour, Minute, Second) Uploads the time to the module
  • GetTime() Gets the time from the module
  • Synchronize() Updates the system clock

How to connect

Toolbox.NETMF.Hardware.DS1307.png

Sample code in C#

DS1307 RTC = new DS1307();

// Comment this line out to set the time for the first time
//RTC.SetTime(Year: 2012, Month: 5, Day: 27, Hour: 22, Minute: 52, Second: 0);

// Synchronises the Netduino with the DS1307 RTC module
RTC.Synchronize();

while (true)
{
    Debug.Print(DateTime.Now.ToString());
    Thread.Sleep(1000);
}

Sample code in VB

Dim RTC As DS1307 = New DS1307()

' Comment this line out to set the time for the first time
'RTC.SetTime(Year:=2012, Month:=5, Day:=27, Hour:=22, Minute:=52, Second:=0)

' Synchronises the Netduino with the DS1307 RTC module
RTC.Synchronize()

Do
    Debug.Print(DateTime.Now.ToString())
    Thread.Sleep(1000)
Loop

Related documents

Last edited Jan 1, 2013 at 4:05 PM by Garrcomm, version 3