13.07.2015 Views

Real Time Clock(RTC) based on DS1307 Features - Sunrom ...

Real Time Clock(RTC) based on DS1307 Features - Sunrom ...

Real Time Clock(RTC) based on DS1307 Features - Sunrom ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

For more products visit our website http://www.sunrom.comDocument: Datasheet Date: 11-Jan-12 Model #: 1246 Product’s Page: www.sunrom.com/p-1089.html<str<strong>on</strong>g>Real</str<strong>on</strong>g> <str<strong>on</strong>g>Time</str<strong>on</strong>g> <str<strong>on</strong>g>Clock</str<strong>on</strong>g>(<str<strong>on</strong>g>RTC</str<strong>on</strong>g>) <str<strong>on</strong>g>based</str<strong>on</strong>g> <strong>on</strong> <strong>DS1307</strong>This board is <str<strong>on</strong>g>Real</str<strong>on</strong>g> <str<strong>on</strong>g>Time</str<strong>on</strong>g> <str<strong>on</strong>g>Clock</str<strong>on</strong>g> <str<strong>on</strong>g>based</str<strong>on</strong>g> <strong>on</strong> mostpopular <str<strong>on</strong>g>RTC</str<strong>on</strong>g> IC <strong>DS1307</strong> which can maintainclock & calendar informati<strong>on</strong>. Life of 3V batteryis 10 years which maintains accurate clock evenwithout any external power. The clock/calendarprovides sec<strong>on</strong>ds, minutes, hours, day, date,m<strong>on</strong>th, and year informati<strong>on</strong>.The Interface to board is simple I2C with SCKand SDA pins which can be interfaced with anymicroc<strong>on</strong>troller easily.<strong>Features</strong>• <str<strong>on</strong>g>Real</str<strong>on</strong>g>-<str<strong>on</strong>g>Time</str<strong>on</strong>g> <str<strong>on</strong>g>Clock</str<strong>on</strong>g> (<str<strong>on</strong>g>RTC</str<strong>on</strong>g>) Counts Sec<strong>on</strong>ds,Minutes, Hours, Date of the M<strong>on</strong>th,M<strong>on</strong>th, Day of the week, and Year withLeap-Year Compensati<strong>on</strong> Valid Up to2100• 56-Byte, Battery-Backed, N<strong>on</strong>volatile(NV) RAM for Data Storage• I2C Serial Interface• Automatic Power-Fail Detect and SwitchCircuitry• C<strong>on</strong>sumes Less than 500nA in Battery-Backup Mode with Oscillator Running• Battery Life of CR2032 is around 10years.Working and further informati<strong>on</strong> is in datasheet of IC is at below linkhttp://www.sunrom.com/files/<strong>DS1307</strong>.pdfNote: DHL courier does not allow us to ship Lithium battery CR2032 with board. So if you areordering from out of India, we will be unable to ship battery with board. You shall have to arrange itat your country after receipt of this board. It is easily available at your general store.


Board SchematicVCCVCCVCCC1CN1SIP4-+4321VCCSDASCLVCCR110K+ C2100uFR210KU1<strong>DS1307</strong>56SDAX11SCLVCC 8Y1100nSQW/OUT7VBAT32X24GNDBT1BATT CR203232.768 Khz<strong>Sunrom</strong> Technologies http://www.sunrom.comTitleCode<str<strong>on</strong>g>RTC</str<strong>on</strong>g> <str<strong>on</strong>g>based</str<strong>on</strong>g> <strong>on</strong> <strong>DS1307</strong>1246 Rev 1Date: Saturday, December 10, 2011Sheet 1 of 1Sample Code AT89S52Software for this example programwith KEIL C51.The main loop justread data from <str<strong>on</strong>g>RTC</str<strong>on</strong>g>and keep into array (RCT_ARR[7])which c<strong>on</strong>sist of sec<strong>on</strong>d,minute,....year. After all data readedit will send to PC for display withhyper terminal program every 1sec<strong>on</strong>d.Download full source code fromhttp://www.sunrom.com/files/1246.zip//---------------------------------------// Main program//---------------------------------------void main(void){InitSerial();// Initialize serial port//-----------------------------------// Setup time and enable oscillator//-----------------------------------Read<str<strong>on</strong>g>RTC</str<strong>on</strong>g>(&<str<strong>on</strong>g>RTC</str<strong>on</strong>g>_ARR[0]);<str<strong>on</strong>g>RTC</str<strong>on</strong>g>_ARR[0] = <str<strong>on</strong>g>RTC</str<strong>on</strong>g>_ARR[0] & 0x7F; // enable oscillator (bit 7=0)<str<strong>on</strong>g>RTC</str<strong>on</strong>g>_ARR[1] = 0x59; // minute = 59<str<strong>on</strong>g>RTC</str<strong>on</strong>g>_ARR[2] = 0x05; // hour = 05 ,24-hour mode(bit 6=0)<str<strong>on</strong>g>RTC</str<strong>on</strong>g>_ARR[3] = 0x01; // Day = 1 or sunday<str<strong>on</strong>g>RTC</str<strong>on</strong>g>_ARR[4] = 0x30; // Date = 30<str<strong>on</strong>g>RTC</str<strong>on</strong>g>_ARR[5] = 0x08; // m<strong>on</strong>th = August<str<strong>on</strong>g>RTC</str<strong>on</strong>g>_ARR[6] = 0x05; // year = 05 or 2005Write<str<strong>on</strong>g>RTC</str<strong>on</strong>g>(&<str<strong>on</strong>g>RTC</str<strong>on</strong>g>_ARR[0]); // Set <str<strong>on</strong>g>RTC</str<strong>on</strong>g>//-----------------------------------while(1){Read<str<strong>on</strong>g>RTC</str<strong>on</strong>g>(&<str<strong>on</strong>g>RTC</str<strong>on</strong>g>_ARR[0]);putchar(0x0C); // clear Hyper terminalprintf("Day : %s\r\n",Int2Day(<str<strong>on</strong>g>RTC</str<strong>on</strong>g>_ARR[3]));printf("<str<strong>on</strong>g>Time</str<strong>on</strong>g> : %02bX:%02bX:%02bX\r\n",<str<strong>on</strong>g>RTC</str<strong>on</strong>g>_ARR[2],<str<strong>on</strong>g>RTC</str<strong>on</strong>g>_ARR[1],<str<strong>on</strong>g>RTC</str<strong>on</strong>g>_ARR[0]);printf("Data : %02bX-%s-20%02bX",<str<strong>on</strong>g>RTC</str<strong>on</strong>g>_ARR[4],Int2M<strong>on</strong>th(<str<strong>on</strong>g>RTC</str<strong>on</strong>g>_ARR[5]),<str<strong>on</strong>g>RTC</str<strong>on</strong>g>_ARR[6]);//}}DelayMs(1000);// delay about 1 sec<strong>on</strong>d2<strong>Sunrom</strong> Technologies Your Source for Embedded Systems Visit us at www.sunrom.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!