نمایش نتایج: از 1 به 10 از 49
Like Tree14 لایک

موضوع: ماژول ساعت فوق دقیق ds3231 با رابط i2c

Threaded View

  1. #1
    Senior Member
    تاریخ عضویت
    Mar 2013
    محل سکونت
    Iran
    نوشته ها
    138

    Lightbulb ماژول ساعت فوق دقیق ds3231 با رابط i2c

    ماژول DS3231 یک ماژول ارزان قیمت و با دقت بسیار I2C برای زمان سنج بلادرنگ (RTC) است.
    این ماژول از یک اسیلاتور کریستال یکپارچه جبران دما (TCXO) و کریستال تشکیل شده است . این ماژول در مقایسه با DS1302 دارای مزایای بسیاری است که از آن می توان به عملکرد همراه با رنج ولتاژ VCC از 2.3V تا 5.5V و وجود باتری بک آپ نام برد.
    این ماژول برخلاف DS1307 دارای یک کریستال یکپارچه (بدون نیاز به کریستال خارجی) ، سنسور دما ، دو تایم آلارم قابل برنامه ریزی و یک خروجی 32.768 برای تامین دقت بالاتر است و همچنین وجود یک EEPROM AT24C32 با ظرفیت 32K امکان ذخیره دیتا را برای شما فراهم میکند.
    این ماژول بهترین انتخاب برای برنامه و پروژه شما جهت رفع نیاز به ثبت زمان و مناسب به عنوان شیلد ثبت دیتا با دقت زمانی بالا است.

    برای دیدن سایز بزرگ روی عکس کلیک کنید

نام: Extremely_Accurate_RTC_Module-500x500.jpg
مشاهده: 272
حجم: 46.2 کیلو بایت

    ویژگی ها
    ولتاژ عملیاتی: 3.3 تا 5.5 ولت
    چیپ کلاک: DS3231
    دقت کلاک : 0-40 ℃
    همراه با دو کلاک تقویم آلارم
    خروجی موج مربعی قابل برنامه ریزی
    دارای تولید کننده RTC برای ثانیه ، دقیقه ، ساعت، روز ، تاریخ ، ماه و سال و اعتبار تا سال 2100 و تصحیح سال کبیسه
    چیپ مموری : AT24C32
    ارتباط از انوع I2C و ماکزیمم سرعت انتقال 400KHz در ولتاژ 5 ولت
    امکان کاسکید با دیگر دستگاه های I2C

    مثال
    در کد زیر با اتصال ماژول DS3231 به آردینو و باز کردن پنجره Serial Monitor ساعت و تاریخ را مشاهده کنید.

    برای دیدن سایز بزرگ روی عکس کلیک کنید

نام: DS3231_bb.jpg
مشاهده: 456
حجم: 83.2 کیلو بایت

    کد:
    /* DS3231_test.pde Eric Ayars 4/11 Test/demo of read routines for a DS3231 RTC. Turn on the serial monitor after loading this to check if things are working as they should. */ #include <DS3231.h> #include <Wire.h> DS3231 Clock; bool Century=false; bool h12; bool PM; byte ADay, AHour, AMinute, ASecond, ABits; bool ADy, A12h, Apm; byte year, month, date, DoW, hour, minute, second; void setup() { // Start the I2C interface Wire.begin(); Clock.setSecond(50);//Set the second Clock.setMinute(59);//Set the minute Clock.setHour(11); //Set the hour Clock.setDoW(5); //Set the day of the week Clock.setDate(31); //Set the date of the month Clock.setMonth(5); //Set the month of the year Clock.setYear(13); //Set the year (Last two digits of the year) // Start the serial interface Serial.begin(115200); } void ReadDS3231() { int second,minute,hour,date,month,year,temperature; second=Clock.getSecond(); minute=Clock.getMinute(); hour=Clock.getHour(h12, PM); date=Clock.getDate(); month=Clock.getMonth(Century); year=Clock.getYear(); temperature=Clock.getTemperature(); Serial.print("20"); Serial.print(year,DEC); Serial.print('-'); Serial.print(month,DEC); Serial.print('-'); Serial.print(date,DEC); Serial.print(' '); Serial.print(hour,DEC); Serial.print(':'); Serial.print(minute,DEC); Serial.print(':'); Serial.print(second,DEC); Serial.print('\n'); Serial.print("Temperature="); Serial.print(temperature); Serial.print('\n'); } void loop() {ReadDS3231();delay(1000); // send what's going on to the serial monitor. // Start with the year /* Serial.print("2"); if (Century) { // Won't need this for 89 years. Serial.print("1"); } else { Serial.print("0"); } Serial.print(Clock.getYear(), DEC); Serial.print('-'); // then the month Serial.print(Clock.getMonth(Century), DEC); Serial.print('-'); // then the date Serial.print(Clock.getDate(), DEC); Serial.print(' ');*/ // and the day of the week /*Serial.print(Clock.getDoW(), DEC); Serial.print(' ');*/ // Finally the hour, minute, and second /*Serial.print(Clock.getHour(h12, PM), DEC); Serial.print(':'); Serial.print(Clock.getMinute(), DEC); Serial.print(':'); Serial.print(Clock.getSecond(), DEC); // Add AM/PM indicator if (h12) { if (PM) { Serial.print(" PM "); } else { Serial.print(" AM "); } } else { Serial.print(" 24h "); } // Display the temperature Serial.print("T="); Serial.print(Clock.getTemperature(), 2); // Tell whether the time is (likely to be) valid if (Clock.oscillatorCheck()) { Serial.print(" O+"); } else { Serial.print(" O-"); }*/ // Indicate whether an alarm went off /*if (Clock.checkIfAlarm(1)) { Serial.print(" A1!"); } if (Clock.checkIfAlarm(2)) { Serial.print(" A2!"); }*/ // New line on display //Serial.print('\n'); // delay(1000); // Display Alarm 1 information /* Serial.print("Alarm 1: "); Clock.getA1Time(ADay, AHour, AMinute, ASecond, ABits, ADy, A12h, Apm); Serial.print(ADay, DEC); if (ADy) { Serial.print(" DoW"); } else { Serial.print(" Date"); } Serial.print(' '); Serial.print(AHour, DEC); Serial.print(' '); Serial.print(AMinute, DEC); Serial.print(' '); Serial.print(ASecond, DEC); Serial.print(' '); if (A12h) { if (Apm) { Serial.print('pm '); } else { Serial.print('am '); } } if (Clock.checkAlarmEnabled(1)) { Serial.print("enabled"); } Serial.print('\n'); // Display Alarm 2 information Serial.print("Alarm 2: "); Clock.getA2Time(ADay, AHour, AMinute, ABits, ADy, A12h, Apm); Serial.print(ADay, DEC); if (ADy) { Serial.print(" DoW"); } else { Serial.print(" Date"); } Serial.print(' '); Serial.print(AHour, DEC); Serial.print(' '); Serial.print(AMinute, DEC); Serial.print(' '); if (A12h) { if (Apm) { Serial.print('pm'); } else { Serial.print('am'); } } if (Clock.checkAlarmEnabled(2)) { Serial.print("enabled"); }*/ /* display alarm bits Serial.print('\n'); Serial.print('Alarm bits: '); Serial.print(ABits, DEC); */ /* Serial.print('\n'); Serial.print('\n'); delay(1000); // Display the time once more as a test of the getTime() function Clock.getTime(year, month, date, DoW, hour, minute, second); Serial.print(year, DEC); Serial.print("/"); Serial.print(month, DEC); Serial.print("/"); Serial.print(date, DEC); Serial.print("day of the week :"); Serial.println(DoW, DEC); Serial.print(hour, DEC); Serial.print(":"); Serial.print(minute, DEC); Serial.print(":"); Serial.println(second, DEC);*/ }
    مرجع:
    RTC& EEPROM Module DS3231 AT24C32 [SMI3231DS] - $4.80 : Elecrow bazaar, Make your making more easy

    جهت سفارش این کالا، به این بخش در فروشگاه آفتاب رایانه مراجعه نمایید.
    فایل های پیوست شده فایل های پیوست شده
    ویرایش توسط hesam.time : 07-14-2014 در ساعت 07:11 AM

کلمات کلیدی این موضوع

مجوز های ارسال و ویرایش

  • شما نمیتوانید موضوع جدیدی ارسال کنید
  • شما امکان ارسال پاسخ را ندارید
  • شما نمیتوانید فایل پیوست کنید.
  • شما نمیتوانید پست های خود را ویرایش کنید
  •  

SEO by vBSEO