PIC16C65B: The Parallel Slave Port and Why Its Firmware May Not Be a Whole Application
The PIC16C65B is a 40-pin mid-range part with 4096 × 14 words of EPROM program memory, 192 bytes of RAM, 33 I/O pins, two CCP modules, a USART, a synchronous serial port and a Parallel Slave Port. It is the largest of the PIC16C6X family and, in its time, the one used when a design needed a lot of pins and a hardware interface to another processor.
That last feature is the reason this part deserves more than a memory table. The Parallel Slave Port is an 8-bit bidirectional bus that makes the microcontroller look like a peripheral to a host CPU — and a device used that way holds firmware that is not an application.
What the PIC16C65B actually contains
| Item | PIC16C65B |
|---|---|
| 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 | 33 (PORTA 6, B 8, C 8, D 8, E 3) |
| Parallel Slave Port | 8-bit, on PORTD with control strobes on PORTE |
| PWM | CCP1 and CCP2 |
| Serial | USART, synchronous serial (SPI/I²C) |
| Timers | Timer0, Timer1 (16-bit), Timer2 |
| Packages | 40-pin PDIP, 44-pin TQFP, 44-pin MQFP |
| Programming | high voltage on MCLR, EPROM |
There is no analog-to-digital converter and no data EEPROM on this family. Every constant the firmware uses is in program memory, and every byte of state it keeps between resets has to be in RAM or in an external device.
What the Parallel Slave Port does
The PSP occupies PORTD as a data bus and three pins of PORTE as control lines: CS (chip select), RD (read strobe) and WR (write strobe). With PSPMODE set in TRISE, an external host can:
- Write a byte into the port by asserting
CSandWR, which places the byte in the PSP data register and sets the input-buffer-full flag. - Read a byte by asserting
CSandRD, which returns whatever the firmware last wrote to the output register and sets the output-buffer-empty flag.
The firmware’s side of this is an interrupt-driven or polled handler that empties the input register and refills the output register. In practice a device using the PSP is a slave: it receives commands from a host processor, acts on them, and returns results. The host might be a DSP, a larger microcontroller, a PC ISA-bus card, or a gate array.
Three consequences follow for anyone reconstructing such a device.
The firmware may have no main loop. A slave routine can be almost entirely interrupt handlers, with the main loop doing nothing but waiting. Reading such a listing with the expectation of finding an application structure produces confusion; the structure is the protocol, and the protocol is defined by the host.
The protocol lives on both sides. A recovered image shows which commands the slave recognises and what it returns, but not what the host does with those responses. The recovered routines are a complete implementation of one end of a conversation.
The device may be unrecoverable in isolation. A board with a PIC16C65B in PSP mode usually has the host on the same board, and that host also has firmware. Testing a recovered image requires either the original host or a substitute that speaks the same protocol.
EPROM, and the meaning of the B suffix
The C in PIC16C65B marks EPROM. In the plastic package the part is one-time programmable; the JW-suffix ceramic package has a quartz window and can be erased under ultraviolet light in about twenty minutes.
The B revision itself is a silicon update — the earlier PIC16C65 lacked the synchronous serial port and had different errata — and it matters for recovery because the two revisions are not code-compatible in the corners. Firmware written for a 65B that relies on the SSP will not run on a 65, and firmware written for a 65 may exercise a sequence that the B revision changed.
On the protection side, the EPROM package removes the option that Flash parts have. There is no programming command that clears the CP bit, so on a plastic OTP part the protection state is permanent. On a windowed part, UV erasure clears the entire die — program array and configuration word together — so there is still no way to clear protection and keep the code.
The configuration word
The configuration word sits at 2007h and occupies the low bits of the word, with the remainder reading as 1. Its fields are:
- CP — program memory protection, active low.
- WDTE — watchdog enable, active low.
- FOSC1:FOSC0 — oscillator selection: RC, XT, HS or LP.
- BOREN — brown-out reset enable.
- PWRTEN — power-up timer enable, active low.
Two absences are worth naming. There is no LVP bit, because the entire family predates low-voltage programming; high voltage on MCLR is the only entry point. And there is no CPD bit, because there is no data EEPROM for it to protect.
The oscillator field is where the board and the record meet. All four settings require external components — a resistor and capacitor, a crystal, or an external clock — so the actual frequency is determined by what is soldered next to the chip. Recovering the configuration word tells you which mode was selected; it does not tell you the frequency, and on a part whose only timing reference is external, that is a fact the board has to supply.
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, no separate calibration array
Because the part has no data EEPROM, the image is complete as a program. What it is not complete as is a system: the 192 bytes of RAM are volatile, the constants are all in the array, and the interface through the Parallel Slave Port is defined by a second processor that is not in the image.
Related notes
The 28-pin PIC16C63A is the same core without the Parallel Slave Port and with fewer pins, and the note on recovering PIC16C63A covers the interrupt structure those parts share. The smaller PIC16C62B is the 28-pin entry point to the family, and the PIC16C77 is the 40-pin part that replaced this one with a 10-bit ADC.
FAQ
What is the Parallel Slave Port used for? It makes the microcontroller appear as an 8-bit peripheral on another processor’s bus, so a host can send commands and read results through PORTD with chip-select and strobe lines on PORTE.
Can CP be cleared on a PIC16C65B? Not electrically. It is EPROM; on a windowed package, UV erasure clears the whole die including the configuration word.
Does the part have data EEPROM? No. Constants live in program memory, and there is no separate array to recover.
What is the difference between the 65 and the 65B? The B revision adds the synchronous serial port and carries silicon fixes. Firmware is not interchangeable between them in the corners.
Why would recovered firmware not run standalone? If the device was used as a PSP slave, its firmware implements one end of a protocol with a host processor that is not part of the recovered image.
Conclusion
The PIC16C65B is a reminder that a complete image and a complete system are different things. The program array on this part is exactly recoverable in scope — 4K words, no hidden EEPROM, constants in plain sight. What is not in the array is the other half of the conversation the Parallel Slave Port was conducting, and that half belongs to a processor whose firmware is a separate problem.