PIC10F220 Code Recovery: An 8-Bit ADC On Six Pins

The PIC10F220 is a different animal from the rest of the six-pin line. It keeps the 12-bit core and the 256-word array, but replaces the comparator with a two-channel 8-bit analog-to-digital converter sampling AN0 and AN1. It still has no data EEPROM, no serial interface and sixteen bytes of RAM, which means the device that measures an analog voltage also has nowhere to store the result except registers and code constants.

Two Channels, Eight Bits, No Storage

The converter resolves eight bits across the selected reference, and the part gives you two input pins to feed it. That is enough for a battery gauge, a light-level switch, a thermistor trip point or a potentiometer-trimmed timer, which is the entire market for a part in a six-pin package.

The absence of EEPROM is the design fact that shapes everything else. A calibrated threshold has to be written into the firmware as an immediate value, because there is nowhere else for it to live. So a read-out of a PIC10F220 does not merely recover logic, it recovers the numbers the product was tuned with, and those numbers are often the only copy of a calibration that was performed once at the factory.

Reading Thresholds Out Of The Instruction Stream

On this core there is no immediate-operand arithmetic to speak of; values arrive through MOVLW and are consumed by the compare or subtract that follows. A useful review of a recovered image therefore walks the code looking for MOVLW constants that sit near an ADC read, and annotates them.

That annotation is where a report earns its keep. “0x8C compared against the converter result” is a fact about the product. It tells a maintenance engineer what the cut-off voltage was, whether the trim was positive or negative, and how much hysteresis the design applied. Without it, the file is correct and unreadable.

The Array, The Block And The Lock

256 words of 12-bit memory, 0x000 to 0x0FF, with 0x0FF reserved for the oscillator trim constant. In programming mode the address space extends to 0x1FF, and the upper half is configuration memory: four user ID words, a backup trim value and the configuration word at the top, which carries the code-protect bit along with the watchdog, master-clear and oscillator settings.

Erased flash reads 0x3FF. A protected array reads zeros, and zero is NOP on this core, so a locked region disassembles into a plausible run of no-ops rather than an obvious blank. Because both states look tidy, the honest determination comes from the device ID response, the marking, and where in the address map the zeros begin. How the protect bit is implemented across PIC parts covers the general model.

What Analog Firmware Looks Like When It Is Locked

A protected PIC10F220 still answers identification and still yields its configuration block. That is often enough to answer the first commercial question: was the watchdog enabled, and which oscillator mode was used? Those two bits tell you whether a recovered image can drop into a blank replacement unmodified or needs the configuration block restored as well.

The array, when it is readable, tends to be short and repetitive: an acquisition sequence, a compare, a decision, an output drive. Only a few hundred instructions. What makes the job non-trivial is proving the image matches the original, since an eight-bit threshold that is off by one code does not fail immediately, it fails at the end of a discharge curve three months later.

Handling And The Physical Side

SOT-23 with six leads, often on a board that is potted or conformally coated. Removal is the risk, not the read. A part this small loses its leads easily, and a lifted pad on a two-layer board with a fine pitch footprint turns a routine job into a rework exercise for the customer.

That is one reason to exhaust electrical options first: a locked but living part can be identified, its configuration captured, and its package photographed for the marking before any thermal work starts. Semi-invasive extraction is the usual route when the array must come off the die, and it is chosen for parts where package removal is the dominant risk.

Deliverable And Checks

The file should leave the bench with the array, the configuration block and the trim constant accounted for separately, plus two independent reads compared word by word and a programming test into a blank part. Reading program memory describes that sequence, and our services page lists what each deliverable includes.

If a board marked PIC10F220 has stopped and the firmware is the only remaining copy of its calibration, send the marking and a note on what the product measures, then contact us and we will confirm the array size, the converter channels in use and the configuration bits before quoting. The PIC10F222 is the same converter with 512 words of program memory.