0% found this document useful (0 votes)
6 views

MICROCONTROLLERS NOTES

Microcontrollers are compact and cost-effective microcomputers designed for specific tasks in embedded systems, consisting of a processor, memory, and peripherals. They are categorized by bit configuration (8-bit, 16-bit, 32-bit), memory type (external or embedded), and instruction set (CISC or RISC), and are widely used in devices like temperature sensors and fire alarms. The document also details the architecture of the 8051 microcontroller, its pin configuration, and the functionality of various ports and registers.

Uploaded by

Kamande Kimani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

MICROCONTROLLERS NOTES

Microcontrollers are compact and cost-effective microcomputers designed for specific tasks in embedded systems, consisting of a processor, memory, and peripherals. They are categorized by bit configuration (8-bit, 16-bit, 32-bit), memory type (external or embedded), and instruction set (CISC or RISC), and are widely used in devices like temperature sensors and fire alarms. The document also details the architecture of the 8051 microcontroller, its pin configuration, and the functionality of various ports and registers.

Uploaded by

Kamande Kimani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

MICROCONTROLLERS

A microcontroller is a small and low-cost microcomputer, which is designed to perform the


specific tasks of embedded systems like displaying microwave’s information, receiving remote
signals, etc.
The general microcontroller consists of the processor, the memory (RAM, ROM, EPROM), Serial
ports, peripherals (timers, counters), etc.

Difference between Microprocessor and Microcontroller

The following table highlights the differences between a microprocessor and a microcontroller −

Types of Microcontrollers

Microcontrollers are divided into various categories based on memory, architecture, bits and
instruction sets.
Following is the list of their types −
Bit
Based on bit configuration, the microcontroller is further divided into three categories.
8-bit microcontroller − This type of microcontroller is used to execute arithmetic and

logical operations like addition, subtraction, multiplication division, etc. For example, Intel
8031 and 8051 are 8 bits microcontroller.
 16-bit microcontroller − This type of microcontroller is used to perform arithmetic and
logical operations where higher accuracy and performance is required. For example, Intel
8096 is a 16-bit microcontroller.
 32-bit microcontroller − This type of microcontroller is generally used in automatically
controlled appliances like automatic operational machines, medical appliances, etc.
Memory
Based on the memory configuration, the microcontroller is further divided into two categories.
 External memory microcontroller − This type of microcontroller is designed in such a
way that they do not have a program memory on the chip. Hence, it is named as external
memory microcontroller. For example: Intel 8031 microcontroller.
 Embedded memory microcontroller − This type of microcontroller is designed in such a
way that the microcontroller has all programs and data memory, counters and timers,
interrupts, I/O ports are embedded on the chip. For example: Intel 8051 microcontroller.
Instruction Set
Based on the instruction set configuration, the microcontroller is further divided into two
categories.
 CISC − CISC stands for complex instruction set computer. It allows the user to insert a
single instruction as an alternative to many simple instructions.
 RISC − RISC stands for Reduced Instruction Set Computers. It reduces the operational
time by shortening the clock cycle per instruction.

Applications of Microcontrollers

Microcontrollers are widely used in various different devices such as −


 Light sensing and controlling devices like LED.
 Temperature sensing and controlling devices like microwave oven, chimneys.
 Fire detection and safety devices like Fire alarm.
 Measuring devices like Volt Meter.

Microcontrollers - 8051 Architecture

8051 microcontrollers are designed by Intel in 1981. It is an 8-bit microcontroller. It is built with
40 pins DIP (dual inline package), 4kb of ROM storage and 128 bytes of RAM storage, 2 16-bit
timers. It consists of are four parallel 8-bit ports, which are programmable as well as addressable
as per the requirement. An on-chip crystal oscillator is integrated in the microcontroller having
crystal frequency of 12 MHz.
Let us now discuss the architecture of 8051 Microcontroller.
In the following diagram, the system bus connects all the support devices to the CPU. The system
bus consists of an 8-bit data bus, a 16-bit address bus and bus control signals. All other devices
like program memory, ports, data memory, serial interface, interrupt control, timers, and the CPU
are all interfaced together through the system bus.
The pin diagram of 8051 microcontroller looks as follows –
 Pins 1 to 8 − These pins are known as Port 1. This port doesn’t serve any other functions.
It is internally pulled up, bi-directional I/O port.
 Pin 9 − It is a RESET pin, which is used to reset the microcontroller to its initial values.
 Pins 10 to 17 − These pins are known as Port 3. This port serves some functions like
interrupts, timer input, control signals, serial communication signals RxD and TxD, etc.
 Pins 18 & 19 − These pins are used for interfacing an external crystal to get the system
clock.
 Pin 20 − This pin provides the power supply to the circuit.
 Pins 21 to 28 − These pins are known as Port 2. It serves as I/O port. Higher order address
bus signals are also multiplexed using this port.
 Pin 29 − This is PSEN pin which stands for Program Store Enable. It is used to read a signal
from the external program memory.
 Pin 30 − This is EA pin which stands for External Access input. It is used to enable/disable
the external memory interfacing.
 Pin 31 − This is ALE pin which stands for Address Latch Enable. It is used to demultiplex
the address-data signal of port.
 Pins 32 to 39 − These pins are known as Port 0. It serves as I/O port. Lower order address
and data bus signals are multiplexed using this port.
 Pin 40 − This pin is used to provide power supply to the circuit.
8051 microcontrollers have 4 I/O ports each of 8-bit, which can be configured as input or output.
Hence, total 32 input/output pins allow the microcontroller to be connected with the peripheral
devices.
 Pin configuration, i.e. the pin can be configured as 1 for input and 0 for output as per the
logic state.
o Input/Output (I/O) pin − All the circuits within the microcontroller must be
connected to one of its pins except P0 port because it does not have pull-up resistors
built-in.
o Input pin − Logic 1 is applied to a bit of the P register. The output FE transistor is
turned off and the other pin remains connected to the power supply voltage over a
pull-up resistor of high resistance.
 Port 0 − The P0 (zero) port is characterized by two functions −
o When the external memory is used then the lower address byte (addresses A0A7) is
applied on it, else all bits of this port are configured as input/output.
o When P0 port is configured as an output then other ports consisting of pins with
built-in pull-up resistor connected by its end to 5V power supply, the pins of this
port have this resistor left out.
Input Configuration
If any pin of this port is configured as an input, then it acts as if it “floats”, i.e. the input has
unlimited input resistance and in-determined potential.
Output Configuration
When the pin is configured as an output, then it acts as an “open drain”. By applying logic 0 to a
port bit, the appropriate pin will be connected to ground (0V), and applying logic 1, the external
output will keep on “floating”.
In order to apply logic 1 (5V) on this output pin, it is necessary to build an external pullup resistor.
Port 1
P1 is a true I/O port as it doesn’t have any alternative functions as in P0, but this port can be
configured as general I/O only. It has a built-in pull-up resistor and is completely compatible with
TTL circuits.
Port 2
P2 is similar to P0 when the external memory is used. Pins of this port occupy addresses intended
for the external memory chip. This port can be used for higher address byte with addresses A8-
A15. When no memory is added then this port can be used as a general input/output port similar
to Port 1.
Port 3
In this port, functions are similar to other ports except that the logic 1 must be applied to
appropriate bit of the P3 register.

Pins Current Limitations

 When pins are configured as an output (i.e. logic 0), then the single port pins can receive a
current of 10mA.
 When these pins are configured as inputs (i.e. logic 1), then built-in pull-up resistors provide
very weak current, but can activate up to 4 TTL inputs of LS series.
 If all 8 bits of a port are active, then the total current must be limited to 15mA (port P0:
26mA).
 If all ports (32 bits) are active, then the total maximum current must be limited to 71mA.
 Interrupts are the events that temporarily suspend the main program, pass the control to the
external sources and execute their task. It then passes the control to the main program where
it had left off.
 8051 has 5 interrupt signals, i.e. INT0, TFO, INT1, TF1, RI/TI. Each interrupt can be
enabled or disabled by setting bits of the IE register and the whole interrupt system can be
disabled by clearing the EA bit of the same register.
 IE (Interrupt Enable) Register
 This register is responsible for enabling and disabling the interrupt. EA register is set to
one for enabling interrupts and set to 0 for disabling the interrupts. Its bit sequence and
their meanings are shown in the following figure.
IP (Interrupt Priority) Register

We can change the priority levels of the interrupts by changing the corresponding bit in the
Interrupt Priority (IP) register as shown in the following figure.
 A low priority interrupt can only be interrupted by the high priority interrupt, but not
interrupted by another low priority interrupt.
 If two interrupts of different priority levels are received simultaneously, the request of
higher priority level is served.
 If the requests of the same priority levels are received simultaneously, then the internal
polling sequence determines which request is to be serviced.

TCON Register
TCON register specifies the type of external interrupt to the microcontroller.
8255A - Programmable Peripheral Interface
The 8255A is a general purpose programmable I/O device designed to transfer the data from I/O
to interrupt I/O under certain conditions as required. It can be used with almost any
microprocessor.
It consists of three 8-bit bidirectional I/O ports (24I/O lines) which can be configured as per the
requirement.

Ports of 8255A

8255A has three ports, i.e., PORT A, PORT B, and PORT C.


 Port A contains one 8-bit output latch/buffer and one 8-bit input buffer.
 Port B is similar to PORT A.
 Port C can be split into two parts, i.e. PORT C lower (PC0-PC3) and PORT C upper (PC7-
PC4) by the control word.
These three ports are further divided into two groups, i.e. Group A includes PORT A and upper
PORT C. Group B includes PORT B and lower PORT C. These two groups can be programmed
in three different modes, i.e. the first mode is named as mode 0, the second mode is named as
Mode 1 and the third mode is named as Mode 2.

Operating Modes

8255A has three different operating modes −


 Mode 0 − In this mode, Port A and B is used as two 8-bit ports and Port C as two 4-bit
ports. Each port can be programmed in either input mode or output mode where outputs are
latched and inputs are not latched. Ports do not have interrupt capability.
 Mode 1 − In this mode, Port A and B is used as 8-bit I/O ports. They can be configured as
either input or output ports. Each port uses three lines from port C as handshake signals.
Inputs and outputs are latched.
 Mode 2 − In this mode, Port A can be configured as the bidirectional port and Port B either
in Mode 0 or Mode 1. Port A uses five signals from Port C as handshake signals for data
transfer. The remaining three signals from Port C can be used either as simple I/O or as
handshake for port B.

Features of 8255A

The prominent features of 8255A are as follows −


 It consists of 3 8-bit IO ports i.e. PA, PB, and PC.
 Address/data bus must be externally demux'd.
 It is TTL compatible.
 It has improved DC driving capability.

8255 Architecture
The following figure shows the architecture of 8255A −

Intel 8255A - Pin Description


Let us first take a look at the pin diagram of Intel 8255A −

Now let us discuss the functional description of the pins in 8255A.

Data Bus Buffer


It is a tri-state 8-bit buffer, which is used to interface the microprocessor to the system data bus.
Data is transmitted or received by the buffer as per the instructions by the CPU. Control words and
status information is also transferred using this bus.

Read/Write Control Logic

This block is responsible for controlling the internal/external transfer of data/control/status word.
It accepts the input from the CPU address and control buses, and in turn issues command to both
the control groups.

CS

It stands for Chip Select. A LOW on this input selects the chip and enables the communication
between the 8255A and the CPU. It is connected to the decoded address, and A0 & A1 are
connected to the microprocessor address lines.
Their result depends on the following conditions −

WR

It stands for write. This control signal enables the write operation. When this signal goes low, the
microprocessor writes into a selected I/O port or control register.

RESET

This is an active high signal. It clears the control register and sets all ports in the input mode.

RD

It stands for Read. This control signal enables the Read operation. When the signal is low, the
microprocessor reads the data from the selected I/O port of the 8255.

A0 and A1
These input signals work with RD, WR, and one of the control signal. Following is the table
showing their various signals with their result.

Intel 8253 - Programmable Interval Timer


The Intel 8253 and 8254 are Programmable Interval Timers (PTIs) designed for microprocessors
to perform timing and counting functions using three 16-bit registers. Each counter has 2 input
pins, i.e. Clock & Gate, and 1 pin for “OUT” output. To operate a counter, a 16-bit count is loaded
in its register. On command, it begins to decrement the count until it reaches 0, then it generates a
pulse that can be used to interrupt the CPU.

Difference between 8253 and 8254

The following table differentiates the features of 8253 and 8254 −

Features of 8253 / 54

The most prominent features of 8253/54 are as follows −


 It has three independent 16-bit down counters.
 It can handle inputs from DC to 10 MHz.
 These three counters can be programmed for either binary or BCD count.
 It is compatible with almost all microprocessors.
 8254 has a powerful command called READ BACK command, which allows the user to
check the count value, the programmed mode, the current mode, and the current status of
the counter.

8254 Architecture

The architecture of 8254 looks as follows −

8254 Pin Description

Here is the pin diagram of 8254 −


In the above figure, there are three counters, a data bus buffer, Read/Write control logic, and a
control register. Each counter has two input signals - CLOCK & GATE, and one output signal -
OUT.
Data Bus Buffer
It is a tri-state, bi-directional, 8-bit buffer, which is used to interface the 8253/54 to the system data
bus. It has three basic functions −

 Programming the modes of 8253/54.


 Loading the count registers.
 Reading the count values.
Read/Write Logic
It includes 5 signals, i.e. RD, WR, CS, and the address lines A0 & A1. In the peripheral I/O mode,
the RD and WR signals are connected to IOR and IOW, respectively. In the memorymapped I/O
mode, these are connected to MEMR and MEMW.
Address lines A0 & A1 of the CPU are connected to lines A0 and A1 of the 8253/54, and CS is tied
to a decoded address. The control word register and counters are selected according to the signals
on lines A0 & A1.
Control Word Register
This register is accessed when lines A0 & A1 are at logic 1. It is used to write a command word,
which specifies the counter to be used, its mode, and either a read or write operation. Following
table shows the result for various control inputs.

You might also like