i connected a ds3231 rtc to pic 18f4620
if i use soft i2c ( ccs complier) the rtc is working good if i switch off and on the main power for 3 are 4 times one time the day or time changes how to solve this problem.
the soft i2c settings are :
#include <18F4620.h>
#device ADC=16
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
//#use I2C_Speed (400000);
#use delay(crystal=12MHz)
#use I2C(Master, SDA = pin_C4, SCL = pin_C3,NOINIT,Fast=300000) // software
if i use the hard ware i2c every thing working fine if i intrupt the main power 3 are 4 times one time the pic chip gets hanged no data in lcd even if i press the reset button no change after some 5 minutes of power off and on i can get the data
in hard ware i2c the date and time is not changing.
how to solve this
#use i2c(Master,Fast=300000,I2C1,force_hw) // hardware
the rtc is backed up with 3.3v batt
regards
kalyan