Home ยป Microcontrollers ยป The Basic Structure of Intel 8051 Microcontroller

The Basic Structure of Intel 8051 Microcontroller

The Intel 8051 also known as MCS-51 is an 8-bit microcontroller and one of the most popular microcontrollers. The Intel 8051 has four parallel input/output ports; ports 0, 1, 2 and 3. Ports 0, 2 and 3 also have alternative functions. The Intel 8051AH version has 4K bytes ROM, 128 bytes RAM, two timers, and interrupts control for five interrupt sources.

The figures below shows the Intel 8051 architecture and pin connection:

Intel 8051 pin connection is illustrated below:

The Input/output Ports

Port 0 is at address 80H, port 1 at address 90H, port 2 at address A0H and port 3 at address B0H. (The H or h, after the address indicate it is in hexadecimal, this for Intel microcontrollers).

When a port is to be used as an output port, the data is put into the corresponding special function register. When a port is to be used as an input port, the value FFH must first be written to it. All the ports are bit addressable. Therefore, we may, for instance, use a bit 6 in port 0 to switch a motor ON or OFF and maybe bit 7 to switch a pump ON or OFF.

Port 0 can be used as an input port or an output port. On the other hand, it can be used as a multiplexed address and data bus to access external memory.

Port 1 can be used as input port or an output port.

Port 2 can be used as an input port or an output port. Alternatively, it can be used for the high address bus to access external memory.

Port 3 can be used as an input port or an output port. Then again, it can be used as a special-purpose input/output port. The alternative functions of port 3 include interrupt and timer outputs, serial port input and output, and control signals for interfacing with external memory. RXD is the serial input port, TXD is the serial output port, INT0 is the external interrupt 0, INT1 is the external interrupt 1, T0 is the timer/counter 0 external input, T1 is the timer/counter 1 external input, WR is the external memory write strobe and RD is the external memory read strobe. The term strobe describes a connection used to enable or disable a specific function.

ALE Pin

The ALE pin provides an output pulse for latching the low-order byte of the address access to the external memory. This allows 16-bit addresses to be used. The figure below demonstrates how this is done:

ALE in use
Figure 1.2 ALE in use

PSEN Pin

The program store enable (PSEN) pin is the read signal pin for external memory and is active when low. It is connected to the output enable pin of external ROM or EPROM.

External Access (EA) Pin

EA pin is taken low for the microprocessor to access only external program code; when high it automatically accesses internal or external code depending on the address. Therefore, when the 8051 is first reset, the program counter starts at $0000 and points to the first program instruction in the internal code memory unless EA is tied low. Then the CPU issues a low on PSEN to enable the external code memory to be used. This pin is also used on a microcontroller with EPROM to receive the programming supply voltage for programming the EPROM.

XTAL1, XTAL2 Pins

These are the connecting pins for a crystal or external oscillator. The most commonly used crystal is 12 MHz.  The figure below illustrates how they are used with a crystal:

RESET Pin

A high signal on this pin for at least two machine cycles resets the microcontroller, that is, it puts it in a condition to allow an orderly system start-up.

Serial input/output

Writing to the serial data buffer SBUF at address 99H loads data for transmission; reading SBUF accesses received data. The bit-addressable serial port control register, SCON at address 98H is used to control the various modes of operation.

Timing

The timer mode register, TMOD at address 89H is used to set the operating mode for timer 0 and timer 1. It is loaded at an entity and is not individually bit addressable.

The timer control register TCON (also shown in Figure 1.4) contains status and control bits for timer 0 and timer 1. The upper 4 bits are used to turn the timers ON and OFF or to signal a timer overflow. The lower 4 bits have nothing to do with timers but are used to detect and initiate external interrupts.

The source of the bits counted by each timer is set by the C/T bit; if the bit is low, the source is the system clock divided by 12, otherwise if high it is set to count an input from an external source. The timers can be started by setting TR0 or TR1 to 1 and stopping by making it 0. Another technique of controlling a timer is by setting the GATE to 1 and so permitting a timer to be controlled by the INT0 or INT1 pin on the microcontroller going to 1. Consequently, an external device connected to one of these pins can control the counter ON/OFF.

Interrupts

Interrupts are used to force the program to call a subroutine located at a specified address in memory; they are enabled by writing to the interrupt enable register IE at address A8H.

Special Function Registers

This term is used for the input/output control registers like the IE register aforementioned. They are located at addresses 80 to FF.

Accumulator A, (ACC) is the main register used for data operations; the B register is used for multiplications and division. P0, P1, P2 and P3 are the latch registers for ports 0, 1, 2, and 3.

Related Resource: Beginning C for Microcontrollers: Making Electronics Dance with Softwareย 

Please follow us and share:

Comments

4 responses to “The Basic Structure of Intel 8051 Microcontroller”

  1. […] The Basic Structure of Intel 8051 Microcontroller […]

  2. […] The Basic Structure of Intel 8051 Microcontroller […]

  3. […] similar set of operations though using different syntax. This is exhibited in the variation in the internal architecture of various types of microcontrollers. Processors such as those fabricated by Intel have a more […]

  4. […] The Basic Structure of Intel 8051 Microcontroller […]

Leave a Reply

Currently trending: