Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - DS3231

(you are viewing a thread; or go back to list of threads)

DS3231 (by Alex)
hello friends, i have been looking for a way to use ds3231 with ansic generated by ldmicro, i have only found examples based on arduino and others based on time, day, year option, have to say, my whim, what i only want for now is to know how could i use 1hz square wave option from ds3231 to connect via I2C to an external interrupt pin of my 16f877a and increase each second a variable called "seconds" for me is much easier doing like that a clock than configuring time/day/year option, i have it done on my arduino UNO board but just because everything can be found in the internet for arduino plataform. thanks a lot :-)
Tue Sep 19 2017, 11:13:46
(no subject) (by Alex)
Hello i have been trying to just enable SQW pin working at exactly 1 hz of DS3231, i have made this code, could you tell me if it is ok?:

i have tested it in real life but it is like out of phase for about 2ms:


//================DS3231================

#define RTC_SDA PIN_C4
#define RTC_SCL PIN_C3

#use i2c(master, sda=RTC_SDA, scl=RTC_SCL)


void ds3231_init(void)
{

i2c_start();
i2c_write(0xD0);// WR to RTC
i2c_write(0x0E);
i2c_write(0xC0);//11000000
i2c_stop();

}
Sat Aug 4 2018, 20:27:56, download attachment DS3231.pdf
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):