Skip to content

setAgingOffset()

Arnd edited this page Aug 20, 2017 · 1 revision

This function sets the contents of the aging offset register. While the DS3231M is factory calibrated and the default aging offset register value is 0, it is possible to adjust or further calibrate the clock by setting this register. Each value represents a 0.12ppm change in frequency with values from -127 to 127 possible.

Example:

...
DS3231M_Class DS3231M; // Create an instance of the DS3231M
...
void setup() {
  Serial.begin(SERIAL_SPEED);
  while (!DS3231M.begin()) { // Initialize RTC communications
    Serial.println("Unable to find DS3231M. Checking again in 1 second.");
    delay(1000);
  } // of loop until device is located
 DS3231.setAgingOffset(DS3231M.getAgingOffset()+2); // make 0.24ppm slower
 Serial.print("Aging register contents is ");
 Serial.println(DS3231M.getAgingOffset());
...
Clone this wiki locally