Build a complete 80C31 computer on breadboards

The Philips P80C31SFPN is an 8051-family CPU without built-in program ROM. To run it, you need a clock, a reset circuit, an external program ROM, and a latch to hold the low address byte while port 0 carries data. This build adds 8 KB of external RAM and two LEDs to show whether a memory test passes. iMania stocks the active components listed below; you will also need passive components, hookup wire, a regulated 5 V supply, and a ROM programmer. The connections have been checked against the datasheets, but the assembled circuit has not yet been tested on a breadboard.

Block diagram of the 80C31, P0 bus, address latch, W27C512 program EPROM and RAM
Block diagram of the P0 bus, address latch and two memory chips. Scroll sideways on a narrow screen.

Parts

  • 1 × Philips P80C31SFPN, DIP-40 — 80C31 CPU — ROM-less processor.
  • 1 × SN74ALS873BNT, DIP-24 — 8-bit latch — Holds address A0–A7.
  • 1 × Winbond W27C512, DIP-28 — 64 KB electrically erasable EPROM — Reusable program memory. The part sold here is used.
  • 1 × HM6264LP-15, DIP-28 — 8 KB SRAM — External data memory.
  • 1 × 11.0592 MHz HC49/SMT crystal — NKG crystal — CPU clock; solder two short leads for breadboard use.
  • 2 × solderless 630-point breadboards — MCBB630 — Room for the shared bus wiring.
  • 2 × through-hole white LEDs — Vishay TLWW76 — Pass/fail indicators.

You will also need a regulated 5 V supply, hookup wire, a 100 nF ceramic capacitor close to each IC's supply pins, one 10 µF capacitor across the supply rails, two 22 pF capacitors for the crystal, one 10 µF reset capacitor, one 10 kΩ resistor, two 1 kΩ LED resistors, and, optionally, a normally open reset button. A DIP-40 socket is optional. Solder two short wires to the SMT crystal; its surface-mount pads cannot plug directly into a breadboard. Program the ROM before installing it. The test will not run with a blank or incorrectly programmed W27C512.

Why 11.0592 MHz? On a classic 8051, each machine cycle takes 12 crystal periods. At 11.0592 MHz, that gives Timer 1 a convenient 921,600 ticks per second. This matters if you later use the serial port: in 8-bit auto-reload mode, Timer 1 produces exactly 9,600 baud with three ticks per overflow (TH1 = FDh, SMOD = 0). Other common baud rates are also available with whole-number reload values. The LED and RAM test does not use the serial port, so it does not need this exact frequency. A 16 MHz crystal is within the P80C31SFPN's rating and would run the CPU about 45% faster. The trade-off is that this simple Timer 1 setup cannot produce exactly 9,600 baud: the nearest settings give 10,416.7 or 8,333.3 baud with SMOD = 0. Faster clocking also reduces the timing margin for external ROM and RAM, making long breadboard wires more troublesome. You can use other baud-rate settings or clock frequencies; 16 MHz is not inherently unsuitable for an 8051.

What happens on one memory cycle

The CPU first puts A0–A7 on port 0 and A8–A15 on port 2. While ALE is high, the SN74ALS873BNT follows its inputs; when ALE falls, the latch holds A0–A7. Port 0 then carries data on D0–D7. When PSEN goes low, the ROM supplies an instruction. RD goes low for a MOVX read from RAM; WR goes low for a write. The ROM and RAM have separate address spaces even though they share the same data wires. Do not tie their output-enable pins together: both chips could then try to drive the bus at once.

Wiring, in order

  1. Power and reset. With power disconnected, put the four ICs across the breadboard center gaps, notch at the same end. Join all ground rails and all +5 V rails, checking split rails for continuity. CPU pin 40, latch pin 24, ROM pin 28, and RAM pin 28 go to +5 V. CPU pin 20, latch pin 12, ROM pin 14, and RAM pin 14 go to ground. Put 100 nF close to each IC, plus 10 µF across the rails. Tie CPU EA pin 31 firmly to ground, because this ROM-less device must fetch externally. CPU RST pin 9 gets 10 kΩ to ground and 10 µF to +5 V (electrolytic positive lead at +5 V); the optional button connects RST to +5 V. Reset is active high. Hold it high long enough for the oscillator to start.
  2. Clock. Connect the 11.0592 MHz crystal between CPU XTAL1 pin 19 and XTAL2 pin 18. Put one 22 pF capacitor from each crystal pin to ground. Keep this loop very short and away from the long data bus. This SMT part needs soldered leads; if its mechanical mounting is unreliable, do not power the board until it is secure. This CPU variant is rated to 16 MHz, so 11.0592 MHz is inside its speed range.
  3. Multiplexed data/address bus. For each bit n=0…7, connect CPU P0.n to latch Dn, ROM Qn, and RAM I/On. CPU P0.0…P0.7 are pins 39, 38, 37, 36, 35, 34, 33, 32. ROM Q0…Q7 and RAM I/O0…I/O7 are pins 11, 12, 13, 15, 16, 17, 18, 19. Latch D0…D7 are pins 3, 4, 5, 6, 7, 8, 9, 10. During external-memory cycles port 0 has internal pull-ups; no separate P0 resistor pack is required for this bus.
  4. Low address latch. Latch Q0…Q7 are pins 22, 21, 20, 19, 18, 17, 16, 15. Connect each to matching ROM and RAM A0…A7. On both memories, A0…A7 are pins 10, 9, 8, 7, 6, 5, 4, 3. Connect CPU ALE pin 30 to latch LE pins 23 and 14. Hold latch active-low OE pins 2 and 11 at ground and active-low CLR pins 1 and 13 at +5 V. Both four-bit halves must be enabled.
  5. High address. CPU P2.0…P2.7, pins 21…28, go to ROM A8…A15. ROM A8…A15 pins are 25, 24, 21, 23, 2, 26, 27, 1 respectively. RAM only has A8…A12: connect P2.0…P2.4 to RAM pins 25, 24, 21, 23, 2. P2.5…P2.7 do not go to RAM.
  6. Control. ROM CE pin 20 goes to ground; ROM OE/VPP pin 22 goes only to CPU PSEN pin 29. RAM active-low CS1 pin 20 goes to ground; RAM active-high CS2 pin 26 goes to +5 V. RAM OE pin 22 goes only to CPU RD/P3.7 pin 17; RAM WE pin 27 goes only to CPU WR/P3.6 pin 16. With no address decoder, the 8 KB RAM appears repeatedly throughout the 64 KB external-data space. That is intentional for this minimal build; software should use 0000h–1FFFh for RAM.
  7. Indicators. For each LED connect +5 V → 1 kΩ → LED anode, then LED cathode to CPU P1.0 pin 1 or P1.1 pin 2. A low output lights an LED. Do not connect LEDs without series resistors.
Top-view pin connections for the 80C31 and SN74ALS873BNT
Top-view DIP pins; check each package notch. Scroll sideways on a narrow screen.

Program and first boot

The supplied assembly test program starts at code address 0000h. The accompanying 64 KB ROM binary contains the ready-to-program image. The program writes 5Ah to external RAM address 0000h and reads it back. If it matches, P1.0 blinks; if it fails, P1.1 stays lit. The used W27C512 may already contain firmware; save its contents first if you want to keep them. Use a programmer that explicitly supports W27C512 erase and program operations, such as the Relatively Universal ROM Programmer (RURP). Erase the chip, check it is blank, write the full 64 KB binary, and read it back for byte-for-byte verification. You can erase and reuse this EPROM. The programmer supplies the required erase/program voltages; the breadboard circuit uses only 5 V. See the W27C512 programming guide for the RURP workflow. Disconnect power before inserting or removing any IC.

You can assemble the source with the 8051 tools supplied by SDCC:

sh sdas8051 -los 80c31-test.asm sdld -ni 80c31-test 80c31-test.rel

The result is an Intel HEX file (80c31-test.ihx) containing only the addresses used by the program. Unused addresses in the supplied 64 KB binary are filled with FFh. Write this binary to the W27C512; its contents were checked byte for byte against the SDCC assembler output.

Power the breadboards from a current-limited, regulated 5 V supply. Check for 5 V and ground at each chip before inserting the ROM. On boot, the LED on P1.0 should blink while the one on P1.1 stays off. If neither LED responds, check that reset returns low, the oscillator runs, EA is low, ALE pulses, ROM OE follows PSEN, and the first three program bytes are at address 0000h. If P1.1 lights, check the RAM's two chip-select inputs, RD/WR, and the shared address/data wiring. Avoid probing the crystal with a high-capacitance oscilloscope probe; it can stop the oscillator. This design has not been physically bench-tested; long breadboard wires can make an otherwise correct 11 MHz circuit unreliable.

Source documents

The crystal, machine-cycle and Timer 1 baud rates calculations follow Intel’s MCS-51 User’s Manual.

Pin numbers and timing were checked against the Philips 80C31/80C32 datasheet, TI SN74ALS873B datasheet, Winbond W27C512 datasheet, and the original Hitachi HM6264LP-15 datasheet (1985 Hitachi IC Memories Data Book, page 158). Check the markings and notches on your actual parts before applying power.