Jump to content
43oh

Kross

Members
  • Content Count

    3
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Kross got a reaction from Fmilburn in DS3231 RTC Library for 5529   
    the _BV is a macro defined here http://www.atmel.com/webdoc/AVRLibcReferenceManual/group__avr__sfr_1ga11643f271076024c395a93800b3d9546.html. (I searched a solution during 3 hours)
    I was having the same problem with this library, so I've added these lines:
    #define _BV(bit) \ (1 << (bit))  in DS3231RTC.h and tcharam! it works.   I've to added time.h (It was found here http://www.pjrc.com/teensy/td_libs_Time.html)in /<User>/Documents/Energia/Libraries   I was setting to: Wire.begin();  and Wire.setModule(0); cause I'm used the SCL(0) and SDA(0) in my launchpad. References here: http://energia.nu/wordpress/wp-content/uploads/2014/01/tm4c123pinmap.png   I'm using Tiva C 123GXL.   This example works with me and I hope it works with you: /* * TimeRTC.pde * Example code illustrating Time library with Real Time Clock. * This example is identical to the example provided with the Time Library, * only the #include statement has been changed to include the DS3232RTC library. */ #include <DS3232RTC.h> //http://github.com/JChristensen/DS3232RTC #include <Time.h> //http://www.arduino.cc/playground/Code/Time #include <Wire.h> //http://arduino.cc/en/Reference/Wire (included with Arduino IDE) void setup(void) { Wire.begin(); Wire.setModule(0); Serial.begin(9600); setSyncProvider(RTC.get); // the function to get the time from the RTC if(timeStatus() != timeSet) Serial.println("Unable to sync with the RTC"); else Serial.println("RTC has set the system time"); } void loop(void) { digitalClockDisplay(); delay(1000); } void digitalClockDisplay(void) { // digital clock display of the time Serial.print(hour()); printDigits(minute()); printDigits(second()); Serial.print(' '); Serial.print(day()); Serial.print(' '); Serial.print(month()); Serial.print(' '); Serial.print(year()); Serial.println(); } void printDigits(int digits) { // utility function for digital clock display: prints preceding colon and leading 0 Serial.print(':'); if(digits < 10) Serial.print('0'); Serial.print(digits); } This library will be useful to me, because I need the alarm function to wake up the launch pad. 
×
×
  • Create New...