Intel MCS 51
Intel MCS 51
Vcc
Vss
RAM Addr.
Register
RAM
P0.0 - P0.7
P2.0 - P2.7
Port 0
Drivers
Port 2
Drivers
Port 0
Latch
Port 2
Latch
EPROM/
ROM
8
B
Register
Program
Address
Register
Stack
Pointer
ACC
TMP2
TMP1
ALU
Buffer
PC
Incrementer
Timing
and
Control
EA#/VPP
RST
Instruction
Register
PSW
PSEN#
ALE/PROG#
16
Program
Counter
DPTR
Port 1
Latch
Port 3
Latch
The Intel MCS-51 (commonly termed 8051) is an internally Harvard architecture, complex instruction set computing (CISC) instruction set, single chip microcontroller
(C) series developed by Intel in 1980 for use in
embedded systems.[1] Intels original versions were pop- i8051 microarchitecture
ular in the 1980s and early 1990s and enhanced binary
compatible derivatives remain popular today.
The 8051 architecture provides many functions (central
Intels original MCS-51 family was developed using processing unit (CPU), random access memory (RAM),
N-type metal-oxide-semiconductor (NMOS) technology read-only memory (ROM), input/output (I/O), interrupt
like its predecessor Intel MCS-48, but later versions, logic, timer, etc.) in one package:
identied by a letter C in their name (e.g., 80C51) used
complementary metaloxidesemiconductor (CMOS)
8-bit arithmetic logic unit (ALU) and accumulator,
technology and consume less power than their NMOS
8-bit registers (one 16-bit register with special
predecessors. This made them more suitable for batterymove instructions), 8-bit data bus and 216-bit
powered devices.
address bus/program counter/data pointer and reOSC.
XTAL1
Port 1
Drivers
Port 3
Drivers
P1.0 - P1.7
P3.0 - P3.7
XTAL2
MEMORY ARCHITECTURE
Boolean processor with 17 instructions, 1-bit accumulator, 32 registers (4 bit-addressable 8-bit) and
up to 144 special 1 bit-addressable RAM variables
(18 bit-addressable 8-bit)[3]
1.1
Derivate features
3 Memory architecture
3.4
3.1
Internal RAM
Internal RAM (IRAM) has an 8-bit address space, allowed addresses 0 through 0xFF. IRAM from 0x00 to
0x7F can be accessed directly. The 8052 added IRAM
from 0x80 to 0xFF, which must be accessed indirectly; 4 Registers
the address is loaded into R0 or R1, and the memory is accessed using the @R0 or @R1 syntax. Most 8051 clones The only register on an 8051 that is not memory-mapped
also have a full 256 bytes of IRAM.
is the 16-bit program counter PC. This species the adThe 32 bytes from 0x000x1F memory-map the 8 regis- dress of the next instruction to execute. Relative branch
ters R0R7. 8 bytes are used at a time; 2 program status instructions supply an 8-bit signed oset which is added
to the PC.
word bits select between four possible banks,
The 16 bytes (128 bits) at IRAM locations 0x200x2F 8 general-purpose registers R0R7 may be accessed with
instructions 1 byte shorter than others. They are mapped
are bit-addressable.
to IRAM between 0x00 and 0x1F. Only 8 bytes of that
range are used at any given time, determined by the two
bank select bits in the PSW.
3.2 Special function registers
The following is a partial list of the 8051s registers,
Special function registers (SFR) are located in the same which are memory-mapped into the special function regaddress space as IRAM, at addresses 0x80 to 0xFF, and ister space:
are accessed directly using the same instructions as for the
lower half of IRAM. They can not be accessed indirectly
(0x81) Stack pointer SP. This is an 8-bit register
via @R0 or @R1; indirect access to those addresses will
used by subroutine call and return instructions. The
access the second half of IRAM.
stack grows upward; the SP is incremented before
16 of the SFRs (those whose addresses are multiples of
pushing, and decremented after popping a value.
8) are also bit-addressable.
3.3
Program memory
Program memory (PMEM, though less common in usage than IRAM and XRAM) is up to 64 KiB of readonly memory, starting at address 0 in a separate address
space. It may be on- or o-chip, depending on the particular model of chip being used. Program memory is readonly, though some variants of the 8051 use on-chip ash
memory and provide a method of re-programming the
memory in-system or in-application. In addition to code,
it is possible to store read-only data in program memory,
5 INSTRUCTION SET
PSW.3: RS0 Register select 0. The low-order The operations is as follows. Not all support all addressbit of the register bank. Set when banks at ing modes; the immediate mode in particular is unavail0x08 or 0x18 are in use.
able if the exible operand is written to. Instruction
PSW.4: RS1 Register select 1. The high-order mnemonics use destination, source operand order.
bit of the register bank. Set when banks at
0x10 or 0x18 are in use.
PSW.5: F0 Flag 0. For general software use,
not otherwise used by hardware.
PSW.6: AC auxiliary carry. Set when addition
produces a carry from bit 3 to bit 4.
PSW.7: C Carry bit. Often used as the general
register for bit computations, or the boolean
accumulator.
(0xE0) accumulator A. This register is used by most
instructions.
(0xF0) B register. This is used as an extension to the
accumulator for multiply and divide instructions.
Instruction set
Instructions are all 1 to 3 bytes long, consisting of an initial opcode byte, followed by up to 2 bytes of operands.
3/4 of the opcode bytes are assigned to 16 basic ALU
instructions. One operand is exible, while the second
(if any) is specied by the operation: the accumulator, an
immediate constant, or a RAM address. The most signicant nibble of the opcode byte species the operation, and
the least signicant nibble species one of the following
12 addressing modes for the exible operand:
x8xF: Register direct, R0R7
x6x7: Register indirect, @R0 or @R1
x5: Memory direct, a following byte species an
IRAM or SFR location
x4: Immediate, a following byte species an 8bit constant. In some cases where an immediate
operand is nonsensical, the accumulator is used.
5
Only the ADD, ADDC and SUBB instructions set PSW
ags. The INC, DEC, and logical instructions do not. The
CJNE instructions modify the C bit only, to the borrow
that results from operand1operand2.
7 Related processors
ORL C,bit, ORL C,/bit: OR the bit (or its complement) to the carry bit
The 8051s predecessor, the 8048, was used in the key ANL C,bit, ANL C,/bit: AND the bit (or its com- board of the rst IBM PC, where it converted keypresses
into the serial data stream which is sent to the main unit
plement) to the carry bit
of the computer. The 8048 and derivatives are still used
Although most instructions require that one operand is today for basic model keyboards.
the accumulator or an immediate constant, it is possible The 8031 was a cut down version of the original Intel
to perform a MOV directly between two internal RAM 8051 that had no internal program memory (read-only
locations.
memory (ROM)). To use this chip, external ROM had
to be added containing the program that the 8031 would
fetch and execute. An 8051 chip could be sold as a ROM6 Programming
less 8031, as the 8051s internal ROM is disabled by the
normal state of the EA pin in an 8031-based design. A
There are various high-level programming language com- vendor might sell an 8051 as an 8031 for any number of
pilers for the 8051. Several C compilers are available reasons, such as faulty code in the 8051s ROM, or simply
for the 8051, most of which allow the programmer to an oversupply of 8051s and undersupply of 8031s.
specify where each variable should be stored in its six The 8052 was an enhanced version of the original 8051
types of memory, and provide access to 8051 specic that featured 256 bytes of internal RAM instead of 128
hardware features such as the multiple register banks and bytes, 8 KB of ROM instead of 4 KB, and a third 16bit manipulation instructions. There are many commer- bit timer. The 8032 had these same features except for
cial C compilers.[8] Small Device C Compiler (SDCC) the internal ROM program memory. Most modern 8051is a popular open source C compiler.[9] Other high level compatible microcontrollers include these features.
languages such as C++, Forth,[6][7][10][11] BASIC, Object
its MCS-51 product line in March
Pascal, Pascal, PL/M and Modula-2 are available for the Intel discontinued
[12][13]
2007;
however,
there are plenty of enhanced 8051
8051, but they are less widely used than C and assembly.
products or silicon intellectual property added regularly
Because IRAM, XRAM, and PMEM (read only) all have from other vendors.
an address 0, C compilers for the 8051 architecture provide compiler-specic pragmas or other extensions to in- The 80C537 and 80C517 are CMOS versions, designed
dicate where a particular piece of data should be stored for the automotive industry. Enhancements mostly in(i.e. constants in PMEM or variables needing fast access clude new peripheral features and expanded arithmetic
in IRAM). Since data could be in one of three memory instructions. The 80C517 has fail-safe mechanisms, anaspaces, a mechanism is usually provided to allow deter- log signal processing facilities and timer capabilities and
mining to which memory a pointer refers, either by con- 8 KB on-chip program memory. Other features include:
straining the pointer type to include the memory space,
256 byte on-chip RAM
or by storing metadata with the pointer.
7 RELATED PROCESSORS
256 directly addressable bits
CORERIVER
CybraTech
Cypress Semiconductor
Daewoo
Dallas Semiconductor
Digital Core Design
Dolphin Integration
Nine ports
Domosys
easyplug
Evatronix
EnOcean
7.1
Derivate vendors
Current vendors of MCS-51 compatible processors include more than 20 independent manufacturers including Atmel, Inneon Technologies (formerly Siemens
AG), Maxim Integrated Products (via its Dallas Semiconductor subsidiary), NXP (formerly Philips Semiconductor), Microchip Technology, Nuvoton (formerly
Winbond), ST Microelectronics, Silicon Laboratories
(formerly Cygnal), Texas Instruments, Ramtron International, Silicon Storage Technology, Cypress Semiconductor and Analog Devices.[14]
ICs or IPs compatible with the MCS-51 have been developed by:
Genesys Logic
Goal Semiconductor
Handshake Solutions
Honeywell
Hynix Semiconductor
Inneon (founded by Siemens)
InnovASIC
Intel
ISSI
Acer Labs
Actel
Aeroex UTMC
Megawin
Altium
Mentor Graphics
Analog Devices
Micronas
ASIX
Microsemi
Atmel
MXIC (Macronix)
AustriaMicroSystems
Myson Technology
Nordic Semiconductor
Nuvoton (Winbond)
Cast
CML Microcircuits
Oregano Systems
7
Palmchip
Prolic
Radio Pulse
Ramtron
RDC Semiconductor
Sanyo Semiconductor (ON Semiconductor)
Sharp
Sigma Designs
Modern 8051 cores are faster than earlier packaged versions. Design improvements have increased 8051 performance while retaining compatibility with the original
MCS 51 instruction set. The original Intel 8051 ran at
12 clock cycles per machine cycle, and most instructions
executed in one or two machine cycles. A typical maximum clock frequency of 12 MHz meant these old 8051s
could execute one million single-cycle instructions, or
500,000 two-cycle instructions, per second. In contrast,
enhanced 8051 silicon IP cores now run at one clock cycle per machine cycle, and have clock frequencies of up
to 450 MHz. That means an 8051-compatible processor
can now execute 450 million instructions per second.
SMSC
SST
STMicroelectronics
Inneon: XC800
SyncMOS
Synopsys
Syntek Semiconductor
Tekmos
Teridian Semiconductor
Texas Instruments
Tezzaron Semiconductor
Triscend
Vitesse
Yitran
Zensys
Zilog
Zylogic Semiconductor
15 FURTHER READING
12
[9] Lewin A. R. W. Edwards. So, You Wanna be an Embedded Engineer: The Guide to Embedded Engineering,
from Consultancy to the Corporate Ladder. 2006. p. 51.
[10] 8051 SwiftX Forth development.
The 80251 8/16/32-bit microcontroller with 16 MB (24- [11] MPE VFX Forth 7 cross compilers.
bit) address-space and 6 times faster instruction cycle was [12] Ganssle, Jack (2006-05-29). Intel bows out, discontinues
introduced by Intel in 1996.[2][18] It can perform as an 8MCS-51.
bit 8051, has 24-bit external address space which is 16-bit
wide segmented and 32-bit ALU with mostly 8/16/32-bit [13] MCS 51, MCS 251 and MCS 96 Microcontroller Product Lines, the Intel 186, Intel386 and Intel486 Processors
wide data instructions (also Boolean processor with speProduct Lines, and the i960 32 Bit RISC Processor, PCN
cial registers/memory) and a large CISC instruction set,
106013-01, Product Discontinuance, Reason for Revi40 8/16/32-bit registers with 8 8-bit registers in 4 times
sion: Add Key Milestone information and revise descripfast switching memory banks (maximum 512 addressable
tion of change (PDF). Intel. 2006-05-02.
8-bit special registers).
It features extended instructions[19] see also the pro- [14] http://www.analog.com/static/imported-files/data_
sheets/ADUC832.pdf
grammers guide[20] and later variants with higher
[21]
performance,
also available as intellectual property [15] TI Delivers new low-cost, high-performance audio DSP
(IP).[22] It is 3-stage pipelined. The MCS-251 family was
for Home and Car w/ 8051
also discontinued by Intel, but is widely available in binary compatible and partly enhanced variants from many [16] Atmel AT85C51SND3 Audio DSP Data Sheet with USB
2.0
manufacturers.
[17] Integration of 8051 With DSP in Xilinx FPGA
13
See also
DS80C390
14
References
[1] John Wharton: An Introduction to the Intel MCS-51 SingleChip Microcomputer Family, Application Note AP-69,
May 1980, Intel Corporation.
15 Further reading
Books
Mazidi; McKinlay; Mazidi (2012). The 8051 Microcontroller: A Systems Approach. 648 pp. ISBN
978-0-13-508044-3.
Schultz, Thomas (2008). C and the 8051 (4th ed.).
464 pp. ISBN 978-0-9783995-0-4.
Steiner, Craig (2005). The 8051/8052 Microcontroller: Architecture, Assembly Language, and Hardware Interfacing. 348 pp. ISBN 978-1-58112-4590.
Calcutt; Cowan; Parchizadeh (2000). 8051 Microcontrollers: Hardware, Software and Applications.
329 pp. ISBN 978-0-340-67707-0.
Axelson, Jan (1994). The Microcontroller Idea
Book: Circuits, Programs, and Applications featuring the 8052-BASIC Microcontroller. 277 pp. ISBN
978-0-9650819-0-0.
9
Payne, William (December 19, 1990) [1990]. Embedded Controller FORTH for the 8051 Family
(hardcover). Boston: Academic Press. 528 pp.
ISBN 978-0-12-547570-9.
Intel
MCS-51 Microcontroller Family Users Manual; Intel; 1994; publication number 121517.
MCS-51 Macro Assembler Users Guide; Intel; publication number 9800937.
8-Bit Embedded Controllers; Intel; 1991; publication
number 270645-003.
Microcontroller Handbook; Intel; 1984; publication
number 210918-002.
8051 Microcontroller Preliminary Architectural
Specication and Functional Description; Intel; 44
pages; 1980.
16
External links
10
17
17
17.1
Intel MCS-51 Source: https://en.wikipedia.org/wiki/Intel_MCS-51?oldid=735042380 Contributors: Ellmist, Stan Shebs, Ronz, GRAHAMUK, Arteitle, Emperorbma, Wernher, Robbot, Tea2min, Roger Irwin, DavidCary, Wmahan, Chowbok, Sam Hocevar, Flex, Ljosa,
Nabla, CanisRufus, Simon South, R. S. Shaw, Minghong, Alansohn, Corwin8, Wtshymanski, Cburnett, Kgrr, Isnow, MarkusHagenlocher, Rjwilmsi, Miha Ulanov, Wragge, Mirror Vax, Bgwhite, YurikBot, Matanya (renamed), Armistej, DragonHawk, Dhollm, David
Biddulph, RunOrDie, Veinor, SmackBot, John Lunney, Nihonjoe, Maelwys, Rhondle, CSWarren, Chlewbot, OrphanBot, Nishkid64, Rait,
Dicklyon, Riordanmr, Pfagerburg~enwiki, Kimjoarr, ShelfSkewed, HenkeB, Shreyasjoshis, Wsmarz, Solidpoint, Thijs!bot, Racaille, Electron9, Modal, MichaelFrey, Guy Macon, Bobke, Makkwong, Rushikeshshinde, JAnDbot, RastaKins, Ljudina, JamesBWatson, Choppingmall, Mustafa1702, Sajupa, Calltech, Gwern, STBotD, Enivid, VolkovBot, Flyte35, Someguy1221, MauriceS, Don4of4, LeaveSleaves,
SQL, Thunderbird2, Abhi3385, VVVBot, Jerryobject, Antzervos, Lightmouse, Nyelvmark, Frappucino, Ken123BOT, Tuxa, Niceguyedc,
Pointillist, Plaes, Muro Bot, Amolhshah, Joel Saks, XLinkBot, Flipmode y, Asaco, Addbot, Rogue780, Mortense, CactusWriter, MrOllie,
Lightbot, Yobot, Timeroot, Crispmuncher, Raj591, AnomieBOT, Kushagraalankar, Citation bot, ArthurBot, MauritsBot, Xqbot, TheAMmollusc, Capricorn42, Armstrong1113149, JWBE, Victor Waiman, Edsim51, Aaditya 7, FrescoBot, Oldlaptop321, Plindemann, Glider87,
Outback the koala, Tomekdcd, RedBot, NKanngaz, MaxDel, Mohitjoshi999, Songsing77, Sarojlucky, John of Reading, Dead Horsey,
Dewritech, AndroidX1, Dcirovic, Ebrambot, SporkBot, Kevjonesin, Sbmeirow, Spacetrucker23, Lazar.Elena, ClueBot NG, Kasirbot,
Widr, Helpful Pixie Bot, Microheat, DBigXray, Tailor-tinker, Dzlinker, Srinathkr3, Flutte, Ndzervas, Fugmarsh, Tagremover, Richard
vlamynck, Surjansh, Dexbot, SoledadKabocha, Ambiguous Furry Rocking Thing, Frosty, Justme8910, Nvtj, Comp.arch, Kahtar, Monkbot,
LiamMcS, Kayakingphotog, Frostrajiv, Bender the Bot and Anonymous: 218
17.2
Images
17.3
Content license