Hi,
I have developed a DS1307 RTC (with backup battery) based 7 segment display clock based on PIC16F628A. It has 3 push switches for hr adjust, min adjust and reset. Everything goes OK when I run it on battery. When I run it on (12V 1A SMPS type)an AC power adapter, it runs smoothly except during the situation when you plug in the AC adapter to the mains wall outlet or when the adaptor makes a sudden connection/disconnection with the socket. It's easy to identify because small sparking will be visible at the mains socket.During this time, the ds1307 stops working. This happens 1/4 times. At first I noticed this by accident, but then I checked by intentionally connecting and disconnecting the adapter several times. This does not occur when power goes on/off normally or when the adapter is fixed on the AC socket. Although less frequently, when the AC switch is turned on, the RTC stops sometimes. If I need to restart the system, I need to press the reset switch which will write a default value into the RTC through the PIC.
I thought it was the problem with the uC, but the PIC is running well.I don't have an oscilloscope but I've checked the square output from the DS 1307 and confirmed that it is not working. The 12V DC input power supply from AC adapter is filtered using a 1000uF 25v and a 10uF cap is connected to the output of the 7805 regulator which feeds power to the PIC and RTC. I've tried several solutions like common mode filter, EMI filter capacitor, 0.1uf decoupling capacitor near the RTC, adding delay before reading from the RTC, power on reset etc..... But none of these solutions solved this strange problem.
This also happens when using a step down transformer based AC adapter. This is the first time that I am seeing this happen and I am confused about this.....My only clue is that this is somehow related to the sparking at the power plug. Please help me in solving this issue..........