8051 PIN Diagram and 8051 Block Diagram


Internal Architecture 8051 Microcontroller:
The 8051 is a low-power, high-performance CMOS 8-bit microcontroller with 4K bytes of in-system programmable Flash memory. The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard 8051 instruction set and pinout. The initial version of 8051 used 4 KByte ROM whereas later version employed on-chip flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the 8051 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications.
The 8051 provides the following standard features:

  • 4K bytes of ROM
  • 128 bytes of RAM
  • 4 i/o ports with 32 I/O lines
  • Watchdog timer
  • Two data pointers
  • Two 16-bit timer/counters
  • A five vector two-level interrupt architecture
  • A full duplex serial port
  • On-chip oscillator, and clock circuitry.

Figure-2.1  shows the pin and the block diagram of 8051 microcontroller.

PIN Diagram of 8051 Microcontroller:

Figure 4.1 PIN and Block diagram of 8051
PIN Numbers
Function
Additional Function
PIN 1 to 8
PORT (P-1)
PIN 9
RST
PIN 10-to-17
PORT (P-3)
RXD, TxD, INT0’, INT1’, T0, T1, WR’, RD’
PIN 18, 19
XTAL2, XTAL1
PIN 20
GND
PIN 21-to-28
PORT (P-2)
A8-A15
PIN 29
PSEN’
PIN 30
ALE
PROG’
PIN 31
EA’
VPP
PIN 39-to-31
Port (P0) P0.1 to P0.7.
AD0-AD7
PIN 40
VCC

PORTs of 8051

8051 microcontroller has four ports P0 to P3. These are described below:

PORT-0 (Pin 39-32 as P0.0-P0.7):

Port 0 can be used as I/O port or to carry the low order address of external memory. When used as I/O, and if configured as outputs, each of these pins can be connected to up to 8 TTL inputs. If configured as inputs, the pins can be used as high-impedance inputs as their potential is not defined relative to ground, i.e. they are floating. De-multiplexing of address and data can be performed by using the signal on the ALE. Figure 2.2 shows the use of external pull-up for i/o operations and the de-multiplexing of address and data on Port-0.

Figure 4.2 PORT-0

PORT 1(Pin 1-8 as P1.0 – P1.7): 

Port-1 has internal pull-ups and does not require any external pull-up. It has dual function, that is it can be used as I/O or may be used for alternate functions shown in figure 1.4.  If configured as outputs, each of these pins can be connected to up to 4 TTL inputs. When configured as inputs, these pins act as standard TTL inputs, that is, each of them is internally connected to the positive supply voltage via a resistor of relatively high impedance. Power supply voltage provided on these inputs is 5V.   Table 2.1 shows the alternate functions of Port-1.

Port Pin

Alternate Function

P1.0
   T2 (Timer 2 input)
P1.1
   T2EX (Timer 2 control input)
P1.4
   SS (SPI system control input)
P1.5
   MOSI (SPI system I/O)
P1.6
   MISO (SPI system I/O)
P1.7
   SCK (SPI system clock signal)

Table 2.1: Alternate functions of Port-1

 

PORT 2 (Pin 21-28 as P2.0 – P2.7):

This port also has twin function that is it can be used as I/O or it can be used to carry high order address of the external memory. The I/O function are the same as that of the port-1. This port has internal pull-ups and hence does not require any external pull-up resistors. So, when configured as output port it can drive the TTL devices directly and when configured as input the port act as the standard TTL input.  When used to carry high order address, PORT-0 provides the lower 8 bits via A0 – A7. When used for addressing PORT P0 and P2 cannot be used for I/O

PORT 3 (Pin 10-17 as P3.0 – P3.7): 

This port also function similar to PORT-1 for the I/O operation. However, it also has the additional functions as given in table 2.2.

Port Pin

Alternate Function

P3.0
RXD (serial input)
P3.1
TXD (serial output)
P3.2
INT0 (external interrupt 0)
P3.3
INT1 (external interrupt 1)
P3.4
T0 (Timer 0 external input)
P3.5
T1 (Timer 1 external input)
P3.6
WR (External data memory write signal)
P3.7
RD (External data memory read signal)

Table 2.2: Alternate functions of PORT 3

RST (P0n 9): 

Figure-1.5 shows the reset circuit of 8051. The 8051 microcontroller can be reset by connecting the pin number 9 to active high signal for at least 2 machine cycles. Upon reset, 8051 enter into a power-on reset.

Figure 4.3 : Power on Reset and Debounce

Upon reset, 8051 will reset and terminate all activities and all the registers values get lost and are reset to their default values. Figure-2.4 shows the reset values of different registers.

Figure 4.4 : Default Values in Registers

ALE / PROG’ (pin 30):

This pin is used when external memory is to be interfaced with the controller. In normal operation, the ALE pin is activated at a constant rate of 1/16th of oscillator frequency and can be used for external clocking and timing purposes. When used allows de-multiplexing of address and data for external use. During the process of writing a program to the microcontroller, this pin also serves as a control input.

PSEN (pin 29):

If external ROM is used for storing program then a logic zero (0) appears on it every time the microcontroller reads a byte from memory

EA / VPP (pin 31):

When external ROM is used as program memory, grounding this pin will allow the microcontroller to reads program instructions from external program memory. For accessing the instruction from the internal program memory, this pin must be connected to positive power supply voltage (VCC). During the process of programming internal Flash memory, this pin is supplied with +12V.

XTAL 1 (pin18):

This is internal oscillator input. It is used for the purpose of synchronizing the operation of the microcontroller with some other circuit or for connecting external oscillator when used.

XTAL 2 (pin19):

This pin is connected to internal oscillator output. Therefore, it is out of use when using external clock input. Crystal oscillator/ clock connection:

Though 8051 microcontroller has an on-chip oscillator but requires an external clock to run it. A quartz crystal oscillator is connected to inputs XTAL1 (pin19) and XTAL2 (pin18) with two capacitors of 30 pF value as shown in figure 2.5, however, if the 8051 is to be connected to source of clock it will be connected at XTAL1 and XTAL2 is left unconnected:

Figure 4.5: XTAL Connection

error: Content is protected !!