I am trying to collect data from analog sensors (temperature and relative humidity) with a PIC microcontroller (PIC18F14K50). In order to save battery, the supply voltage of the sensors is turned ON when data have to be collected and turned OFF after. The supply voltage is controlled by the pin RB7 of the microcontroller. The problem is that when the pin RB7 of the PIC goes high, the PIC is reseted, I have tried several software and hardware modifications but the problem remains. I am out of ideas now, may you have any suggestions ?
Note :
- If RB7 is turned ON at the very beginning of the program and remains ON, there is no reset.
- The 4MHz crystal and two 15pF capacitor connected to RA4 and RA5 are not shown here
- I am using a switching voltage regulator to provide the +5V from +9V battery