Khác biệt giữa các bản “Tiny RTC + EEPROM”
(Tạo trang mới với nội dung “Category:Module 400px|thumb|alt=Tiny RTC + EEPROM|right|Tiny RTC + EEPROM == Introduction == This tiny RTC module is b…”) |
(→Programming) |
||
(Không hiển thị 9 phiên bản của cùng người dùng ở giữa) | |||
Dòng 1: | Dòng 1: | ||
[[Category:Module]] | [[Category:Module]] | ||
− | [[Hình: | + | [[Hình:Tiny_RTC_EEPROM1.jpg|400px|thumb|alt=Tiny RTC + EEPROM|right|Tiny RTC + EEPROM]] |
− | == | + | = Thông tin chung = |
+ | [https://chipfc.com/module-chuc-nang/thoi-gian-luu-tru/module-thoi-gian-thuc-rtc-ds1307.html Module Tiny RTC + EEPROM] trên trang chủ | ||
+ | |||
+ | == Giới thiệu == | ||
This tiny RTC module is based on the clock chip DS1307 which supports the I2C protocol. It uses a Lithium cell battery (CR1225). The 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 AM/PM indicator.<BR> | This tiny RTC module is based on the clock chip DS1307 which supports the I2C protocol. It uses a Lithium cell battery (CR1225). The 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 AM/PM indicator.<BR> | ||
− | + | ||
[[File:Tiny_RTC_EEPROM1.jpg|200px|400px]] | [[File:Tiny_RTC_EEPROM1.jpg|200px|400px]] | ||
[[File:Tiny_RTC_EEPROM2.jpg|200px|400px]] | [[File:Tiny_RTC_EEPROM2.jpg|200px|400px]] | ||
− | == | + | ==Đặc điểm== |
*5V DC supply<BR> | *5V DC supply<BR> | ||
*Programmable Square-Wave output signal<BR> | *Programmable Square-Wave output signal<BR> | ||
Dòng 16: | Dòng 19: | ||
*56-Byte, Battery-Backed, Nonvolatile (NV)RAM for data storage<BR> | *56-Byte, Battery-Backed, Nonvolatile (NV)RAM for data storage<BR> | ||
− | = | + | = Sử dụng = |
− | + | == Hardware== | |
The RTC module use the I2C bus to communicate with Arduino&Crowduinom. Arduino has one I2C port with A4 and A5, connect the RTC module to Arduino as below:<BR> | The RTC module use the I2C bus to communicate with Arduino&Crowduinom. Arduino has one I2C port with A4 and A5, connect the RTC module to Arduino as below:<BR> | ||
− | [[file:Tiny_RTC_EEPROM_hardware. | + | [[file:Tiny_RTC_EEPROM_hardware.png|500px]] |
− | + | == Programming == | |
1.Download the library File:[http://www.elecrow.com/wiki/index.php?title=File:RTC.zip RTC Library] | 1.Download the library File:[http://www.elecrow.com/wiki/index.php?title=File:RTC.zip RTC Library] | ||
Dòng 28: | Dòng 31: | ||
3.Open the code directly by the path:File -> Example ->RTC. | 3.Open the code directly by the path:File -> Example ->RTC. | ||
− | + | <syntaxhighlight lang="cpp"> | |
− | |||
#include <Wire.h> | #include <Wire.h> | ||
#include "RTClib.h" | #include "RTClib.h" | ||
Dòng 61: | Dòng 63: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
4.Upload the code,then open the serial monitor to see the current time. | 4.Upload the code,then open the serial monitor to see the current time. | ||
− | [[File:Tiny_RTC_EEPROM_result1.jpg | + | [[File:Tiny_RTC_EEPROM_result1.jpg]] |
== Resource == | == Resource == | ||
− | *[ | + | *[https://www.elecrow.com/wiki/index.php?title=Tiny_RTC Tiny RTC ] |
− | * | + | *[http://arduino.vn/tutorial/1370-huong-dan-su-dung-ic-eeprom-24cxx-cua-atmel-va-thu-vien Hướng dẫn sử dụng ic eeprom 24Cxx của Atmel] |
Bản hiện tại lúc 11:47, ngày 2 tháng 3 năm 2018
Mục lục
Thông tin chung
Module Tiny RTC + EEPROM trên trang chủ
Giới thiệu
This tiny RTC module is based on the clock chip DS1307 which supports the I2C protocol. It uses a Lithium cell battery (CR1225). The 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 AM/PM indicator.
Đặc điểm
- 5V DC supply
- Programmable Square-Wave output signal
- Automatic Power-Fail detect and switch circuitry
- Consumes less than 500nA in Battery-Backup Mode with Oscillator Running
- 56-Byte, Battery-Backed, Nonvolatile (NV)RAM for data storage
Sử dụng
Hardware
The RTC module use the I2C bus to communicate with Arduino&Crowduinom. Arduino has one I2C port with A4 and A5, connect the RTC module to Arduino as below:
Programming
1.Download the library File:RTC Library
2.Unzip it into the libraries file of Arduino IDE by the path: ..\arduino-1.0\libraries.
3.Open the code directly by the path:File -> Example ->RTC.
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;
void setup () {
Serial.begin(9600);
Wire.begin();
RTC.begin();
if (! RTC.isrunning()) {
Serial.println("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
RTC.adjust(DateTime(__DATE__, __TIME__));
}
}
void loop () {
DateTime now = RTC.now();
Serial.print(now.year(), DEC);
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print(' ');
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
delay(1000);
}
4.Upload the code,then open the serial monitor to see the current time.