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

Microprocessor

The document discusses microprocessors, microcontrollers and the 8051 microcontroller architecture. It describes the basic components of a microprocessor like ALU, accumulator, registers etc. It then explains microcontrollers and provides details about the 8051 microcontroller including its architecture, memory organization, interrupts, pin diagram and applications.

Uploaded by

Channveer Mulge
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Microprocessor

The document discusses microprocessors, microcontrollers and the 8051 microcontroller architecture. It describes the basic components of a microprocessor like ALU, accumulator, registers etc. It then explains microcontrollers and provides details about the 8051 microcontroller including its architecture, memory organization, interrupts, pin diagram and applications.

Uploaded by

Channveer Mulge
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Microprocessor:

• A central processing unit built into a single VLSI chip is called a


microprocessor.
• Operations performed by microprocessor are adding, subtracting, comparing
two numbers and fetching the data from memory for transferring it from one
place to another.
• It is a programmable device that takes in input performs some arithmetic and
logical operations over it and produces the desired output.
• Microprocessor is a digital device on a chip that can fetch instructions from
memory, decode and execute them and give results.

Basic components of microprocessor are:

• Arithmetic and Logic unit (ALU): ALU inside a microprocessor used to perform the
arithmetic and logic operation. It performs the logic operation on the data
stored inside a register.
• Accumulator: It is a register inside which the intermediate arithmetic and logical
operation data is stored.
• Working registers: It is a storage device used to store the data inside a
microprocessor in different address location.
• Program counter: It is used for counting the number of programs executed
inside a microprocessor.
• Stack pointer: Stack pointer act as a pointer to the certain address. It is a register
used to store the address of the last program request made by the processor
inside a stack.
• Clock circuit: It is used for generate the clock pulse required as a reference signal
for the microprocessor.
• Interrupt circuit: It is used for generating the interrupt signal when the higher
priority process required to be served first on basis of priority by
microprocessor.

Microcontroller:
• A microcomputer made on a single semiconductor chip is called single-chip
microcomputer.
• Single chip microcomputers are generally used in control applications, they
are also called microcontrollers.
• Microcontroller contains all essential components of a microcomputer such as
CPU, RAM, ROM/EPROM, I/O lines etc.

8051 Architecture
The 8051 microcontrollers are used for a variety of applications involving limited calculations
and relatively some control strategies.

They are used for industrial and commercial control applications, appliances control,
instrumentation etc.

The 8051 contains Boolean processor, full duplex serial port and power saving circuitry in
addition to essential components such as 8-bit CPU, RAM, ROM/EPROM/OTPROM,
timer/counter and parallel I/O lines.

Block Diagram of 8051 Microcontroller

CPU (Central Processing Unit): CPU act as a mind of any processing machine. It
synchronizes and manages all processes that are carried out in microcontroller. User
has no power to control the functioning of CPU. It interprets the program stored in
ROM and carries out from storage and then performs it projected duty. CPU manage
the different types of registers available in 8051 microcontroller.

Interrupts: Interrupts is a sub-routine call that given by the microcontroller when


some other program with high priority is request for acquiring the system buses the n
interrupts occur in current running program.
Interrupts provide a method to postpone or delay the current process, performs a sub-
routine task and then restart the standard program again.

Types of interrupt in 8051 Microcontroller:

Let's see the five sources of interrupts in 8051 Microcontroller:

o Timer 0 overflow interrupt - TF0


o Timer 1 overflow interrupt - TF1
o External hardware interrupt - INT0
o External hardware interrupt - INT1
o Serial communication interrupt - RI/TI

Memory: For operation Micro-controller required a program. This program guides the
microcontroller to perform the specific tasks. This program installed in microcontroller
required some on chip memory for the storage of the program.

Microcontroller also required memory for storage of data and operands for the short
duration. In microcontroller 8051 there is code or program memory of 4 KB that is it
has 4 KB ROM and it also comprise of data memory (RAM) of 128 bytes.

Bus : Bus is a group of wires which uses as a communication canal or acts as means of
data transfer. The different bus configuration includes 8, 16 or more cables. Therefore,
a bus can bear 8 bits, 16 bits all together.

Types of buses in 8051 Microcontroller:

Let's see the two types of bus used in 8051 microcontrollers:

o Address Bus: 8051 microcontrollers are consisting of 16-bit address bus. It is


generally be used for transferring the data from Central Processing Unit to
Memory.
o Data bus: 8051 microcontroller is consisting of 8 bits data bus. It is generally
be used for transferring the data from one peripherals position to other
peripherals.

Oscillator: As the microcontroller is digital circuit therefore it needs timer for their
operation. To perform timer operation inside microcontroller it required externally
connected or on-chip oscillator. Microcontroller is used inside an embedded system
for managing the function of devices. Therefore, 8051 uses the two 16-bit counters
and timers. For the operation of this timers and counters the oscillator is used inside
microcontroller.
Features of 8051 Microcontroller:

o It having four register banks


o 64K bytes on-chip programmable memory (ROM)
o 128 bytes on-chip data memory (RAM)
o Address bus is 16-bit unidirectional
o Data bus is 8-bit bidirectional
o 128 user defined flags
o 16-bit timers
o 32 general purpose registers each of 8-bit
o 8051 microcontroller offers a number of special features such as ADC, UARTs,
Op-amp, etc.

Applications of 8051 Microcontroller:

1. Energy Management: In energy management system the measuring device is


used for calculating the energy consumption in industrialized and domestic
applications. These systems are manufactured by integrating the
microcontrollers inside their architecture configuration.
2. Automobiles: Microcontroller 8051 is to be used for providing automobile
solutions. They are largely be used in hybrid motor vehicles to control engine
variations.
3. Touch screens: The advanced degree of microcontroller integrate the touch
sensing ability within their design. Transportable devices such as cell phones,
media players and gaming devices are some example of microcontroller
integrated with touch screens.
4. Medical Devices: Microcontroller is used in various medical devices such as
glucose and blood pressure measurement machine for monitoring and
measuring the exact result in real-time computational environment.
Pin Diagram of 8051 Microcontroller:

Brief description of pin configuration

Pins 1-8: These pins belongs to Port 1 of microcontroller. Port 1 is used as domestically
pulled up, quasi bi directional input/output port.

Pin 9: It is a RESET pin which is utilized to set the microcontroller 8051 to its primary
value. During the beginning of an application the RESET pin is to be set elevated for
two machine rotations.

Pins 10-17: These pins belong to Port 3 of microcontroller. Port 3 can be used for
number of functions such as timer input, interrupts, serial communication indicator for
transmitting (TxD) and receiving (RxD). It is also known as domestic pull up port with
quasi bi direction port embedded within.

Pins 18 and 19: These pins are generally be used for interfacing outer crystal oscillator
with given system clock.

Pin 20: This pin titled as Vss. It symbolizes ground voltage or 0 V is connected to this
pin of microcontroller.
Pin 21-28: These pins belong to port 2 of microcontroller. Port 2 can be used as
Input/output port, senior order address bus are multiplexed with this quasi bi
directional port.

Pin 29: This pin belongs to Program Store Enable or PSEN. It is used for interpreting
the sign from outer program memory.

Pin 30: This pin belongs to External Access or EA input is used for permit or prohibits
outer memory interfacing. If there is no outer memory need, this pin is set to high by
linking it with supply voltage .

Pin 31: This pin belongs to Address Latch Enable or ALE is used for de-multiplexing
the address data indication of port 0 for outer memory interfacing.

Pin 32-39: These pins belong to Port 0 of the microcontroller. Port 0 can be used as
input/output port, lower order address and data bus signals are multiplexed with this
port. This pin act as bi directional Input/output port and outer connected pull up
resistors are necessary for utilizing these ports as Input/output.

Pin 40: This pin is used to provide power supply to the circuit.

Embedded System I/O Programming


In 8051 Microcontroller, I/O operations are performed by using four ports and 40 pins.
I/O operation port uses 32 pins with each port has 8 pins. Integrated circuit of
microcontroller:
Q. Three Criteria in choosing a microcontroller:
1. Meeting the computing needs of the task efficiently and cost effectively

i. Speed, the amount of ROM and RAM, number of I/O ports and timers, size
and packaging
ii. Easy to upgrade
iii. Cost per unit

2. Availability of software development tools, debuggers, emulator, simulator,


compilers.

3. Wide availability and reliable sources of microcontrollers.

Q. Explain Internal RAM organization of 8051:


8051 has 128 bytes of internal RAM. It is divided into 3 sections.

1. Register banks
2. Bit/Byte addressable area
3. The general-purpose memory area

Register Banks:

Register bank area has four register banks- Bank 0, Bank 1, Bank2, Bank 3

Each bank has 8 registers. Therefore, there are 32 registers in the register bank area
and each register is of 8-bit. Each bank has register R0 to R7.

RS0 and RS1 bits of program status word register is used to select register bank.

The address of the register bank starts at 00h and ends at 1Fh.

Bit Addressable Area:

Bit addressable area can store or remove 1-bit of data as well as 1-byte data. This
area has total of 128-bit addresses starting from 00h to 07Fh.

They have byte address from 20H to 2FH.

General Purpose Memory Area:

It is used to store any general-purpose data.

The addresses of the general-purpose memory area are from 30H to 7FH

Q. Name the register which doesn’t have RAM address:


DPTR- Data Pointer doesn’t have a physical memory address.

DPH = Data Pointer Higher DPL = Data Pointer Lower


Q. Draw bit format of PSW and explain each bit :

PSW Register in 8051


• The PSW is accessible fully as an 8-bit register, with the address D0H.
• The bit pattern of this flag register is

Parity Bit (P)


• This parity flag bit is used to show the number of 1s in the accumulator only. If
the accumulator register contains an odd number of 1s, then this flag set to 1.
• If accumulator contains even number of 1s, then this flag cleared to 0.

Overflow Flag (OV)


• This flag is set during ALU operations, to indicate overflow in the result. It is
set to 1 if there is a carry out of either the D& bit or the D6 bit of the
accumulator.
• Overflow flag is set when arithmetic operations such as add and subtract
result in sign conflict.
• The conditions under which the OV flag is set are as follows:
1. Positive + Positive = Negative
2. Negative + Negative = Positive
3. Positive – Negative = Negative
4. Negative – Positive = Positive

Register Bank Select Bits (RS1 and RS0)


• These two bits are used to select one of four register banks of RAM.
• These bits are user-programmable. They can be set by the programmer to
point to the correct register banks.
• The register bank selection in the programs can be changed using these two
bits.

General-Purpose Flag (F0)


• This is a user-programmable flag; the user can program and store any bit of
his/her choice in this flag, using the bit address.

Auxiliary Carry Flag (AC)


• It is used in association with BCD arithmetic. This flag is set when there is a
carry out of the D3 bit of the accumulator.

Carry Flag (CY)


• This flag is used to indicate the carry generated after arithmetic operations.
• It can also be used as an accumulator, to store one of the data bits for bit-
related Boolean instructions.
• The 8051 supports bit manipulation instructions.

Q. Name the port which doesn’t have Pull-up resistor:


Q. Explain internal structure of P0, P1, P2 with diagram:

• Pin 1 to Pin 8 (Port 1) –


1. Pin 1 to Pin 8 are assigned to Port 1 for simple I/O operations.
2. They can be configured as input or output pins depending on the logic
control.
3. These pins are also referred to as P1.0 to P1.7
4. These pins are bidirectional pins.
• Pin 9 (RST) –
1. Reset pin. It is an active-high, input pin.
2. Therefore, if the RST pin is high for a minimum of 2 machine cycles, the
microcontroller will reset.
• Pin 10 to Pin 17 (Port 3) –
1. Pin 10 to pin 17 are port 3 pins which are also referred to as P3.0 to P3.7.
2. These pins are similar to port 1 and can be used as universal input or
output pins.
3. These pins are bidirectional pins.
4. These pins also have some additional functions which are as follows:
a) P3.0 (RXD) :
➢ 10th pin is RXD (serial data receive pin) which is for serial
input.
➢ Through this input signal microcontroller receives data for
serial communication.
b) P3.1 (TXD):
➢ 11th pin is TXD (serial data transmit pin) which is serial
output pin.
➢ Through this output signal microcontroller transmits data for
serial communication.
c) P3.2 and P3.3 (INT0′, INT1′):
➢ 12th and 13th pins are for External Hardware Interrupt 0 and
Interrupt 1 respectively.
d) P3.4 and P3.5 (T0 and T1):
➢ 14th and 15th pin are for Timer 0 and Timer 1 external input.
➢ They can be connected with 16-bit timer/counter.
e) P3.6 (WR’):
➢ 16th pin is for external memory write i.e., writing data to the
external memory.
f) P3.7 (RD’):
➢ 17th pin is for external memory read i.e., reading data from
external memory.
• Pin 18 and Pin 19 (XTAL2 And XTAL1) –
1. These pins are connected to an external oscillator which is generally a
quartz crystal oscillator.
2. They are used to provide an external clock frequency of 4MHz to
30MHz.
• Pin 20 (GND) –
1. This pin is connected to the ground.
2. It has to be provided with 0V power supply.
3. Hence it is connected to the negative terminal of the power supply.
• Pin 21 to Pin 28 (Port 2) –
1. Pin 21 to pin 28 are port 2 pins also referred to as P2.0 to P2.7.
2. When additional external memory is interfaced with the 8051
microcontroller, pins of port 2 act as higher-order address bytes.
3. These pins are bidirectional.
• Pin 29 (PSEN) –
1. PSEN stands for Program Store Enable. It is output, active-low pin.
2. This is used to read external memory.
3. In 8031 based system where external ROM holds the program code,
this pin is connected to the OE pin of the ROM.
• Pin 30 (ALE/ PROG) –
1. ALE stands for Address Latch Enable.
2. It is input, active-high pin.
3. This pin is used to distinguish between memory chips when multiple
memory chips are used.
• Pin 31 (EA/ VPP) –
1. EA stands for External Access input.
2. It is used to enable/disable external memory interfacing.
• Pin 32 to Pin 39 (Port 0) –
1. Pin 32 to pin 39 are port 0 pins also referred to as P0.0 to P0.7.
2. They are bidirectional input/output pins.
3. They don’t have any internal pull-ups.
4. Hence, 10 K? pull-up registers are used as external pull-ups.
• Pin 40 (VCC) –
1. This pin provides power supply voltage i.e. +5 Volts to the circuit.

Q. Draw Port 3 pin table and explain:

(Refer the explain of the answer from above Question of Internal Structure)
Q. Name the register which doesn’t have RAM address:
PC- Program Counter doesn’t have RAM address.

Q. What do you mean by Addressing Modes?


Addressing modes is refer to the various methods or techniques used to specify the
memory address or operand for an instruction in a processor's instruction set.

Q. Give examples of Addressing Mode?


1. MOV TCON, R2
2. MOV TCON, 02H
3. MOV TCON, @R0
4. PUSH 02H
5. POP 7Ch
6. MOV TO, #1234h
7. MOV TLO, 34h
8. MOV THO, #12h

You might also like