PIC16F84A · the first milliseconds after switch-on

Power-Up Reset Lab

When you switch on, VDD ramps up and the crystal takes milliseconds to start. Until both are healthy the PIC must be held in reset. Pick a reset circuit, set PWRTE, and watch when the CPU is allowed to run.

Power-up timeline

VDD MCLR pin OSC1 VDD below 4.0 V clock not stable
t = 0.0 ms

Set up the board

changes re-run the power-up
Reset circuit on MCLR (pin 4)
Power-up timer config bit PWRTE (active-low)
Oscillator mode FOSC bits
Time for the crystal to build to full, steady amplitude.
What happens after switch-on
Short interruptions may not let VDD fall low enough to re-arm the internal POR.
Try these

Reset circuit

OFF

Power is off.

Did the PIC start safely?

    Why keep the PIC in reset?

    1. VDD is still climbing. Below about 4 V a 4 MHz PIC16F84A is outside its operating range: instructions can execute wrongly and RAM and register contents are not reliable.
    2. The crystal is still starting. Its oscillation grows from noise over several milliseconds; early cycles are small, irregular and can glitch the CPU.
    3. The answer is a delay. The internal POR, the 72 ms power-up timer (PWRTE) and the 1024-cycle oscillator start-up timer (XT/LP/HS only), or an external RC on MCLR, hold the chip in reset until both are healthy.

    The datasheet's external circuit (b): R < 40 kΩ so MCLR leakage does not pull the pin below its input threshold; Rs = 100 Ω–1 kΩ limits current into MCLR if C discharges into it (ESD or overstress); the diode empties C quickly when the power goes off. The 16F84A has no brown-out reset, so short supply dips are its weak spot.