I have a PIC18F46K80 microcontroller. The ADC input is connected with OPAMP TL064I output through a 2.2k resistor and Schottky diodes in the ADC input as in the figure.
I have changed a capacitor C1 in the power supply circuit of this project from 1000uF to 220uF has a voltage of -20V which drives the -12V (VCC-) of the OPAMP.
I have noticed that when the power go OFF while using the 220uF capacitor it discharges faster and the OPAMP output become small but positive (about +300mV) and decay slowly. If the power come back again while this signal (+300mV) is in the OPAMP output (the ADC input); the reading from the ADC gives constant (most of the time is 0) value, despite the signal being 50Hz sinewave.
If I made a software reset or wait for long time before reconnecting the power (until the OPAMP signal become small; less than +200mV, or discharge power supply capacitors by hand), the ADC works properly.
The old design uses a 1000uF in the -20V supply (which discharge slower than the 220uF), and when the power go OFF the OPAMP output goes negative in very short time.
This didn’t occur in every board that I have tested. It occurred in 4 out of 10 boards.
I have assembled these boards in a small SMT assembly factory in Shenzhen. I have noticed that they don’t have a grounded floor and they have only one reflow oven, so they have to put the assembled board in a metal tray to put it by hand in the oven.
I am wondering if this issue is inherit to the ADC operation when transients occur? (Though there are Schottky with resistor!)
Or, could it be ESD damage caused by poor handling in the SMT factory? (other functions by the microcontroller operate correctly!)
As requested in comments, here is the external MCLR circuit: