Skip to main content

About 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 bank reg + 16 bit addressable reg + 80 general purpose reg ]
  • 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.
8051 models may also have a number of special, model-specific features, such as UART, ADC, Op_Amps, etc... it is a very powerful micro controller.

Basic Pin Details  



PIN 9: PIN 9 is the reset pin which is used to reset the microcontroller’s internal registers and ports upon starting up. (Pin should be held high for 2 machine cycles.)

PINS 18 & 19: The 8051 has a built-in oscillator amplifier hence we need to only connect a crystal at these pins to provide clock pulses to the circuit.

PIN 40 and 20: Pins 40 and 20 are VCC and ground respectively. The 8051 chip needs +5V 500mA to function properly, although there are lower powered versions like the Atmel 2051 which is a scaled down version of the 8051 which runs on +3V.
 
PINS 29, 30 & 31: As described in the features of the 8051, this chip contains a built-in flash memory. In order to program this we need to supply a voltage of +12V at pin 31. If external memory is connected then  

PIN 31, also called EA/VPP, should be connected to ground to indicate the presence of external memory.  

PIN 30 is called ALE (address latch enable), which is used when multiple memory chips are connected to the controller and only one of them needs to be selected.We will deal with this in depth in the later chapters.  

PIN 29 is called PSEN. This is "program store enable". In order to use the external memory it is required to provide the low voltage (0) on both PSEN and EA pins.

 Basic Ports of  8051 Microcontroller

There are 4 8-bit ports: P0, P1, P2 and P3.

PORT P1 (Pins 1 to 8): The port P1 is a general purpose input/output port which can be used for a variety of interfacing tasks. The other ports P0, P2 and P3 have dual roles or additional functions associated with them based upon the context of their usage.The port 1 output buffers can sink/source four TTL inputs. When 1s are written to portn1 pins are pulled high by the internal pull-ups and can be used as inputs.

PORT P3 (Pins 10 to 17): PORT P3 acts as a normal IO port, but Port P3 has additional functions such as, serial transmit and receive pins, 2 external interrupt pins, 2 external counter inputs, read and write pins for memory access.

PORT P2 (pins 21 to 28): PORT P2 can also be used as a general purpose 8 bit port when no external memory is present, but if external memory access is required then PORT P2 will act as an address bus in conjunction with PORT P0 to access external memory. PORT P2 acts as A8-A15

PORT P0 (pins 32 to 39) PORT P0 can be used as a general purpose 8 bit port when no external memory is present, but if external memory access is required then PORT P0 acts as a multiplexed address and data bus that can be used to access external memory in conjunction with PORT P2. P0 acts as AD0-AD

PORT P10: asynchronous communication input or Serial synchronous communication output.

Oscillators in 8051 Microcontroller


The 8051 requires an external oscillator circuit. The oscillator circuit usually runs around 12MHz, although the 8051 (depending on which specific model) is capable of running at a maximum of 40MHz. Each machine cycle in the 8051 is 12 clock cycles, giving an effective cycle rate at 1MHz (for a 12MHz clock) to 3.33MHz (for the maximum 40MHz 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

 

Comments

Popular posts from this blog

AVR Studio 4 Installation Guide

Introduction to AVR Studio 4 AVR Studio 4 is Atmel's integrated development environment (IDE) specially design to write and debug applications for AVR devices. The suite includes a text editor to write programs, an assembler to translate assembly code into object programs, and a simulator to watch code's behavior without need of having an AVR device attached.   System Requirements : Window XP Window Vista Window 7(32-Bit) Window 7(64-Bit) Windows 8 Step 1: Download AVR Studio 4 from Here - Download Step 2: Download Win AVR from Here - Download Step 3:  Install Win AVR Software Step 4: Installing AVR Studio Locate the setup program in the folder where you downloaded the software. In this case, the name of the setup program is aStudio4b460.exe . Double-click on aStudio4b460.exe to start the installation. Select Next on the appearing window. Read the license agreement, select the "I accept" option, and...

AVR First Program - LED Blink

This is a simple blinking LED program. We will look at basic structure and cover specifics about the syntax. First let’s talk about the files that surround the main document you created. These are called “includes” and they bring code into the main document. This code adds or augments the functionality of your code. Includes can be found in the WinAvr folder and in the current project folder.  This include is outside the project folder and uses the <> around the name #include <avr/io.h> Schematic  Program /*********************************************************** Program : LED Blink. Software: IDE: Atmel Studio 4 Compiler: avr-gcc Microcontroller - Atmega 16 Port B : LED Copyright (C) 2014 - 2016 H.E.A.R.T. Tech Solutions, India. ************************************************************/ #include<avr/io.h> #include<util/delay.h> void main() { DDRB=0b1111111; // PORT B All Bits...

AVR Studio 4 - Project Guide & Working

AVR studio is an Integrated Development Environment (IDE) by ATMEL for developing applications based on 8-bit AVR microcontroller. Prior to installation of AVR Studio you have to install the compiler WinAVR. This will allow AVR Studio to detect the compiler Step 1 : Open Software AVR Studio 4 Step 2 : Click on New Project Step 3 : Click on AVR GCC Write the project name Select your project location. Click on Next >> Step 4 : Click on AVR Simulator in left block and then select your controller (e.g.: ATmega16). Click on finish button Step 5 : Write the code in main body area. Save the project file. Step 6 : Go to BUILD -> Compile. This will compile your code and generate error if any. If there is any, rectify the code and Compile Again. After Successful Compilation  This will generate hex file of the code. Use that Hex file to burn your microcontroller. Where you will find Hex file? Just go t...