Intel MCS-51 processor family
Many years ago (1987) I was programming the 8052 professionally and I had all the assemblers and a PL/M compiler and an in circuit emulator at my development seat. At a certain point I knew the processor in and out and every trick it had. I really loved this processor, I started with an 8031 and external eprom but soon we switched to Atmel series of 8052 chips with internal flash memory. All of our low end modems had the 8052 as MCU in them. I even made a Basic version once but at the time modems needed much more processing power, we switched to Intel 80188 processors. But even nowadays I still used the STC and Atmel 8752 in a lot of electronic projects. I even build an 8052 programming IDE for Windows 10 / 11. I also collect old processors so I have a love of MCS-51 types of chips in my collection, not only from Intel but also from a lot of other manufacturers. On this page I give an overview of the MCS-51 family MCU’s and the different types.
Regards, Hein Pragt.
I also have a Facebook Group on Retro Computing and Electronics, feel frtee to join!
About the MCS-51 processor family
The MCS-51 family succeeds the MCS-48 family, if you take a closer look at both you will see the resemblance. The architect of the Intel MCS-51 instruction set was John H. Wharton (21 Sept 1954 – 14 Nov 2018) who was an American engineer specializing in microprocessors and he did an amazing job. Intel's original versions were very popular in the 1980s and early 1990s, and compatible derivatives remain popular up to today. It is an example of a CISC computer, but also has some of the features of RISC architectures, such as a large register set and separate memory spaces for program instructions and data. (Harvard architecture). Intel's first MCS-51 family was developed using NMOS technology just like its predecessor Intel MCS-48, but later versions with the letter C in their name are in CMOS technology. This made them also more suitable for battery-powered devices. Nowadays Intel no longer manufactures the MCS-51 family processors but a lot of derivatives made by numerous vendors remain popular today and are still produced and even enhanced. The new MCS-51 based microcontrollers typically include extra features like an extra UART, extra timers, AD converters, Extra ports and internal eeprom memory to store the programming code. Also the original 8051 core ran at 12 clock cycles per machine cycle, with most instructions executing in one or two machine cycles. Enhanced 8051 cores are now commonly used which run at six, four, two, or even one clock per machine cycle and have clock frequencies of up to 100 MHz.
*) The AT89C52 / 51 and the STC89C52 / 51 are the most common used nowedays and common available.
The 8051 internals
*) It may look that the processor is very low on registers, but the whole 32 bytes of internal RAM is devided into 4 x 8 bytes register banks making a total of minimal 8 registers (with two of them being indirect address pointers) up to 32 intenal registers in 8 bytes chenks.
The 8051 pins
Description of the Pins:
Pin 1 to Pin 8 (Port 1)
Pin 1 to Pin 8 are assigned to Port 1 for I/O operations, they can be configured as input or output pins, if logic zero (0) is applied to the I/O port it will act as an output pin and if logic one (1) is applied the pin will act as an input pin.
Pin 9 (RST)
The reset pin is an active-high input pin. If the RST pin is high for a minimum of 2 machine cycles, the microcontroller will reset, it is often referred as power-on-reset. In normal circuits this is done with simple capacitor and resistor and if you want a reset button, you can add this parallel to the capacitor.
Pin 10 to Pin 17 (Port 3)
These pins are I/O port 3 pins, these pins are similar to port 1 and can be used as universal input or output pins. These pins
also have some additional functions which are as follows:
Pin 18 and Pin 19 (XTAL2 And XTAL1)
These pins are connected to an external oscillator which is generally a quartz crystal oscillator with two small capacitors.
Pin 20 (GND)
This pin is connected to the ground (0V power supply).
Pin 21 to Pin 28 (Port 2)
Pin 21 to pin 28 are port 2 pins, these pins can be used as general I/O pins. But when you use external memory these pins provide the higher-order address byte A8..A15.
Pin 29 (PSEN)
PSEN stands for Program Store Enable. It is and active-low output pin to read external code memory, this pin is connected to the OE pin of the ROM.
Pin 30 (ALE)
ALE stands for Address Latch Enable, it is an active-high output pin, this pin is used to latch the low address (A0..A7) of port 0 to an external latch and when not active port 0 is the data in and output.
Pin 31 (EA)
EA stands for External Access input. It is used to enable / disable external memory interfacing. If EA is connected to Vcc the chip will use the internal ROM, when this line is connected to GND the chip will use the external ROM.
Pin 32 to Pin 39 (Port 0)
Pin 32 to pin 39 are port 0 pins that can be used as normal bidirectional I/O pins, however they don’t have any internal pull-ups. These pins also used as bidirectional Data bus and provide the low part of the external; address (D0..D7) when ALE is active. When used as data / address lines they can no longer be used as I/O pins.
Pin 40 (VCC)
This pin provides power supply voltage to the chip, most of the time 5 volt, but some variants use 3.3 volt.
Minimal hardware design schematics
This is the typical design you will find on the (Chinese) minimal hardware boards (they often add a power supply as well) and it uses the internal ROM / EPROM code and the internal ram only. I have written lots of hardware using this design, the internal ram is verry useful because of the bit addressable area that can be used as Booleans (flags) in a program, and with the 4 register banks it is easy to write simple interrupt handlers, just switch the bank on an interrupt and switch it back before you leave the interrupt routine. When using a 8752 you have the extra high 128 bytes of internal ram and the code can be easily burned over and over again in the Flash eprom on chip. This configuration has a LOT of available I/O lines, a serial input output, timers and interrupt so its is very nice to use in embedded systems. For instance you could build a complete full keyboard interface, just using this simple design. For programming the chip you can use an eprom programmer or you can use In Circuit Programming with and USB adapter on several family members of Atmel and STC.
Minimal basic computer hardware design schematics
This design uses internal code and externa 64 Kb SRAM, you can see that port 0 and 2 are external data and address lines and we use the RD and WR pin of port 3. In this design I used an original 8052-basic chip from Intel, but you can also use an AT89C52 from Atmel or STC to program the basic code into the Flash rom of the 8052 processor. This design uses a 8052 because it needs the 256 bytes internal ram. You can find the sourcecode of the basic versions 1.0 and 1.3 in the example directory of my 8052 IDE program (also on this site). You have to connect this design with a USB TTL / serial adapter to a PC or to a TTL compatible terminal. It will do autobaud on pressing the spacebar. Just build this design, upload the code into a 8052 and you have a working floating point Basic interpreter based microcomputer that can also use the unused pins to control external hardware.
Minimal full external eprom and ram hardware design schematics
This is the most complex design I made with a 64 kb external ROM / Eprom / Flash rom and 32 Kb of ram. I use 32kb of ram because these chips are commonly available and otherwise you would have to switch the next step and that is a 128 kb ram of which you only use half. In my case 32 Kb is more than enough for all cases. If we look at the design we see the same address latch and for the ram a little more logic to generate the output enable signal. This is a safe design. I also added a reset button and a EA selection pin if you want to use the board also to run code inside the 8051 chip. The design is not that complex, the 51 family is a very easy to implement microcontroller. Also in this design you have a lot of free I/O ports to control anything. It also uses a TTL level serial interface,
Adding a real RSR232 interface to a 8051 processor schematics
If you want to connect a 8051 to a read RS232 terminal you will need a RS232 level converter chip. If you do not know what RS232 is look here. This is my simple basic design for a RS232 interface, you can use this on almost every single board computer design, it does not support any control lines, just the basic TX and RX lines. It uses the MAX232 chip that is still commonly available. Personally I like to keep things simple.
8051 internal ram mapping
This ia the ram mapping, the first 32 bytes are reserved for register banks, but if you do not use these banks you can lso address then as common mamory. Then there us an eara that is bit addressable, again if you do not use this you can address these bytes as normal mamory bytes, you can even do both. The rest of the mamory up to 0x7f is common ram where also the stack lives. The area above 0x7f are Special Function Registers and when you write to them as normal memory you will write directly into these registers. In the 8052 this upper 128 bytes of ram that is at the same address space as the SFR is only accessable with indexed addressing mode trough R0, R1 or DPTR. This can be tricky if you do not understand this completely. After reset the SP stack pointer is at address 0x07, one of the first things I dos is set this to a safe address.
SFR registers on different types of 8051 family members
The AT89C52 datasheet has a discription of all SFR registers.
It is fun writing code for the 8051 family processors, they are very fast, have a lot of I/O ports, a very nice instruction set and when you take the challenge of building a complete application just using 192 bytes of ram you will find that especially the bit addressable area is very clever to store flags, a Boolean value will only take up one BIT of memory. I have written a very complete developers IDE for the 8051 processor that also supports the 89c52 hardware. It has a assembler, disassembler, emulator, single step debugger, TV100 terminal, seven segment displays and output leds on board. Also I provide som example code and some sourecode from Intel. For a good understanding of all the instructions and tips and tricks, there are nice books and online tutorials, this page is intended as a guide to the internals and te hardware design of this wonderful chip.
Last update: 22-05-2022