Editor Version ×
Standard

1.Easy to use and quick to get started

2.The process supports design scales of 300 devices or 1000 pads

3.Supports simple circuit simulation

4.For students, teachers, creators

Profession

1.Brand new interactions and interfaces

2.Smooth support for design sizes of over 5,000 devices or 10,000 pads

3.More rigorous design constraints, more standardized processes

4.For enterprises, more professional users

Ongoing

STD Xadow - RTC

License:

Mode: Editors' pick

  • 1.2k
  • 0
  • 0
Update time: 2021-04-11 16:42:38
Creation time: 2016-01-11 10:12:54
Description
Introduction Sometimes, you always want to know what time it is. Whether I have missed the dating or not, or if it is the mealtime for my three months child. The RTC module can provide you a real-time clock. You can make the controller ask the module: hi,buddy, what time it is. At the same time, do not forget to install a small coin cell which can serve you for more than six mouths. Specification Real-Time Clock (RTC) Counts Seconds,Minutes, Hours, Date of the Year, Month, Day of the week, and Year with Leap-Year Compensation Can set as 12-hour format or 24-hour format Valid Up to 2100 Dimensions: 25.43mm x 20.35mm In order to gain a robust performance, you must put a 3-Volt CR1220 lithium cell in the battery-holder. If you use the primary power only, the module may not work normally, because the crystal may not oscillate. Demonstration The following sketch demonstrates a simple application of setting the time and reading it out. Hardware Installation: ![enter image description here][1] Note: when connect Xadow RTC to Xadow Main Board, you should concern about the connection direction. The connection method is that the unfilled corner of one Xadow module need to connect to the right angle of another module(see four corners of each Xadow module). Demo code shown as below: #include #define DS1337_CTRL_ID 0x68 unsigned char second,minute,hour; unsigned char week,day,month; unsigned int year; void setup() { Wire.begin(); Serial.begin(38400); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only } fillByYMD(2013,6,17);//Jun 19,2013 fillByHMS(23,15,43);//23:15 43" fillWeek(1);//Monday setTime(); } void loop() { readTime(); Serial.print(year+2000, DEC); Serial.print("/"); Serial.print(month, DEC); Serial.print("/"); Serial.print(day, DEC); Serial.print(" "); Serial.print(hour, DEC); Serial.print(":"); Serial.print(minute, DEC); Serial.print(":"); Serial.print(second, DEC); Serial.print(" "); switch (week)// Friendly printout the weekday { case 1: Serial.print("MON"); break; case 2: Serial.print("TUE"); break; case 3: Serial.print("WED"); break; case 4: Serial.print("THU"); break; case 5: Serial.print("FRI"); break; case 6: Serial.print("SAT"); break; case 7: Serial.print("SUN"); break; } Serial.println(" "); delay(1000); } /*Function: Read time and date from RTC */ void readTime(void) { // use the Wire lib to connect to tho rtc // reset the register pointer to zero Wire.beginTransmission(DS1337_CTRL_ID); Wire.write(0x00); Wire.endTransmission(); // request the 7 bytes of data (secs, min, hr, dow, date. mth, yr) Wire.requestFrom(DS1337_CTRL_ID, 7); // A few of these need masks because certain bits are control bits second = bcdToDec(Wire.read() & 0x7f); minute = bcdToDec(Wire.read()); hour = bcdToDec(Wire.read() & 0x3f);// Need to change this if 12 hour am/pm week = bcdToDec(Wire.read()); day = bcdToDec(Wire.read()); month = bcdToDec(Wire.read()); year = bcdToDec(Wire.read()); } /*Function: Write the time that includes the date to the RTC chip */ void setTime(void) { Wire.beginTransmission(DS1337_CTRL_ID); Wire.write(0x00); Wire.write(decToBcd(second));// 0 to bit 7 starts the clock Wire.write(decToBcd(minute)); Wire.write(decToBcd(hour)); // If you want 12 hour am/pm you need to set bit 6 Wire.write(decToBcd(week)); Wire.write(decToBcd(day)); Wire.write(decToBcd(month)); Wire.write(decToBcd(year)); Wire.endTransmission(); } unsigned char decToBcd(unsigned char val) { return ( (val/10*16) + (val%10) ); } //Convert binary coded decimal to normal decimal numbers unsigned char bcdToDec(unsigned char val) { return ( (val/16*10) + (val%16) ); } void fillByYMD(unsigned int _year, unsigned char _month, unsigned char _day) { year = _year-2000; month = _month; day = _day; } void fillWeek(unsigned char _dow) { week = _dow; } void fillByHMS(unsigned char _hour, unsigned char _minute, unsigned char _second) { // assign variables hour = _hour; minute = _minute; second = _second; } ![enter image description here][2] The output time is changing like the clock. Once you set a time, RTC will update the clock time data constantly. Then you need to comment out the code as show below and re-upload. A Real-Time Clock appears . [1]: /editor/20160111/56938075dde43.png [2]: /editor/20160111/569380e1be846.png
Design Drawing
schematic diagram
1 /
PCB
1 /
The preview image was not generated, please save it again in the editor.
ID Name Designator Quantity
1 12p FPC bottom contact J3,J2 2
2 CR1220(LC) BAT1 1
3 32.768kHz 050037001 ABS07-32.768KHZ-7-T X1 1
4 0390030P1 SS0520-7-F D1 1
5 DNP !INTB!--INT0 1
6 SEEEDSTUDIO_SCH_FRAME U$1 1
7 10uF C1 1
8 DNP C2,C3 2
9 100nF C4 1
10 DS1337S U2 1
11 PAD-MARK P1,P2,P3,P4 4

Unfold

Project Attachments
Empty
Project Members
Target complaint
Related Projects
Change a batch
Loading...
Add to album ×

Loading...

reminder ×

Do you need to add this project to the album?

服务时间

周一至周五 9:00~18:00
  • 0755 - 2382 4495
  • 153 6159 2675

服务时间

周一至周五 9:00~18:00
  • 立创EDA微信号

    easyeda

  • QQ交流群

    664186054

  • 立创EDA公众号

    lceda-cn