Going old school with an 8051

A while back, [Matt] bought a few 8051 MCUs and tucked them away for a future project. He just found these fabulous little chips in a component drawer and decided it was time to figure these guys out. Eventually, [Matt] stumbled across this awesome resource for 8051 programming.

The 8051 featured a still reasonably respectable 4k of ROM and 128 bytes of RAM – not too dissimilar from an ATtiny of today until you realize this 30-year-old chip has 32 IO pins. This microcontroller, along with its bigger brother the 8052, served as the de facto microcontroller standard for 20 years. You’ve no doubt taken a ride in a car that used one, and was even put to use doing low-level grunt work in early PCs.

[Matt] says he couldn’t find a Hackaday project featuring this 30-year-old microcontroller (not true, here’s one of those tilty mazes and an electronic toll booth), but even we have to admit we don’t feature much outside of the usual AVRs and PICs. Even though it’s 32 years old, the 8051 family still has some tricks up its sleeve like playing audio CDs. If you’ve got an 8051 project lying around, send it in on the tip line and we’ll probably throw it up.

Isn’t it a cool processor? I worked with a spin off (80535) and it was amazing. Even the next gen the 8052 was awesome. I love that processor. Today I work with PICs (16f688) much smaller much faster and now they have the UART part in HW. That’s what was missing on the 80×1 family. Something I always was impressed about was a small telephone switch I have (from Siemens) that can handle up to 6 subscribers and was entirely done with one IC only: the 8048 (its predecessor). Very cool! Long live the 805x family :)

I’ve had some experience with these microcontrollers. There are many compilers that support 8051, mostly commercial, but I’ve heard of GCC support as well. Also, with their prevalence in the auto industry, it is quite common to find them with an integrated CAN bus. If memory serves, IBM also used them in their first keyboards to translate keypresses into scancodes. You certainly won’t find the same sort of developer-friendliness that surrounds the Arduino and other newer uCs, but that doesn’t mean you can’t put 8051’s to good use and have fun doing it.

We use these pretty ubiquitously in our distributed spacecraft hardware for unit-level data processing and control. We use several of the SiLabs packages, in particular the F58x family — 8051 core, 128 KiB banked flash, 8 KiB on-chip XRAM, extra timers, a 12-bit ADC, two hardware UARTs, and a CAN controller. Pretty awesome little micros.

As others have noted, the 8051 continues to find life as a core used in a variety of SOCs. Usually with greatly expanded data and code space and additional peripherals such as hardware UARTs. I’ve used it in Nordic’s digital radio chips. It’s ok. Easy to program in either C or assembly.

Ah yes, the 80xx family: 8032, 8048, 8051 and 8052 if I’m not mistaken. I also remember reading a lot about the 8052-AH BASIC which had a Basic interpreter in ROM; basically the first one-chip computer that was programmable in BASIC, which was pretty impressive in the 1980s.

They’re still very much in use; I don’t know any statistics but I bet there are even more 8051s in the world than 6502s, although Philips/NXP (probably one of the biggest licensees) declared them EOL.

The good news is that Microchip has announced that they make NXP compatible versions of the 8051: http://bit.ly/z0qO4f.

Wow, there are other microcontrollers than AVR’s?! I thought arduino was the original microcontroller!?!? (note: SARCASM)
I am afraid to ask the age of the cheifs at hackaday for fear of feeling way out to pasture!

I recall being taught in the late 90s that 8051s were the most numerous CPUs in the world with billions produced per year. That figure is probably still accurate today as they are embedded in all sorts of ASICs. The CPU core in the Im-me which got featured a lot on HaD is 8051 compatible for example.

I reckon in terms of production though it has probably been surpassed by ARM7 TDMI.

These chips show up in more places than you think. The newest Maxim parts (formerly Dallas) are a full 12x faster than the original and support a higher clock speed too.
You can get free samples from Maxim with 64K flash and 2 uarts.
SDCC is the compiler of choice. Haven’t used it in a while but the code generation was quite good.
I agree with everyone the assembly isn’t good but if you’re writing in C you won’t notice.

Ha, imagine that, here in Uni where I’m studying, we have to use 8051 in the first year to learn assymbler and c programming. It’s not that bad, it is more technical than programming avr or pic. More things to consider

have you ever studied the nintendo’s assembler programming methods and electrical connections??? please noone comment on it, noone needs to learn how NOT to design a system ;) hehe

i know the 8051/8052/8031/8032 are sort of arcane, but nothing beats nintendo’s super weird chip, maybe im biased but i hate that chip, the whole system sucks in my opingion.

the only thing good about it (original nintendo) is the games for it, and the powersupply. oddly enough, was sufficently designed, which is rare.

in case you didnt get the powersupply thing,,,;
it needs about 500-750ma but the transformer is 1A. the rectifying diodes are 2A. the regulator is 1A, the heatsink is fortified by attachment to the metal chassis, and the filter capacitor is enough by my standards (which is rare), and filter capacitors usually are as small as friggin possible.

I was once forced to use 8051 on a poorly designed dev board at uni, that was a nightmare. The ’51 itself is okay, but rather slow per MHz and the IOs are bi-directional (unlike AVRs, you can’t specify pin direction, it is always sort-of open collector serving as input when internally pulled high). Good thing is, they are very easy to interface to an 8-bit I/O bus, like a subset of 8-bit ISA.

It is true that numerous SoCs that use ’51 exist, e.g. in the MD-80 mini-camera and the cheapest MP3 players from a few years back.

I am uncertain about the claim in the post that 8051s were used in PC hardware – their predecessor, the 8048, has been used as a keyboard controller and replaced the 8255 PPI in PC/AT computers.