post details Interfacing-Port-0 Port-1 Port-2 Port-3-Functions-89C51-89C52-AT89S51-AT89S52-Microcontrollers-Interfacing | Port-0 Port-1 Port-2 Port-3
Functions Input Output Ports Port 0 Port 1 Port 2 Port 3 Tutorials Basics & Fundamentals 89C51 89C51


Four  8 Port 0 Port 1 Port 2 Port 3 8051 Microcontroller Family Models :
Atmel, NXP, Philips, 8051, 8052, 89C51, 89C52, 89S51, 89s52, 89C1051, 89C1051, 89C2051, AT89C4051, AT89S8252,l AT89C1051, AT89C2051, AT89C4051,P89C51RB+, P89C51RC+, P89C51RD+, P89C51RB2Hxx, P89C51RC2Hxx, P89C51RD2Hxx, P89C660, P89C662, P89C664, P89C668, P89C669, P89C51RA2xx, P89C51RB2xx, P89C51RC2xx, P89C51RD2xx, P89C60X2, P89C61X2,P89LV51RB2, P89LV51RC2, P89LV51RD2, P89V51RB2, P89V51RC2, P89V51RD2, P89V660, P89V662, P89V664.
Introduction And Fundamentals of  Port 0 Port 1 Port 2 Port 3 8051:
There are 8 bit four ports in 40 pin 8051 microcontroller P0, P1, P2 and P3 each of them use 8 bits with its pins and making all of them 8 bit ports. They can also be defined as Port 0, Port1, Port 2, Port 3 in AT89C51, AT89C52, AT89S51, AT89S52 Microcontrollers To make them use all of them as an input or output first we have to program before using them in our projects. Following are the basic pin configuration of 89C51, 89C52, 89S51, 89S52 Microcontrollers :
Introduction And Fundamentals of  Port 0 Port 1 Port 2 Port 3 8051
Port 0: Port 0 has 8 pins and it starts from pins 32-39 or 40 pin microcontroller. It can be utilized as input and output purposes. Each pin of Port 0 is connected with 10 K ohm pull up resistors to work with externally because these are open drain unlike other P1, P2, and P3 of 8 bit 89C52 Microcontroller or other family members. Following is the C code and assembly code to send out to Port 0
MOV A,#55H
Port 1: Port 1 of 89S51 or any other family member of 8051 microcontroller has total of 8 pins starts pins 1 through 8. This Port 1 Of 89S51 can also be used for input and output purposes like other Ports of 89S51 and family. It doesn’t need any pull up resistor it has already inbuilt resistors internally. While working with Port 1 we don't need any pull up resistors, because these are inbuilt and starts working when we switch on the device.
Port 2 : Port 2 also has 8 pins and starts count from pins 21- 28 on 40 pin microcontrollers and can be used as input and output. It doesn’t require any pull up resistors. Port 2 can also be used to connect all types of external devices like sensors, lcds, boards, led etc. This is a bidirectional port and it can get and send data over 8 pins like other Port of 8051 Microcontrollers.
Port 3 : Port 3 of 8 bit microcontroller works with 8 pins like other ports of 89C2051 or 89C51 Microcontroller and other family members. From pins 10 through 17 on microcontrollers. Port 3 contains some special functions like interrupts and counters. Port 3 can be used a dual role in a 89s51 microcontroller to interfacing the external world and eeprom or any external memory devices like other ports of 89c2051 Microcontroller and its variant family members.