PostHeaderIcon Break IC PIC16C57C Firmware: The Clock Is Ordered, Not Configured

Most microcontrollers of this generation let the designer choose a clock source by writing a configuration word, which means the choice survives in the part and can be read back. The PIC16C57C does not work that way. Its oscillator is decided when the part is ordered, sits in the device type itself, and is invisible to every command the programming interface offers. A recovery therefore delivers a firmware image plus a gap: the one design decision that matters most to timing has to be reconstructed from the board or from the customer’s memory of what they used to buy.

The rest of the device is familiar 12-bit core territory: 2048 words of one-time-programmable program memory, 72 bytes of RAM spread over three banks, twenty I/O pins across PORTA, PORTB and PORTC, thirty-three instructions and no interrupts.

The part in numbers

item PIC16C57C
program memory 2048 by 12 bits, OTP
program pages 4, each 512 words
page select PA1 and PA0 in the status register
data RAM 72 bytes, three banks
I/O 20 pins
stack two levels, hardware
clock selection fixed by order code, not by a bit
protection two code-protect fuses

The last two rows are where this page differs from its neighbours. The stack depth is the same constraint every 12-bit part carries, but the clock row is unique to this class, and it is the one that turns a straightforward read into an incomplete delivery unless it is handled explicitly.

There is no oscillator bit to read

A PIC16C57C ordered as an RC part expects a resistor and capacitor on its clock pin. Ordered as XT it expects a crystal in the low megahertz range. Ordered as HS it expects a crystal that can drive the higher frequency the part is graded for. The die is the same across all three; the difference is the silicon that was characterised at test and, in practice, the mask option or the tested grade that the order code maps to.

This matters at read time because there is nothing in the image that names the clock. The configuration word carries the protection fuses and the watchdog enable, and that is all. Anyone who has read a PIC16F-class part first will look for an FOSC field, not find it, and assume the read was truncated.

It matters even more at rebuild time. A firmware image from an RC part, burned into an XT part, will run and will run at the wrong speed, because every delay loop in the program was tuned to an RC tolerance of a few tens of percent and the oscillator start-up behaviour the code waits for does not exist in the crystal configuration. The program does not fail immediately; it fails at the margins, which is worse.

Reading the clock off the board

Three methods work, in order of reliability.

The first is the order code on the part itself. The suffix that follows the temperature and package codes names the oscillator, and it is legible under magnification on most units before any decapsulation.

The second is the board. An RC configuration has two passive components next to the clock pins and no crystal; a crystal configuration has the crystal and two load capacitors; an HS design usually has a visibly higher-frequency crystal and shorter traces. This is reliable enough to distinguish the three families and unreliable for reading a frequency.

The third is the code. Delay routines carry the loop count in their immediate operands, and a loop that spends four hundred instruction cycles to produce one millisecond implies a clock of roughly 1.6 MHz, not 4. Working backwards from a timing constant is imprecise but it falsifies bad guesses quickly, which is what a triage needs.

Four pages and the bits that select them

2048 words is more than the nine-bit address field inside GOTO and CALL can reach. The part therefore splits the array into four pages of 512 words and puts the page selection in two status bits: PA1 and PA0. A call to an address in another page is really two operations, a status change and a call, and the page bits stay where they were put until something changes them.

For a disassembler this is the single structural hazard on the part. Following execution linearly across a page boundary without tracking PA1:PA0 produces a listing where the target of every cross-page call is wrong by 512, 1024 or 1536 words. The bytes are correct; the control flow graph is fiction. The same hazard exists on every member of the family above 512 words, which is why the 16C54 class is so much easier to read and so much easier to get right.

The practical rule: reconstruct the page state at every entry point, not once at the reset vector. A page change inside a subroutine that returns without restoring the previous page is legal, common in hand-written assembly, and invisible to a linear sweep.

What the configuration word does contain

Two fields, both consequential. The watchdog enable decides whether the program is written to service a timer that resets the part, and the two protection fuses decide whether the array reads at all. On an OTP device the protection fuses are physical: once blown they cannot be restored, and the array will not answer a read command again.

There is a subtlety in the protection encoding worth knowing before triage. Two fuses give four combinations, but only the fully open and fully blown states are documented as useful, and a part that reads halfway deserves suspicion rather than a code. Partial protection usually means a programming fixture that aborted mid-sequence or a die that was damaged in handling.

What “firmware” has to include here

The request says firmware, and on a part of this age the word implies more than the instruction stream. A complete delivery for a 16C57C contains the 2048-word array, the configuration word, and a written statement of the oscillator grade that the image assumes. The last item is not recoverable from the device and is the one that customers forget they need until the first rebuilt unit misbehaves.

Two file conventions also need stating, because the 12-bit core packs two words into three bytes and different tools disagree about the trailing nibble. A 2048-word image delivered as 3072 bytes is the packed convention; the same image delivered as 4096 bytes uses two bytes per word with the top four bits clear. Both are correct. Mixing them produces an image in which every word after the first is shifted by half a word, and the failure looks like a corrupt array rather than a formatting choice.

For the same array handled as a container rather than a device, PIC16C57 heximal file extraction deals with the file conventions in detail. For the smaller sibling where none of this paging exists, PIC16F54C program recovery covers the single-page case. And where the same fuse-based protection sits behind a different pin count, PIC16C56 code copying takes the parallel route.

FAQ

Can the oscillator grade be changed after recovery? Not on the die. The grade is a property of the part that was ordered. A rebuilt unit must use the same grade, or the firmware’s timing constants have to be rewritten, which is a development task rather than a recovery one.

Does a protected part still answer anything? The configuration word is often readable when the array is not, and on this family that is the only signal available. A part that returns a plausible configuration word and a repeating array pattern is protected, not damaged.

Is a 12-bit core worth reading in 2026? Constantly. Legacy industrial controllers, appliance boards and aftermarket automotive modules built in the nineteen-nineties are still in service, and the only copy of their firmware is on the part.

The short version

The PIC16C57C keeps its clock outside its memory. Read the order code, read the board, sanity-check against the delay loops, and deliver the array together with a written statement of the oscillator grade it assumes. Track the page bits through every entry point, keep the packing convention explicit, and the rest of this part behaves exactly like the rest of its family.

Comments are closed.