Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • DSA
  • Practice Problems
  • C
  • C++
  • Java
  • Python
  • JavaScript
  • Data Science
  • Machine Learning
  • Courses
  • Linux
  • DevOps
  • SQL
  • Web Development
  • System Design
  • Aptitude
  • GfG Premium
Open In App
Next Article:
Pin diagram of 8051 Microcontroller
Next article icon

Pin diagram of 8051 Microcontroller

Last Updated : 21 Apr, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report

Introduction :

The 8051 microcontroller is a popular 8-bit microcontroller widely used in embedded systems. It is a single-chip microcontroller with a Harvard architecture that includes a CPU, RAM, ROM, and several peripherals. The 8051 microcontroller has a 40-pin dual in-line package (DIP) that provides various inputs and outputs for communication with external devices. 

8051 microcontroller is a 40 pin Dual Inline Package (DIP). These 40 pins serve different functions like read, write, I/O operations, interrupts etc. 8051 has four I/O ports wherein each port has 8 pins which can be configured as input or output depending upon the logic state of the pins. Therefore, 32 out of these 40 pins are dedicated to I/O ports. The rest of the pins are dedicated to VCC, GND, XTAL1, XTAL2, RST, ALE, EA' and PSEN'. Pin diagram of 8051 microprocessor is as given below : Description of the Pins :

  • Pin 1 to Pin 8 (Port 1) - Pin 1 to Pin 8 are assigned to Port 1 for simple I/O operations. They can be configured as input or output pins depending on the logic control i.e. 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. These pins are also referred to as P1.0 to P1.7 (where P1 indicates that it is a pin in port 1 and the number after ‘.’ tells the pin number i.e. 0 indicates first pin of the port. So, P1.0 means first pin of port 1, P1.1 means second pin of the port 1 and so on). These pins are bidirectional pins.
  • Pin 9 (RST) - Reset pin. It is an active-high, input pin. Therefore if the RST pin is high for a minimum of 2 machine cycles, the microcontroller will reset i.e. it will close and terminate all activities. It is often referred as “power-on-reset” pin because it is used to reset the microcontroller to it’s initial values when power is on (high).
  • Pin 10 to Pin 17 (Port 3) - Pin 10 to pin 17 are port 3 pins which are also referred to as P3.0 to P3.7. These pins are similar to port 1 and can be used as universal input or output pins. These pins are bidirectional pins. These pins also have some additional functions which are as follows:
    • P3.0 (RXD) : 10th pin is RXD (serial data receive pin) which is for serial input. Through this input signal microcontroller receives data for serial communication.
    • P3.1 (TXD) : 11th pin is TXD (serial data transmit pin) which is serial output pin. Through this output signal microcontroller transmits data for serial communication.
    • P3.2 and P3.3 (INT0', INT1' ) : 12th and 13th pins are for External Hardware Interrupt 0 and Interrupt 1 respectively. When this interrupt is activated(i.e. when it is low), 8051 gets interrupted in whatever it is doing and jumps to the vector value of the interrupt (0003H for INT0 and 0013H for INT1) and starts performing Interrupt Service Routine (ISR) from that vector location.
    • P3.4 and P3.5 (T0 and T1) : 14th and 15th pin are for Timer 0 and Timer 1 external input. They can be connected with 16 bit timer/counter.
    • P3.6 (WR') : 16th pin is for external memory write i.e. writing data to the external memory.
    • P3.7 (RD') : 17th pin is for external memory read i.e. reading data from external memory.
  • Pin 18 and Pin 19 (XTAL2 And XTAL1) - These pins are connected to an external oscillator which is generally a quartz crystal oscillator. They are used to provide an external clock frequency of 4MHz to 30MHz.
  • Pin 20 (GND) - This pin is connected to the ground. It has to be provided with 0V power supply. Hence it is connected to the negative terminal of the power supply.
  • Pin 21 to Pin 28 (Port 2) - Pin 21 to pin 28 are port 2 pins also referred to as P2.0 to P2.7. When additional external memory is interfaced with the 8051 microcontroller, pins of port 2 act as higher-order address bytes. These pins are bidirectional.
  • Pin 29 (PSEN) - PSEN stands for Program Store Enable. It is output, active-low pin. This is used to read external memory. In 8031 based system where external ROM holds the program code, this pin is connected to the OE pin of the ROM.
  • Pin 30 (ALE/ PROG) - ALE stands for Address Latch Enable. It is input, active-high pin. This pin is used to distinguish between memory chips when multiple memory chips are used. It is also used to de-multiplex the multiplexed address and data signals available at port 0. During flash programming i.e. Programming of EPROM, this pin acts as program pulse input (PROG).
  • Pin 31 (EA/ VPP) - EA stands for External Access input. It is used to enable/disable external memory interfacing. In 8051, EA is connected to Vcc as it comes with on-chip ROM to store programs. For other family members such as 8031 and 8032 in which there is no on-chip ROM, the EA pin is connected to the GND.
  • Pin 32 to Pin 39 (Port 0) - Pin 32 to pin 39 are port 0 pins also referred to as P0.0 to P0.7. They are bidirectional input/output pins. They don't have any internal pull-ups. Hence, 10 K? pull-up registers are used as external pull-ups. Port 0 is also designated as AD0-AD7 because 8051 multiplexes address and data through port 0 to save pins.
  • Pin 40 (VCC) - This pin provides power supply voltage i.e. +5 Volts to the circuit.

The pin diagram of the 8051 microcontroller is as follows:

  1. VCC: This pin is connected to the power supply and provides a voltage of +5V to the microcontroller.
  2. GND: This pin is connected to the ground and serves as the reference voltage for the microcontroller.
  3. XTAL1 and XTAL2: These pins are used for connecting an external crystal oscillator that provides the clock signal for the microcontroller.
  4. Reset: This pin is used for resetting the microcontroller. A high pulse on this pin resets the microcontroller to its initial state.
  5. Port 1: This is an 8-bit bidirectional input/output port that can be used for interfacing with external devices.
  6. Port 2: This is an 8-bit bidirectional input/output port that can be used for interfacing with external devices.
  7. Port 3: This is an 8-bit bidirectional input/output port that can be used for interfacing with external devices.
  8. Port 4: This is an 8-bit bidirectional input/output port that can be used for interfacing with external devices.
  9. INT0: This is an external interrupt 0 input pin.
  10. INT1: This is an external interrupt 1 input pin.
  11. T0: This is an external timer 0 input pin.
  12. T1: This is an external timer 1 input pin.
  13. WR: This is the write signal for external memory.
  14. RD: This is the read signal for external memory.
  15. ALE: This is the address latch enable signal that is used to latch the address for external memory.
  16. PSEN: This is the program store enable signal that is used for accessing the program memory.
  17. 17-24. Address bus: These pins are used for transmitting the address information to the external memory.
  18. 25-32. Data bus: These pins are used for transmitting the data between the microcontroller and external memory.
  19. RST: This is the output signal that indicates the microcontroller is being reset.
  20. EA: This is the external access enable signal that is used for selecting the program memory.
  21. VPP: This pin is used for programming the microcontroller.
  22. 36-39. XTAL: These pins are used for connecting an external crystal oscillator.
  23. P1.0 (AD0) - P1.7 (AD7): These pins are used for interfacing with external analog devices.

Uses of pin diagram of the 8051 microcontroller :

The pin diagram of the 8051 microcontroller is used for various purposes in embedded systems. Some of the main uses of the pin diagram are:

  1. Interfacing with external devices: The 8051 microcontroller has several input/output pins that can be used for interfacing with external devices such as sensors, actuators, displays, and communication modules. The pin diagram provides the information about the location of these pins, their functionalities, and their electrical characteristics.
  2. Programming the microcontroller: The 8051 microcontroller can be programmed using various programming languages such as Assembly, C, and BASIC. The pin diagram provides the information about the pins that are used for programming the microcontroller, such as the PSEN pin and the ALE pin.
  3. Debugging and testing: The pin diagram provides access to the internal signals of the microcontroller, such as the address and data buses, which can be used for debugging and testing the microcontroller. Special hardware tools such as logic analyzers and oscilloscopes can be connected to the pins to monitor the signals and diagnose any issues in the system.
  4. Expansion and customization: The pin diagram provides the flexibility to expand and customize the functionality of the microcontroller by connecting external devices and peripherals. For example, additional memory can be added by connecting external RAM or ROM chips to the address and data buses.

Issues in pin diagram of the 8051 microcontroller :

  1. Power supply voltage: The 8051 microcontroller requires a stable power supply voltage of 5V. If the voltage is not stable or drops below the required level, it can cause the microcontroller to malfunction.
  2. Input/output current: Each pin of the 8051 microcontroller has a maximum current rating, and exceeding this rating can cause damage to the microcontroller or other components connected to it. It is important to ensure that the input/output current is within the specified limits.
  3. Input/output voltage: The 8051 microcontroller has specific voltage requirements for its input/output pins. If the voltage is too high or too low, it can cause the microcontroller to malfunction or even damage it.
  4. Interference: External interference such as electromagnetic interference (EMI) and radio frequency interference (RFI) can affect the performance of the 8051 microcontroller, particularly if the pins are not properly shielded.
  5. Pin conflicts: When using multiple peripherals or devices with the 8051 microcontroller, there can be conflicts between the pins used by different devices. Careful planning and circuit design is required to avoid pin conflicts and ensure proper functionality of all devices.

Next Article
Pin diagram of 8051 Microcontroller

V

vanshikamunjal80
Improve
Article Tags :
  • Electronics Engineering
  • system-programming
  • microprocessor

Similar Reads

    Pin diagram of 8085 microprocessor
    The 8085 microprocessor is a popular 8-bit microprocessor developed by Intel. It has 40 pins, each with a specific function for interfacing with memory, input/output devices, and other components.Pin diagram of 8085 microprocessor is shown below: Key Pin Descriptions1. Address Bus and Data BusAddres
    5 min read
    Pin diagram of 8086 microprocessor
    The 8086 chip, presented by Intel in 1978, is a critical part in the development of processing innovation. Its pin outline is a basic part of figuring out its design and usefulness. The pin chart gives a visual portrayal of the chip's outer associations and their individual capabilities, including p
    8 min read
    8259 PIC Microcontroller
    Intel 8259 is a Programmable Interrupt Controller (PIC). There are 5 hardware interrupts and 2 hardware interrupts in Intel 8085 and Intel 8086 microprocessors respectively. But by connecting Intel 8259 with these microprocessors, we can increase their interrupt handling capability. Intel 8259 combi
    5 min read
    Introduction to 8051 Microcontroller
    8051 is one of the first and most popular microcontrollers also known as MCS-51. Intel introduced it in the year 1981. Initially, it came out as an N-type metal-oxide-semiconductor (NMOS) based microcontroller, but later versions were based on complementary metal-oxide-semiconductor(CMOS) technology
    8 min read
    Timing Diagram 8085 Microprocessor
    A time diagram is a graphical representation where the 8085 instruction timing diagram represents the execution time of each instruction in graphical format. In this article, we will be Going Through the Timing Diagram, We will go through Different Machine Cycles Such as Opcode Fetch, Memory Read, M
    5 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences