Skip to main content

8051 Microcontroller

The Intel 8051 microcontroller is one of the most popular general purpose microcontrollers in use today. The success of the Intel 8051 spawned a number of clones, which are collectively referred to as the MCS-51 family of microcontrollers, which includes chips from vendors such as Atmel, Philips, Infineon, and Texas Instruments.

The Intel 8051 is an 8-bit microcontroller which means that most available operations are limited to 8 bits. There are 3 basic "sizes" of the 8051: Short, Standard, and Extended. The Short and Standard chips are often available in DIP (dual in-line package) form, but the Extended 8051 models often have a different form factor, and are not "drop-in compatible". All these things are called 8051 because they can all be programmed using 8051 assembly language, and they all share certain features (although the different models all have their own special features).

Some of the features that have made the 8051 popular are:
  • 4 KB on chip program memory.
  • 128 bytes on chip data memory(RAM)
  • 32 bytes devoted to register banks
  • 16 bytes of bit-addressable memory
  • 80 bytes of general-purpose memory
  • 4 reg banks.
  • 128 user defined software flags.
  • 8-bit data bus
  • 16-bit address bus
  • 16 bit timers (usually 2, but may have more, or less).
  • 3 internal and 2 external interrupts.
  • Bit as well as byte addressable RAM area of 16 bytes.
  • Four 8-bit ports, (short models have two 8-bit ports).
  • 16-bit program counter and data pointer.
  • 1 Microsecond instruction cycle with 12 MHz Crystal.

Variants of the 8051 may also have a number of special, model-specific features, such as UART, ADC, Op_Amps, etc., making it an even more powerful microcontroller.

Typical Application

8051 chips are used in a wide variety of control systems, telecom applications, robotics as well as in the automotive industry. By some estimations, 8051 family chips make up over 50% of the embedded chip market.

Pin Description

8051 Microcontroller Pin Description

Pins 1 to 8 − These pins are known as Port 1. This port doesn’t serve any other functions. It is internally pulled up, bi-directional I/O port.

Pin 9 − It is a RESET pin, which is used to reset the microcontroller to its initial values.

Pins 10 to 17 − These pins are known as Port 3. This port serves some functions like interrupts, timer input, control signals, serial communication signals RxD and TxD, etc.

Pins 18 & 19 − These pins are used for interfacing an external crystal to get the system clock.

Pin 20 − This pin provides the power supply to the circuit.

Pins 21 to 28 − These pins are known as Port 2. It serves as I/O port. Higher order address bus signals are also multiplexed using this port.

Pin 29 − This is PSEN pin which stands for Program Store Enable. It is used to read a signal from the external program memory.

Pin 30 − This is EA pin which stands for External Access input. It is used to enable/disable the external memory interfacing.

Pin 31 − This is ALE pin which stands for Address Latch Enable. It is used to demultiplex the address-data signal of port.

Pins 32 to 39 − These pins are known as Port 0. It serves as I/O port. Lower order address and data bus signals are multiplexed using this port.

Pin 40 − This pin is used to provide power supply to the circuit.

Oscillator Circuit

The 8051 requires an external oscillator circuit. The oscillator circuit usually runs around 12 MHz, although the 8051 (depending on which specific model) is capable of running at a maximum of 40 MHz. Each machine cycle in the 8051 is 12 clock cycles, giving an effective cycle rate at 1 MHz (for a 12 MHz clock) to 3.33 MHz (for the maximum 40 MHz clock). The oscillator circuit generates the clock pulses so that all internal operations are synchronized.

One machine cycle has 6 states. One state is 2 T-states. Therefore one machine cycle is 12 T-states. Time to execute an instruction is found by multiplying C by 12 and dividing product by Crystal frequency.

T=(C*12d)/crystal frequency

8051 Microcontroller Internal Architecture

8051 Microcontroller Internal Architecture

Data and Program Memory

The 8051 Microcontroller can be programmed in PL/M, 8051 Assembly, C and a number of other high-level languages. Some compilers even have support for compiling C++ for an 8051.

Program memory in the 8051 is read-only, while the data memory is considered to be read/write accessible. When stored on EEPROM or Flash, the program memory can be rewritten when the microcontroller is in the special programmer circuit or, if not using a 8031, through a preinstalled bootloader.

Program Start Address

The 8051 starts executing program instructions from address 0000 in the program memory.

Special Function Register

The Special Function Register (SFR) is the upper area of addressable memory, from address 0x80 to 0xFF. A, B, PSW, DPTR are called SFR.This area of memory cannot be used for data or program storage, but is instead a series of memory-mapped ports and registers. All port input and output can therefore be performed by memory mov operations on specified addresses in the SFR. Also, different status registers are mapped into the SFR, for use in checking the status of the 8051, and changing some operational parameters of the 8051.

General Purpose Registers

The 8051 has 4 selectable banks of 8 addressable 8-bit registers, R0 to R7. This means that there are essentially 32 available general purpose registers, although only 8 (one bank) can be directly accessed at a time. To access the other banks, we need to change the current bank number in the flag register.

A and B Registers

The A register is located in the SFR memory location 0xE0. The A register works in a similar fashion to the AX register of x86 processors. The A register is called the accumulator, and by default it receives the result of all arithmetic operations. The B register is used in a similar manner, except that it can receive the extended answers from the multiply and divide operations. When not being used for multiplication and Division, the B register is available as an extra general-purpose register. The A and B registers can store up to 8-bits of data each.






Comments

Popular posts from this blog

7400 - Quad Two Input NAND Gate

7400 - Quad Two Input NAND Gate 74LS00 is part of the 74XXYY IC series. 74xxyy integrated circuits are logical gates of digital electronics. The 74LS00 IC has four NAND gates(NAND Gate is the combination of AND and NOT Gate). In addition, each door has two entrances. Hence the name QUAD TWO INPUT NAND GATE.     Pin Diagram of 7400 IC 74LS00 is a 14-pin device. The chip is available in different packages and is chosen according to the needs.  The description of each pin is given below. Pin Number Description 1 A1-INPUT1 of GATE 1 2 B1-INPUT2 of GATE 1 3 Y1-OUTPUT of GATE1 4 A2-INPUT1 of GATE 2 5 B2-INPUT2 of GATE 2 6 Y2-OUTPUT of GATE2 9 A3-INPUT1 of GATE 3 10 B3-INPUT2 of GATE 3 8 Y3-OUTPUT of GATE3 12 A4-INPUT1 of GATE 4 13 B4-INPUT2 of GATE 4 11 Y4-OUTPUT of GATE4 7 GND- Connected to ground 14 VCC-Connected to positive voltage to provide smdksmkm power to all four gates Internal Ci

Arduino Code Basics - C, Pins

Code Basics -Arduino C The Arduino uses a slightly reduced C/C++ programming language. In this recipe, we will remember a few basics of C/C++. Ensure that you have Arduino IDE Installed on your Laptop/PC. Here is a simple example of basic Arduino C/C++ manipulating two variables: // Global Variables  int var1 = 10;  int var2 = 20; void setup() {   // Only execute once when the Arduino boots   var2 = 5;   // var2 becomes 5 once the Arduino boots } void loop(){   // Code executes top-down and repeats continuously   if (var1 > var2) {  // If var1 is greater than var2 var2++; // Increment var2 by 1   } else {  // If var1 is NOT greater than var2     var2 = 0; // var2 becomes 0   }  } When we upload a sketch to the board, the Arduino software first compiles the code. If there is an error in the code, it will write it in the Status Display area and will stop the upload. If no errors are found, it will begin writing the compiled co

RGB Led Fading effect using Arduino

The RGB LED can emit different colors by mixing the 3 basic colors red, green and blue. So, it actually consists of 3 separate red, green and blue LEDs, packaged in one box. This is why it has 4 leads, one for each of the 3 colors and a common cathode or anode depending on the type of RGB LED. In this tutorial I will use a common cathode. Components required for this Project : RGB Led - Buy Arduino Uno - Buy Breadboard and Jumpers - Buy Circuit Diagram Above is the circuit diagram of the RGB Led and Arduino Uno , As you can see the ground pin  of the RGB LED is connected to the ground of the Arduino and other 3 pins of RGB Led are connected to the PWM Pins of Arduino Uno (9, 10, 11). Code int ledPin = 9;  int ledPin1 = 10; int ledPin2 = 11; void setup() {} void loop() {   for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 5)    {     analogWrite(ledPin, fadeValue);     delay(20);   }   for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -