background image

 
 
 
 

USER MANUAL 

 
 
 
 
 

EN

 

DS1302 real-time clock module 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

WPI301

 

 

 

 

 

 

 

 

whadda.com

 

 

Summary of Contents for DS1302

Page 1: ...USER MANUAL EN DS1302 real time clock module WPI301 whadda com ...

Page 2: ...sons with reduced physical sensory or mental capabilities or lack of experience and knowledge if they have been given supervision or instruction concerning the use of the device in a safe way and understand the hazards involved Children shall not play with the device Cleaning and user maintenance shall not be made by children without supervision General Guidelines Refer to the Velleman Service and...

Page 3: ...1 bytes of static RAM It communicates with a microprocessor via a simple serial interface The real time clock calendar provides seconds minutes hours day date month and year information The end of the month date is automatically adjusted for months with fewer than 31 days including corrections for leap year The clock operates in either the 24 hour or 12 hour format with an AM PM indicator Specific...

Page 4: ...round Note Previous data sheet revisions referred to CE as RST The functionality of the pin has not changed I O Input push pull output The I O pin is the bidirectional data pin for the 3 wire interface This pin has an internal 40 kΩ typ pulldown resistor to ground SCLK Input SCLK is used to synchronize data movement on the serial interface This pin has an internal 40 kΩ typ pulldown resistor to gr...

Page 5: ... the larger of VCC1 or VCC2 When VCC2 is greater than VCC1 0 2 V VCC2 powers the WPI301 When VCC2 is less than VCC1 VCC1 powers the WPI301 GND Ground Example Before being able to use the sample program an additional library needs to be installed Go to Sketch Include Library Manage Libraries Put DS1302 in the search bar and install the RTC library by Makuna should be the first result ...

Page 6: ...ude ThreeWire h include RtcDS1302 h ThreeWire myWire 6 7 5 IO SCLK CE RtcDS1302 ThreeWire Rtc myWire void setup Serial begin 57600 Serial print compiled Serial print __DATE__ Serial println __TIME__ Rtc Begin RtcDateTime compiled RtcDateTime __DATE__ __TIME__ printDateTime compiled Serial println Rtc SetDateTime compiled if Rtc IsDateTimeValid Common Causes 1 first time you ran and the device wasn...

Page 7: ...RTC is newer than compile time this is expected else if now compiled Serial println RTC is the same as compile time not expected but all is fine void loop RtcDateTime now Rtc GetDateTime printDateTime now Serial println if now IsValid Common Causes 1 the battery on the device is low or even missing and the power line was disconnected Serial println RTC lost confidence in the DateTime delay 10000 t...

Page 8: ...8 snprintf_P datestring countof datestring PSTR 02u 02u 04u 02u 02u 02u dt Month dt Day dt Year dt Hour dt Minute dt Second Serial print datestring ...

Page 9: ...9 whadda com Modifications and typographical errors reserved Velleman Group nv WPI301_v01 Velleman Group nv Legen Heirweg 33 9890 Gavere ...

Reviews: