DS3231 In milliseconds

Hello , Is it possible to get DS3231 to record in hours:minutes:seconds:milliseconds? If it is possible, can anyone explain how is it done?

Thank you

You could use the int/sqw pin on the DS3231, generate .9765ms interrupts connected to an interrupt pin on the Arduino. Then deal with this interrupt on the Arduino. .

So, I should be connecting SQW on DS3231 to say, pin 2 or 3 on the arduino (promini)?

Is there any sample code or example available to program ?

use the 1Hz output to generate the interrupt. There is example code on the arduino web-site. The intr.routine just saves "millis()" to a volatile long variable (this marks start of second)

When you want to print time: Read from clock and then add (millis() - the saved millis) Now the x-tal/RC-osc. takes tare of timing within the full second.

Can you please post the link to the example. I could not find it.

From http://www.arduino.cc/en/Reference/AttachInterrupt

May be like this

const byte interruptPin = 2; // intr 0
volatile unsigned long start_sec; // this is to hold start of sec
byte centi_sec; 
void setup()
{
  pinMode(interruptPin, INPUT_PULLUP);
  attachInterrupt(0, update_sec_start, FALLING); // or RISING 
}

void loop() 
{
  // lots of code here
  // read your time: hr,min,sec;
  centi_sec = (millis()-start_sec)/10;
  // printout time.. 
}

void update_sec_start() // this updates every second.
{
  start_sec=millis();
}

For millisec: Remove /10 and change datatype to int (maybe also the variable_name)