Re: PIC16F877A Problem
Check the errata sheets for the 16F877A:
https://ww1.microchip.com/downloads/en/DeviceDoc/80133f.pdf
https://ww1.microchip.com/downloads/en/DeviceDoc/80128f.pdf
I personally stay away from all Microchip "A" types :-(
3. Module: Core
Certain code sequence and placement may cause
the corruption of a few bits in the instruction fetch
when the part is used above 4 MHz. A corrupted
instruction fetch will cause the part to execute an
improper instruction and result in unpredictable
outputs.
Microchip cannot predict which code sequences
and placement will cause this failure. If this failure
mechanism exists in your system, it should be evi-dent
during statistically significant preproduction
testing (minimum suggested sample size 100
units) of your particular code sequence and
placement.
Any code change should be tested in the same
manner prior to their implementation. If most parts
fail your tests, or if failures are seen at all voltages
or at all frequencies, this indicates that the problem
experienced does not relate to this failure
mechanism.
This problem has not been observed at operating
frequencies below 4 MHz.
Work around
Use the part at or below 4 MHz.
This problem is specific to Rev. B0 and has been
resolved by Rev. B2 of the silicon (date codes later
than 0242xxx).
best regards