Wond3rboy
Member
Hi i am trying to program the DS3232 to generate an interrupt every second. But even after following the right directions, it just isn't getting done. I can generate a square wave of various frequencies but am not able to generate the Alarm Interrupt per second.
I want you guys to look at the bold lines of code. According to the Datasheet of the DS3232(PG# 12) I have written 1 on each of the Four Bit masks but for some reason the RTC is not generating an interrupt every second. All Data Transfer routines are correct. They are working.
https://www.electro-tech-online.com/custompdfs/2010/06/DS3232.pdf
Thanks.
Code:
Delay1KTCYx(500);// Let the RTC Startup
Write_DS3232(Control,0x85);
while(SSPCON2bits.ACKSTAT!=0);// wait for ack from RTC
Write_DS3232(Seconds,0x00);
while(SSPCON2bits.ACKSTAT!=0);// wait for ack from RTC
Write_DS3232(Minutes,0x00);
while(SSPCON2bits.ACKSTAT!=0);// wait for ack from RTC
Write_DS3232(Hours,0x12);
while(SSPCON2bits.ACKSTAT!=0);// wait for ack from RTC
Write_DS3232(Day,0x01);
while(SSPCON2bits.ACKSTAT!=0);// wait for ack from RTC
Write_DS3232(Date,0x01);
while(SSPCON2bits.ACKSTAT!=0);// wait for ack from RTC
Write_DS3232(Month_Century,0x01);
while(SSPCON2bits.ACKSTAT!=0);// wait for ack from RTC
Write_DS3232(Year,0x10);
while(SSPCON2bits.ACKSTAT!=0);// wait for ack from RTC
[B] Write_DS3232(Alarm1_seconds,0x80);
while(SSPCON2bits.ACKSTAT!=0);// wait for ack from RTC
Write_DS3232(Alarm1_minutes,0x80);
while(SSPCON2bits.ACKSTAT!=0);// wait for ack from RTC
Write_DS3232(Alarm1_hours,0x80);
while(SSPCON2bits.ACKSTAT!=0);// wait for ack from RTC
Write_DS3232(Alarm1_day_date,0x80);
while(SSPCON2bits.ACKSTAT!=0);// wait for ack from RTC
Write_DS3232(Control,0x05);
while(SSPCON2bits.ACKSTAT!=0);// wait for ack from RTC[/B]
I want you guys to look at the bold lines of code. According to the Datasheet of the DS3232(PG# 12) I have written 1 on each of the Four Bit masks but for some reason the RTC is not generating an interrupt every second. All Data Transfer routines are correct. They are working.
https://www.electro-tech-online.com/custompdfs/2010/06/DS3232.pdf
Thanks.
Last edited: