8051 Microcontroller: 9 Important Facts You Should Know

C o n t e n t s

  • What is a microcontroller ?
  • Different Addressing Modes of microcontroller
  • 8051 microcontroller PIN Diagram
  • 8051 microcontroller Architecture
  • Memory of 8051
  • Interrupts of 8051
  • Features of a microcontroller
  • Microprocessor vs Microcontroller
  • Applications

What is a Microcontroller?

“A microcontroller is a small computer that consists of processor, internal RAM, ROM or flash, timers, interrupt handler, serial interface, ports & other application-specific devices.”

  • A microcontroller is employed if the memory prerequisite for computations is small and the programs and ports are used for the control and communication purpose.
  • For example i.e., 8051, PIC and ARM are the standard Microcontrollers.
8051
8051 Microcontroller
Image Credit : Konstantin Lanzet (with permission), KL Intel P8051CC BY-SA 3.0

Main Features of 8051 Microcontroller :

  • 8-bit ALU and Accumulator, 8 bit registers, 8 bit data bus and 2×16 bit address bus/program counter/data pointer and related 8/11/16 bit operations.
  • Fast interrupt with operational register.
  • Power saving mode.

Addressing Mode of 8051 Microcontroller:

“An addressing mode denotes by what method addressing a particular memory location.”

There are five important addressing modes in 8051 microcontroller, they are:

1 1

Each of these addressing modes provide important flexibility.

Immediate Addressing

Immediate addressing is like the data to be stored in memory instantly as per the opcode . The instruction itself commands which value might be kept in memories specifically.

E.g., the instruction as follows:

MOV A, #20H

Here memonics utilizes immediate addressing for the reason that the accumulator is going to be filled with the value which mentioned.

In direct addressing,  the value to be loaded is time dependent, this adressing certainly not flexible.

Indirect Addressing

Indirect addressing is a really good comparatively that in most instances contributes an exceptional degree of flexibility. This is by only means to get the additional 128 bytes of internal RAM located in an 8051.  Example is like

MOV A, @R0

This instruction bases the 8051 Microcontroller to have another look at the value of the R0 register. The 8051 will then load the accumulator with the info of internal RAM that’s located at the address indicated by R0 register.

By way of instance, let us say R0 retains the value 50H and address 50H retains the value 66H. When the above-mentioned instruction is implemented the 8051 will assess the value of R0. Since R0 retains 50H, the 8051 will find the value of this internal RAM address 50H and keep it in the accumulator. Indirect addressing consistently identifies internal RAM; it refers to a SFR

External Direct

External memory is get into by means of a set of instructions uses ‘external direct’ addressing. There are two such types of commands that could be used for external direct addressing operations, those are

MOVX A, @DPTR

MOVX @DPTR, A

Here, the two controls use DPTR. In these commands, DPTR should first be loaded using the location of external memory which is to be read or write. After DPTR retains the proper external memory card, the initial command will transfer the contents of the external memory address to the accumulator. The next command is going to do the contrary; it permits to write the accumulator’s value to the external memory address which is already pointed by DPTR.

External Indirect

External memory may be acquired using a indirect addressing that is known as external indirect addressing. This kind of addressing is generally utilized in relatively minor tasks which have a rather modest number of external RAM. Such example is

MOVX @R0, A

The value of R0  has to be read and the value of the accumulator is from external RAM location. Considering that the value of R0 could simply be 00 through FFh, and is limited to 256 bytes. Employing external indirect addressing; nonetheless, it’s normally simpler to use external direct mode if the task has more than 256 bytes.

Architecture of 8051 Microcontroller:

  • 8051 is equipped with an 8-bit CPU with a Boolean processor.
  • 5 interrupts.  2 Externals, 2 priority levels.
  • This has two sixteen bit timer/counters.
  • One programmable full-duplex serial port.
  • Total 32 I/O lines.
  • Equipped with the 4 KB of on-chip ROM ; EPROM  is also available in some models.
  • 128 bytes of on-chip RAM, just enough for many single chip.
8051 Architecture
Architecture of 8051 Microcontroller
Image Credit : AppaloosaIntel 8051 archCC BY-SA 3.0

PIN Diagram of 8051 Microcontroller:

8051 Microcontroller
PIN Diagram of 8051 Microcontroller:

8051 Microcontroller PIN Configuration:

PIN 1 to 8

These pins generaly utilized as I/P or O/P according to the user requirements.

PIN 9:

This is utilized as  Resetting purpose; Generally HL signal pin  halts the MCU and clear all the registers. When this pin is back to LO, new program will start.

PIN 10 – 17:

These are utilized as with the port 1, each of these pins could be employed as universal i/p or o/p.

Pin 10:

RXD- Ac as a serial I/P for the asynchronous trasfer otherwise clock output for synchronous mode of operation.

Pin 11:

TXD- Act as a serial O/P for  the asynchronous transfer otherwise clock output for synchronous mode of operation.

Pin 12:

INT0- This is for input interrupt 0

Pin 13:

INT1- This is for input interrupt 1

Pin 14:

T0- This is employed for clock input of the timer 0

Pin 15:

T1- This is dedicated for clock input of the timer 1

Pin 16:

WR- This is for write operation controlling from external RAM memory device.

Pin 17:

RD- This pin is dedicated for read operation to external RAM memory

PIN 18-19:

X2 and X1- These are for input and output  operation of the internal oscillator

PIN 20:

GND- Ground ; This is for grounding the chip.

PIN 21-28:

Port 2- provisional external memory is not present, Port 2 will work as an universal I/O operation.

PIN 29:

PSEN: MCU triggers after reading each byte from the program memory. When an external memory is employed for program storage purpose, then PSEN will be associated with the control operation.

PIN 30:

ALE: This will have important function before external memory reading, MCU will send the lower byte of the address registers to the Port-P0 and triggers the output ALE.

PIN 31:

EA: The LOW signal refer to the Port- P2 and P3 for transporting addresses irrespective of the memory status.

PIN 32-39: 

Port 0: analogous to port 2, pins of port 0 could be utilized as universal I/O. The P0 performs as address O/P if ALE pin is at high state.

PIN 40:

VCC:This is for  +5V  dc power supply.

Interrupts of 8051 microcontroller:

Five interrupts are provided in 8051. Three sets automatically by internal operations and other two is  triggered by external signal linked to pins INT0 and INT1.

Automatic interrupts are:

  1. Timer Flag 0
  2. Timer Flag 1
  3. Serial Port Interrupt (R1 or T1)

Interrupt Name                                          Interrupt Address

Timer Flag o                                                   0 0 0 B

Timer Flag 1                                                   0 0 1 B

INT0                                                                0 0 0 3

INT1                                                               0 0 1 3

Serial Input                                                     R1/ T1                             

Applications of Microcontroller:

  • Microcontroller is employed in Mobile phones, camera circuitry.
  • Microcontrollers are used extensively in Automobile Industry
  • Computer Systems like traffic signal controlling.
  • Different control operation such as heater, greezer,  liftcontrol, Micro-oven etc.

Comparison of Microprocessor vs. Microcontroller:

     MICROPROCESSOR    MICROCONTROLLER
CPUIt has 1 Central Processing Unit It has a Central Processing Unit, Memory, Input-output pins.
USEMicroprocessor is used in personal computers.Microcontroller has applications in embedded system.
INTERFACEMicroprocessor interface is complicated.Simpler Interface
COSTThey are expensiveThey are inexpensive
REGISTERIt has less numbers of registers, operations are mostly memory based.Greater number of registers making it easy for operations.

For more Electronics Articles and question answers related to electronics click here

Leave a Comment