Mr RB
Well-Known Member
...The original factory circuit used 1.2k current limiting resistor on the IRLED and 47K on the photo transistor.
...
... In each case the PIC was programmed identically. But each PIC appears to have had a different input pin impedance so the reported voltage range differed drastically.
A photosensor with 47k pullup is very typical, and will not be affected in any significant way by the PIC pin input impedance between PIC batches. Even different PIC types will work very similarly when their ADC input is facing a 47k analogue source.
I'm sure you are missing something in config or code, like one PIC has port pullups on, the other not. Or one has pins set to analog the other not. Or one trying to run RC osc the other from xtal (which affects ADC acq time). And all those things can cause ADC issues and are the type of things that can be set/cleared in config.
Did you try programming that bad HEX file back into the good PIC as I suggested?