Posts Tagged ‘зломити ic bin’
Copy Chip PIC16F74A Binary: A 14-Bit Word and One Config Word
The PIC16F74A holds 4096 program words and each word is fourteen bits wide. That one sentence explains most of what is strange about copying this family: the array is not byte-addressed, the file that represents it is, and the lock that stops you reading it is a single bit in a register that is itself part of the image.

Fourteen bits into eight
Program memory is word-addressed. A call takes one word, a literal load takes one word, and the instruction field is fourteen bits including the opcode. The programmer’s view is different: file formats are byte-oriented, so each word occupies two bytes with the value right-justified and the two high bits zero.
| Quantity | Value | Consequence |
|---|---|---|
| Word width | 14 bits | Two bytes per word in a file |
| Program words | 4096 | 8 KB of file space |
| Program counter | 12 bits | Reaches 0x0000 to 0x0FFF |
| Configuration word | 0x2007 | Outside the program range |
The last row is where mistakes happen. A twelve-bit program counter cannot reach the configuration word, so the programmer addresses it with a separate command. A read that stops at the end of the program range produces a complete-looking image with the lock state missing.
What code protect does to a read
The protection is a bit in the configuration word. When it is set, reading a program word returns zero instead of the stored value.
The device does not refuse the read and it does not return noise. It returns a legal word, which disassembles as a no-operation, so a dump of a protected part is a listing of NOPs while the file length and checksum arithmetic both look reasonable.
| Read result | Meaning |
|---|---|
| Real instructions | Protection off, or device unprotected |
| Zeros across the range | Code protect set |
| Zeros followed by valid code | Protection set, partial image |
| All ones | Erased device |
The second and fourth rows look similar in a hex viewer and mean opposite things: one is a device with firmware you cannot see, the other a device with no firmware at all.
One bit, one chip erase
Clearing that bit requires an erase, and the erase is chip-wide. There is no per-block unlock, so the request that arrives most often — remove the protection, keep the contents — is impossible at the silicon level rather than at the tooling level.
The arithmetic is therefore short. Either the device is erased and reprogrammed from another source, or the array is read by a route that never consults the protect bit.
What a copy has to carry
A complete image of this family has four parts, and a copy that omits the last two boots on the bench and fails weeks later.
| Part | Where | Survives a naive copy |
|---|---|---|
| Program words | 0x0000 to 0x0FFF | Yes |
| Configuration word | 0x2007 | Only if read explicitly |
| User ID locations | 0x2000 to 0x2003 | Only if read explicitly |
| Oscillator calibration | Part dependent | Some family members only |
The configuration word alone decides the oscillator mode, the watchdog, low-voltage programming and the protection. Copy a device with the watchdog enabled into a part whose configuration says otherwise and the second unit resets every few milliseconds — a fault that reads like a firmware bug.
Verifying without a reference device
Three checks settle a copy without a second unit.
The first is the checksum the programmer computes over the program range, compared with the value in the original programming log. The second is a blank check after erase and before programming, which catches the failed erase that would otherwise leave a device carrying code from two different images. The third is a read-back at the configuration address, and it is the only one of the three that catches a copy which got every instruction right and the lock state wrong.
The route when the array is protected
Two routes remain, and both are described elsewhere at the level of principle: the electrical one, where a port or a fault injection makes the device return the array, and the physical one, where the die is opened and imaged.
For this family the electrical route is usually cheaper: the array is small, the read sequence short, and the package easy to work with. The comparison of routes is in crack IC flash, and the port survey that decides whether an electrical route exists at all is in read MCU code.
What we deliver
A heximal file with the configuration word and the user ID locations included, plus the checksum and a note on which of the four parts came from a read and which were inferred.
The note is not a formality. A copy is a claim about a class of devices, and those four parts are exactly where the class and the individual diverge. The general treatment is in copy IC code, and the object-level framing — bits, code, behaviour, unit — is in copy microcontroller.