PostHeaderIcon PIC16C73B: An 8-Bit ADC, Which Is Not What Anyone Assumes

The PIC16C73B is a 28-pin mid-range part with 4096 × 14 words of EPROM, 192 bytes of RAM, 22 I/O pins, two CCP modules, a USART, a synchronous serial port and a five-channel analog-to-digital converter. It is the 28-pin member of the PIC16C6X family and, for a while, one of the most common microcontrollers in small appliances and instrumentation.

The converter is eight bits. Not ten. That is worth stating first because almost every other PIC of the era — and every part that replaced this one — has a 10-bit ADC, and the assumption travels.

What the PIC16C73B actually contains

Item PIC16C73B
Core 14-bit instruction word, 35 instructions
Program memory 4096 × 14-bit EPROM (OTP, windowed variant available)
Data RAM 192 bytes
Data EEPROM none
I/O pins 22 (PORTA 5, PORTB 8, PORTC 8, plus RE bits)
A/D converter 8-bit, 5 channels
PWM CCP1 and CCP2
Serial USART, synchronous serial (SPI/I²C)
Timers Timer0, Timer1 (16-bit), Timer2
Packages 28-pin PDIP, SOIC, SSOP
Programming high voltage on MCLR, EPROM

Only the high byte of the result is used. ADRESH holds eight bits and ADRESL exists but carries nothing in 8-bit mode — which is the mechanical consequence of the resolution and the first thing to check when a listing seems to be discarding half of an analog reading.

Why eight bits changes the firmware

A 10-bit converter gives 1024 counts across the reference; an 8-bit converter gives 256. Firmware written for one and read as if it were the other produces errors that are consistently off by a factor of four, and those errors are easy to misread as a scaling bug in the code rather than a property of the silicon.

Three patterns show up in recovered images from this part:

Oversampling for resolution. Some designs take sixteen consecutive conversions and sum them, gaining two bits of effective resolution at the cost of time. In a listing this appears as a tight loop over ADCON0 with an accumulator, and the divide-by-sixteen afterwards. On a 10-bit part the same idiom gains two bits to twelve; here it reaches ten. Knowing which part the code was written for tells you what the final constant means.

Table-driven linearisation. 256 counts is coarse enough that a piecewise correction is often necessary. Because the part has no data EEPROM, the table has to live in program memory as a RETLW sequence read through the computed-jump idiom. The values are visible in the listing; what is not visible is where the table begins and ends, since RETLW is also an ordinary return-constant instruction.

Threshold comparisons with hysteresis baked into constants. On an 8-bit converter a two-count hysteresis band is nearly one percent of full scale, so appliance firmware that switches a relay on a measured value usually carries explicit upper and lower thresholds a few counts apart. Those pairs are distinctive in a recovered listing and identify the control decisions the product made.

The B revision

The B suffix is a silicon update, and on this family it is not cosmetic. The 16C73B adds the synchronous serial port that the earlier 16C73 lacked, and it carries errata fixes in the timer and CCP behaviour. Firmware written for a 73B that initialises the SSP will not work on a 73, and firmware written for a 73 may rely on a timing sequence the B revision changed.

For recovery this matters in one specific way: the part number silkscreened on the package is the only reliable indicator of which errata apply. A recovered image that seems to contain a workaround for a bug you cannot reproduce is usually a workaround for a revision you are not running.

Protection on an EPROM part

CP is one bit in the configuration word at 2007h, active low, covering all 4096 words. There is no partial protection, no CPD bit — there is no data EEPROM for CPD to protect — and no LVP bit, because this family predates low-voltage programming entirely.

What differs from the Flash parts is the mechanism available for changing that bit. On a Flash device the programming interface can clear CP, and the specification warns that doing so erases the array. On this part there is no such command: programming takes an EPROM bit from erased to programmed, and nothing in the interface returns it. On the plastic OTP package the configuration word is permanent. On the windowed ceramic package, ultraviolet light clears the entire die at once — program array, user ID words and configuration word together — so the barrier is bypassed only by destroying everything behind it.

The two package types therefore reach the same conclusion by different routes, and neither route is a matter of policy.

What a complete image contains

  • 0000h–0FFFh — 4096 × 14-bit program EPROM
  • 2000h–2003h — four user ID locations
  • 2006h — device ID
  • 2007h — the configuration word
  • no data EEPROM

Because there is no data EEPROM, the image is complete as a program. Everything the firmware knows is in the 4K words: the linearisation tables, the threshold constants, the serial protocol handler and the PWM setup. The 192 bytes of RAM are scratch and do not survive a power cycle.

That completeness has a corollary worth stating. A recovered PIC16C73B image cannot be missing calibration, because there is nowhere else for calibration to be. If a rebuilt device measures wrong with a verified image, the cause is outside the chip — the reference voltage, the sensor, or the oscillator frequency determined by the components around the part.

What the oscillator field does not tell you

FOSC1:FOSC0 selects RC, XT, HS or LP. All four settings require external components, so the actual frequency is a property of the board rather than of the configuration word.

This is a recurring theme with parts of this generation and it is worth being concrete about why it matters here. The PWM period in a motor or lamp design is set by Timer2 and its prescaler against the instruction clock. A recovered image carries the prescaler value and the period register; it does not carry the crystal. Rebuild the device with a different crystal and the PWM frequency changes proportionally — invisible on a bench test with a resistive load, obvious in a product that hums or overheats.

Related notes

The PIC16C73A is the earlier revision without the synchronous serial port, and the note on copying PIC16C73A code covers the same EPROM constraints. The 40-pin PIC16C65B adds the Parallel Slave Port to this core, and the 40-pin PIC16C77 is the family member with a 10-bit converter for comparison.

FAQ

Is the PIC16C73B ADC 8-bit or 10-bit? 8-bit, five channels. ADRESH holds the result and ADRESL carries nothing in 8-bit mode.

Can the program be changed after programming? No. It is OTP EPROM in the plastic package. A windowed ceramic part can be UV-erased and reused as a whole die.

Is there data EEPROM to recover? No. All constants are in program memory as RETLW tables.

What changed in the B revision? It adds a synchronous serial port and carries timer and CCP errata fixes. Firmware is not fully interchangeable with the earlier 16C73.

Does the configuration word give the clock frequency? No. It selects RC, XT, HS or LP. The actual frequency comes from the components on the board.

Conclusion

The PIC16C73B is a small part with one large trap: its converter has eight bits, not ten, and the firmware around it was written to that number. Get the resolution right and the recovered image reads cleanly — tables, thresholds, PWM setup and all, in a 4K array with no second memory to chase. Get it wrong and every analog value in the program appears to be scaled by four, which is a much harder thing to notice than a chip that refuses to run.

Comments are closed.