Overview of 8051

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

6/24/2013

Architecture of 8051
Just as we have studied earlier in one of the previous classes, that microcontrollers can be classified in various ways. The Family (manufacturer) being one of it, in this Part of the course we shall be putting into consideration one of the families of the microcontroller namely the INTEL family. In the INTEL group of family there are various types of microcontroller grouped into family of 8bits group (8XC42, MCS51,MCS48) , the 16bits group (MCS96, MXS296) and so on.

PART II:

Architecture of the 8051

Each of these groups has its distinct features that differentiates them from others and also within each group every member also has distinct features that differentiates them from all other members in the group. However in this part of the course our concentration shall be on the MCS 51 family and in the family our attention shall be on the 8051 microcontroller.

Architecture of 8051
The INTEL MCS 51 family is also known as the 8051 family, this is as a result of the popularity and the wide use of the family member 8051. This is owing to the fact of the large market share the member 8051 enjoys almost all other microcontrollers since its introduction into the market in the late 70s. The INTEL MCS 51 family consists of microcontrollers within the range of 8031 to 8751. That is to say all Intel microcontrollers that falls within the number range of 8031 to 8751 belongs to the family of MCS-51, otherwise known as the 8051 family. The MCS-51 are manufactured based on the CMOS and NMOS construction in variety of packages such as the DIP, PLCC etc. #what is CMOS,NMOS,DIP, PLCC?# CMOS(Complementary metal oxide silicon), NMOS(N- channel metal oxide silicon) , DIP (Dual-inline package), PLCC (Plastic lead chip carrier).

Members of the MCS-51 and their features


Presented below is a sample of a datasheet of the MCS51 family members. Basically the datasheet shows the basic features on each member in the family.

6/24/2013

Members of the MCS-51 and their features (Contd)

Basic Features of the 8051


In the MCS 51 family our attention shall be on the 8051 microcontroller. Some of the basic features of the 8051 includes the following It is an 8 bit microcontroller, meaning the size of the data bus is 8 bit wide and also the CPU has the capability of processing 8bit of data once. It has a 16 bit Address bus 4KB of on-chip ROM- for program storage A 256 byte of RAM for special functions and data,(128 byte for special function register(SFR) and 128byte for internal RAM) Has 4 ports 8-bits ports (I/O ports) 5 interrupt (2-external and 3 internal sources) 1 serial port. Can access up to 64KB of external ROM Can access up to 64KB of external ROM 2 timer And lots more.

Basic Features of the 8051


The figure below illustrates and shows the features of the 8051 .

Basic Features of the 8051


ROM The 8051 is designed such that the memories for the program code and data are divided into 2 separate physical entity (Harvard memory Architecture). The 8051 is equipped with an on-chip ROM of 4KB . This Internal 4KB ROM is used to store program code. The program code can only occupy an address range of 0000h to 0FFFh , which corresponds to the size of the ROM. The address range can be calculated as below: Capacity = End Address Start Address +1 In this case we know the capacity to be 4KB and the start Address is 0000h . Hence we can determine the End address by simple arithmetic operation in hexadecimal to have 0FFF . The implication of the 0000h to 0FFFh is that the address range of the PC (Program counter ) is between 0000h-0FFFh representing a total of 4KB locations that can be used to save program code.

6/24/2013

Basic Features of the 8051


ROM The 8051 microcontroller also has the capability to access up to 64KB of external ROM . Thus the 64KB address region will range from 0000h-0FFFh for the external ROM . If this is used the microcontroller will have the capability of being able to store more program code. The use of the External ROM will increase the storage capacity of the 8051. However some configurations needs to be done by the designer before the external ROM can be activated and also the designer will need to specify the location of the program code, whether on the Internal ROM or external ROM or partially on both of them. RAM The RAM are basically used for the storage of data in the microcontroller. The 8051 is endowed with a 256 byte Internal memory which is divided into two, namely the SFR (special Function Register) and the internal RAM which each have a 128byte capacity.

Basic Features of the 8051


The figure below illustrates the division of the RAM of the 8051 .

Source: 8051 tutorial by Donal Heffernan

Basic Features of the 8051


Basic Features of the 8051
The first 128bytes of the internal Memory is designated as the internal RAM of the microcontroller otherwise called the IRAM . The IRAM is further divided into Register banks, Bit addressable RAM, General Purpose RAM . The organization of the IRAM according to the address range is as follows; Register Banks 00h to 1Fh (80 byte) Bit Addressable RAM 20h to 2Fh (16byte) General Purpose RAM 30h to 7F h(32 byte) The figure below shows the organization of the IRAM of the 8051. (next slide) The second 128byte of the 256byte Internal memory are for the SFR with address range of 80h to FFh . The SFRs are 21 in numbers and are used for specific functions only with each have address range within 80h to FF h . Note : not all the 21 SFR are bit addressable.

MEMORY

6/24/2013

In a summary of the memory features of the 8051, the figure below is used to illustrate memory features.

Input Output Ports of the 8051


The pin outs on the 8051 are basically divided into 4 ports namely ; Port 0 (P0), Port 1(P1), Port 2 (P2), Port 3 (P4). These ports serves the function of input and output to the microcontroller. Each of these ports are 8 bit wide and has special function registers (P0,P1,P2,P3), which are addressable independently. PORT 0 Port 0 has 8 pin out corresponding to its 8bits and pin 32 to pin 39. Labeled as P0.0 to P0.7 in the above figure. This port has a dual function as it may serve as input ,output or even used together. It can also be used as bi-directional low order address and data bus for external memory. The 8051 is an active low IC, meaning that when a pin is to be used as an input a 1 must be written to that port and 0 when to be used as an output.

Input Output Ports of the 8051

The 8051 , just as in the case of the ROM has the capability of accessing up 64KB of RAM for its RAM operations, if the on-chip RAM provision is not enough.

Just as we have mention earlier the 8051 is a 40 pins IC. The figure below shows the pin out of the 8051.

Basic Features of the 8051

Input Output Ports of the 8051


Port 0, can be used as an address or data bus to connect to an external memory. When used as an address bus to an external memory , after the has been formed and latched into external circuit by the address Latch Enable (ALE) Pulse, the bus is turned around to become a data bus, the port (port 0) will now read data from the external memory and must be configured as an input so a logic 1 is automatically written by the internal control logic to all the port 0 latches. PORT 1 Port 1 has 8 pin-outs just like port 0 and pins 1-8 labeled P1.0 to P1.7 Basically port 1 can only be used for input and output functions to and fro external devices only. Hence it has no dual function although it is bidirectional in nature. PORT 2 Port 2 may be used as an input or output port similar to the operations of port 0. it has 8pin-outs corresponding to pins 21-28 and labeled P2.0 to P2.7.

6/24/2013

Input Output Ports of the 8051


This port has a dual function as it may serve as input ,output or even used together. It can also be used as higher order address in conjunction with the port 0 when addressing external peripherals . The latch of the port 2 remains stable when external memory is addressed as they do not have to be turned around for data input just as in the case of port 0. This is because the data bus is 8 bit and can be accessed by the lower order address port of port 0. PORT 3 Port 3 is an input or output port similar to port 1. The port is also bidirectional just as any of the other 3 ports. Basically this port can be used for the input , output functions and also some special functions. Port 3 has 8 pin out corresponding to its 8bits and pin 10 to pin 17. Labeled as P3.0 to P3.7 in the above figure.

Input Output Ports of the 8051


Other alternate functions of highlighted in the table below. port 3 includes the following as

other functions on the 8051


SERIAL PORT: (P3.0,P3.1) The serial Port is a means in which the microcontroller communicates with the outside world. It is called serial because the data bits will be sent in a serial way over a single line. Remember a communication can be could be asynchronous or synchronous in nature. When Synchronous the receiver and send usually shares a clock to know when to read or write. While in Asynchronous transmission no clock signal is required. The 8051 as well as all other microcontrollers utilizes the UART (Universal Asynchronous Receiver Transmitter) for the serial communication. There are two pins available for the serial communication TXD,RXD. Normally TXD is used for transmitting serial data, while the RXD is for the receiving of the serial data

other functions on the 8051


INTERRUPT: Interrupt are mechanism which enables the microcontroller to respond to some events regardless of what its doing at that time. Each interrupt changes the program flow, interrupts it and after executing the interrupt routing it continues from that same point. Interrupt routines are activated by the occurrence of either an external or an internal event. The routine that deals with specific interrupt is called an Interrupt service Routine(ISR). The interrupt allows the 8051 to respond to asynchronous events (external or Internal )only when required. The 8051 has 5 interrupts , 3 internal which can be from the timer (T0,T1), Serial Port (TXD,RXD) And the remaining two is generated external via the INT0 and INT1 pins.

6/24/2013

other functions on the 8051


TIMER: (T0,T1): Some microcontroller application often require the counting of external events such as the frequency of a pulse train. Timer means which can give the delay of particular time between some events. For instance the switching on and off a lighting bulb every 5 sec. This time delay can be achieved either by programming or hardware. The 8051 is embedded with 2 timers to achieve these delay. Two timer pins are available, namely (P3.4) T0 and (P3.5) T1, by these timer we can give the delay of particular if we use these in timer mode. We can count external pulse at these pins if we use these pins in counter mode. These timers are 16-bits, which means can generate delay by 0000h to FFFFh . WR (P3.6) is used to write to the external memory RD(P3.7)- is used to read for the external memory .

other functions on the 8051


So far we have identified the functions of 32 pins of the 40 pins on the 8051 which corresponds to the ports 0,1,2,and 3. So what are the function(s) of the remaining pins. Observed the remaining pins are ; 9,18,19,20,29,30,31 and 40. Pins 29,30,31 are grouped as the Bus control signal pin-outs. Basically they mostly used when external peripherals are interfaced onto the microcontroller. PSEN= (PIN 29) (Program Store Enable) this enables external program- code memory. Usually connected to the external ROM output. ALE(PIN 30) (Address Latch Enable) used for the de-multiplexing the address and data bus when port 0 is used as the data bus and a lowbyte of address bus. EA =(PIN 31) (External Access) this is used to indicate whether an external or internal ROM is used. If set to high indicates internal and a low is used to execute programs from the external. That is why it is connected to ground when using an external Peripherals.

Others pins used in interfacing / connecting external peripherals includes ; P3.6 and P3.7 on port 3. P3.6 WR is used to write to the external memory while the P3.7 RD- is used to read for the external memory . In summary When interfacing an external memory to the 8051, the following pins are used WR, RD, PSEN,EA ,ALE . The figure below shows the 8051 connected to an external memory .

Ports and pins used for external Interface

other functions on the 8051

6/24/2013

Ports and pins used for external Interface

Interfacing with a ROM

Interfacing with a RAM

Ports and pins used for external Interface

Interfacing with a ROM and RAM together

other functions on the 8051


RESET (PIN 9): This is used to reset the 8051. CRYSTALS (PIN 18 , PIN 19 ) : is used to provide the microcontroller the clock which is used to decide its speed and the synchronization of its operations. For this clock signal to be generated it requires crystal oscillators to be connected as shown below in order to generate the required frequency. A frequency range of 1MHZ to 16MHZ is required for the operation of the 8051. Although 12MHZ frequency is mostly used.

other functions on the 8051


GROUND (PIN 20): This is used as the GND and must be connected to the ground. VCC(PIN 40 ) : is used as voltage source, which is +5Volts.

You might also like