Posts Tagged ‘reverse microchip mcu hex’
PIC16F77 Flash: Watching the Bus Instead of Reading the Array
Not every question about a microcontroller is a question about its bits. The PIC16F77 is a forty-pin part with eight thousand words of flash and one feature its smaller relatives lack: a port that can be configured as a parallel slave, so the device can sit on an eight-bit bus as a peripheral rather than being the only processor in the design. Where a product uses that, there is a second way to learn what the firmware does.

Why the pins change the question
A design that puts this part on a host bus has already solved the observability problem for you. Address lines, data lines and strobes are physical signals on the board, at logic levels, in a protocol that the host drives. Clipping a logic analyser to them records the conversation between the two processors, and that conversation is the interface specification of the firmware in the only form that matters: what it accepts, what it returns, and in what order.
What the slave port exposes
The port presents an eight-bit data register with control lines for read, write and chip select, and the device’s program sees each transaction as a byte arriving or leaving. From outside, that means every value the host sends is visible, and every value the device returns is visible, along with the timing. What is not visible is the code that produced the response, or anything the device does when the host is not talking to it.
What the host already knows
The other processor in the product is usually documented, and its side of the protocol may exist as a data sheet with register names. That turns a capture into a decode: the host writes a command byte, then a parameter, then reads a status byte, and each of those fields has a name on the host side. Starting from the host’s documentation and confirming it with the bus is far faster than reverse engineering the protocol from timing alone, and it produces a specification that can be handed to whoever writes the replacement.
Timing that identifies the build
Strobe timing carries information that the values do not. The number of instruction cycles between a request and a response reflects the code path taken, so two units with different firmware revisions show different latencies for the same command. On a product with several field updates, that difference is how a capture can be attributed to a specific build, which matters when the customer needs to know which version the recovered behaviour corresponds to.
Observation is not extraction
| Question | Array read answers | Bus capture answers |
|---|---|---|
| What exact instructions run | Yes | No |
| What the device accepts | Partially | Yes |
| What it returns and when | Partially | Yes |
| How it behaves when idle | No | Only if the bus is quiet |
The first row is the one to be honest about. A capture is a specification of behaviour, not an image of code, and a second unit built to a specification will match on the paths that were exercised and diverge everywhere else. That is the same gap that separates a bit copy from a behavioural rebuild in copying a microcontroller, and it is wider than it looks from the outside.
What a capture does prove
It proves the protocol, the timing and the values, which is often enough to write a replacement that satisfies the host. It also proves which byte positions are meaningful, which is useful when the EEPROM image has to be decoded and the field layout is unknown. And it produces a test vector set: replay the capture against the replacement and the divergence is visible immediately, which is the only kind of acceptance test that means anything.
When this is the right tool
When the device still runs, when the product has a host bus, and when the customer needs a compatible replacement rather than the original source. It is also the right tool when the array is protected and the die-level route is refused on cost, because it produces something usable for a fraction of the price of an extraction, as long as the scope is stated honestly at the start.
The limit worth saying out loud
A capture cannot recover the firmware, and no amount of analysis turns it into one. If the customer’s real need is to modify the code, or to manufacture identical units, the bus is the wrong instrument and the answer is the array. The distinction between the two is what separates a working replacement from a copy, and it is the same distinction that makes PIC16F76 a code-reading problem rather than a bus problem. Where the data rather than the program is the target, PIC16F74 data sets out the two locks involved.