8051 Microcontroller projects



A collection of projects using the 8051 microcontroller. I started with an `original'-esque Harris 80C31 (CMOS external ROM version of the 8051) but have started using the Dallas (Maxim) DS89c420. This is fab because:
  • A machine cycle is 1 clock period, instead of 12 clocks in the old 8051.
  • It can be clocked up to about 40MHz
  • It has some extra instructions to ease the pain of the 8051 programmer
  • They contain 1 extra timer and UART (3 timers, 2 UARTs)
  • It contains 16K FLASH and 1K SRAM, so can run completely stand-alone!
  • most importantly, the internal FLASH can be easily loaded via the serial port.


PAULMON hacks

I've been using the brilliant PAULMON2 monitor program in both the 8051 board (below) and with the DS89c420 chips. It's been extremely useful in developing code, I highly recommend it. Plus it's got a cool VT100 memory editor ;)

I have made some minor changes to PAULMON2 for the DS89c420 chips so that the MCU can be used stand-alone with no external chips whatsoever. This involves setting up the clock rates/baud rates in the Dallas chip and mapping in the internal SRAM for use as code memory.

My rudimentary changes are available as a patch for PAULMON v2.1. Apply them thus:

  • unzip pm21_src.zip
  • patch -p0 < ds89c420.diff

The 1K internal SRAM is mapped to be program RAM at 0x400-0x7ff. The image of PAULMON2 starts at 0x800 (with exception vectors also, at 0). One can download program code to run from the SRAM but beware that some versions of the DS89C420 have a bug that prevents this memory from being accessed as data memory (i.e. MOVX won't work, so use MOVC instead).

8051 microcontroller board

A horribly hand-wired chunk of veroboard containing an 8051 clocked at 3.6864MHz, 32K EPROM, a 16x2 LCD and space for either a 2K non-volatile SRAM or a standard 32K SRAM (links determine which is used). A 5V regulator and crystal oscillator make the board stand-alone.

An expansion connector brings out the buses D[7:0] and A[6:0] plus control signals; an address space of 128 bytes is 'stolen' from the very top of the RAM (0xff80 to 0xffff) for any external devices attached to this connector.

A Lattice GAL (Gate Array Logic) provides address decoding for the board, and enable signals for the LCD module. The ROM is mapped from 0x0000 to 0x7f7f, the RAM from 0x8000 to 0xff7f, the LCD is at 0x7f80 and the external bus is from 0xff80 to 0xffff. The GAL uses around 110mA (!), easily more than the rest of the board put together..... The first GAL to hand was a 7.5ns (fast) one, which burns more. Ooops. :)

BTTF Clock

This board is currently used in the BackToTheFuture Clock project, driving six 7-segment LED displays.
(to be documented)

8051 IP stack

The ARM IP stack (see SIND) is based upon a similarly-working version for the 8051 microcontroller board. This was coupled with an ISA interface for the board's expansion connector that interfaces a 10baseT NE2000 ethernet card to the software. Due to unreliable hardware (me? The Thirteenth Earl of Whilblum? Drinking and soldering, without due care and attention?) this remains unfinished, although a (less impressive) SLIP driver works fine across the board's serial console.

Above the hardware interface to the network, the IP stack operates with a simple ICMP ping module. The board pings reliably across the 19.2kbit/s SLIP link to a PC.

SLIP, IP, and ICMP ping come to about 1.2Kbytes code.


GBA Multiboot cable

More details can be found on my GBA projects page.

Basically this is an intelligent cable that uses a DS89c420 to convert RS232 (8N1 at 115.2kbit/s) to the weird 16-bit (at 115.2kbit/s) format the Gameboy Advance uses to Multiboot code. Combined with software on a workstation (running Linux, *BSD etc.), code can be downloaded into the GBA's RAM without requiring a cartridge.


1st May 2002, © Matt Evans