Hi! I have a small project done in PIC16F628A.But I’m having a resetting problem sometimes.
It means when power up the PIC it is not resetting immediately. Sometimes it takes about 10 mins to reset, so I have to wait until that time to see the circuit working.
Can somebody tell me a way to reset the PIC smoothly when power up?
I didn’t use a pull-up resistor for RA5 (MCLR).I kept that pin free. (Earlier I placed that resistor but no progress.) Also I never use a decoupling capacitor 1uF near the PIC.
Here is my initialization code.
Code:
movlw 0x07 ;turn off comparators
movwf CMCON
bsf STATUS,RP0
clrf TRISB ;make all PORB pins output
movlw b'11000' ;RA3,RA4 inputs
movwf TRISA
bcf STATUS,RP0
goto MAIN
Do I need to add a DELAY before the main program starts to solve this problem?
Is it relatively easy for you to change the BODEN setting and test to see if it makes a difference? You may also want to try changing the PWRT setting.
I didn’t use a pull-up resistor for RA5 (MCLR).I kept that pin free. (Earlier I placed that resistor but no progress.) Also I never use a decoupling capacitor 1uF near the PIC.
You do need a decoupling capacitor next to the chip, although not 1uF. Try using a 0.1uF or 0.01uF ceramic type.
Also set PWRT in config, it will introduce a startup delay of about 70ms to give your power supply enough time to reach 5 volts before starting the program.