Closed pyzimmer closed 2 years ago
Thanks for contacting me.
The resolution of the DS3231 time registers is up to 1 second and does not support reading the time in milliseconds.
As workaround, you can configure the SQW (Square Wave Out) pin to generate a 1024Hz, 4096Hz or 8192Hz clock with function setSquareWave(SquareWaveXXXXHz). Then you can count the pulses by a microcontroller to measure times in milliseconds.
Thanks for reply ! I know it, but I wish that this function is included in the library.
Capturing the SQW pin by a microcontroller should be handled by the application, because the DS3213 library has no dependencies on the microcontroller type.
Are you using an AVR / ATMega328 microcontroller (Arduino UNO/Mini etc) for example? This controller supports a 16-bit Input Capture Register on timer 1 which can be used to count SQW pulses from the RTC. A new function can be implemented by the application to convert the number of pulses to milliseconds.
Hello, You make a good job ! Is it possible to get milliseconds from DS3231 ? thanks