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.

Comments

  1. Jay Grizzard says:

    Of course, the downside of hacking with the 8051 is… You have to use the 8051. Of all the microcontrollers I’ve used, it is by far the most painful. The memory model is insane!

  2. Karl says:

    never again 8051! sorry, but looking at the asm code table..what a mess. I’ve to work with that lousy chips three years at high school. also the chip design is poor and is not well designed.

    at university, we’ve worked with a c166, nice asm, well-structured chip, no hacks any more

  3. ss says:

    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 🙂

  4. MaJ says:

    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.

  5. Aikon says:

    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.

  6. DanJ says:

    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.

  7. ino says:

    It was a nice micro at the time but it’s awfully inefficient for today’s standards.

  8. Jac Goudsmit says:

    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.

  9. SpudGasket says:

    ATMEL still makes a series of 8051 chips in 40 pin that are compatible with the industry-standard MCS-51 instruction set and pinouts such as the AT89S8253 24MHz 12kb Flash.

    • marak says:

      There is also ATMEGA8515 – drop in compatible with 8051, but AVR instruction set, in case you have some crufty old 8051 device you want to make AVR for some reason or other…

  10. RandomUserName says:

    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!

  11. Techmonkey says:

    I’ve got my old 8051 dev board. Maybe I should fire it up and break out the old assembly programs I still have on a floppy.

  12. nes says:

    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.

  13. Thopter says:

    “If you’ve got an 8051 project lying around, send it in on the tip line and we’ll probably throw it up.”

    Probably not the best choice of words, there. *urp*

  14. StripeyType says:

    This is actually a ripe field for hacking – most smartcards of a certain generation are indeed 8051 processors. This is worth knowing if you’re into that sort of thing.

  15. MIchael says:

    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.

  16. Matthew Wiebe says:

    @Brian Benchoff —

    I was the Matt that sent this tip in. I just wanted to clarify that I said that I /couldn’t find *many*/.

    Sellin’ me short! *wink. (I don’t like being sold short, I’m only 5’3″!! lol.

  17. Xcoder says:

    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

  18. canid says:

    I wanted to remind that the Chipcon (TI) CCxxxx MCUs are built on the 8051 as well. there have been a couple projects here using these chips, no?

  19. NewCommentor1283 says:

    i knew about 8051 and its problems way before i heard of avr, PIC was new and expensive at the time.

    just about as soon as i obtained a few of em i got hold of an AVR, but i still miss the days of swaping rom for ram

    … and hacking in a switch and a battery and a gpio connected to a flipflop to toggle the whole thing: ROM/AUTO/RAM

    could have a second rom chip (firmware) that writes/burns (from rs232) to yet another chip socket’s chip 🙂
    … so youd have built-in rom/ram burner selected with a switch and a reboot

    • NewCommentor1283 says:

      PS: i prefer 8051 to the modified 6502 inside the nintendo ANYday!

      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.

  20. wue says:

    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.

  21. kmcinnes says:

    128 bytes of RAM sounds pretty limiting.

    • Fred says:

      Hey guy, Don´t forget from the stack and registers (r0…r7) mapped on internal RAM… !:-)
      So, I used consider about 110 bytes of usable and freely RAM.

  22. Mike says:

    It was good enough to run thousands of cars for millions of miles: http://wikitest.pgmfi.org/twiki/bin/view.pl

  23. torwag says:

    I’m the only one who feels kind of old after reading this article…
    damn I was used to use these chips…
    30 years..
    20 years..

    god, I am so old!!!

  24. Alan says:

    I saw something with an 8051 in it only this week… the Cypress USB Controller. (CY7C68013A)

    http://www.cypress.com/?id=193

Speak Your Mind

*

Related Hacks in classic hacks

  • You’ll throw your back out playing this analog TV synth
  • Mapping the motor cortex
  • Your guide to building a homebrew 6502 computer
  • Hackaday Links May 9th 2012
  • Tilt sensor toy is simple and mesmerizing