You're currently on: Catalog » Guides » 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.
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.
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.
MOVX
n=0…7
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.
80c31-test.ihx
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.
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.
We use cookies to provide you with the best possible experience. They also allow us to analyze user behavior in order to constantly improve the website for you.