0% found this document useful (0 votes)
18 views10 pages

Unit 1 Micro

A microcontroller is a compact integrated circuit that includes a processor, memory, and I/O peripherals, designed for specific operations in embedded systems. It is programmable and widely used in various applications such as home appliances, automotive systems, and medical devices. The document also discusses the architecture, types, functionalities, and common issues associated with microcontrollers, particularly focusing on the 8051 microcontroller.

Uploaded by

Tejas Sonawane
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)
18 views10 pages

Unit 1 Micro

A microcontroller is a compact integrated circuit that includes a processor, memory, and I/O peripherals, designed for specific operations in embedded systems. It is programmable and widely used in various applications such as home appliances, automotive systems, and medical devices. The document also discusses the architecture, types, functionalities, and common issues associated with microcontrollers, particularly focusing on the 8051 microcontroller.

Uploaded by

Tejas Sonawane
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/ 10

Introduction :

Def:- A microcontroller is a compact integrated circuit designed to govern a


specific operation in an Embedded system. A typical microcontroller includes
a processor, memory and input/output (I/O) peripherals on a single chip.
A typical microcontroller consists of a processor core, volatile and non-
volatile memory, input/output peripherals, and various communication
interfaces. The processor core is responsible for executing instructions and
controlling the other components of the microcontroller. The memory is used
to store data and program code, while the input/output peripherals are used to
interact with the external environment.
Microcontrollers are programmable, which means that they can be customized
to perform specific tasks. The programming languages used to write code for
microcontrollers vary depending on the manufacturer and the type of
microcontroller. Some of the commonly used programming languages include
C, C++, and assembly language.
Microcontrollers are widely used in embedded systems, such as home
appliances, automotive systems, medical devices, and industrial control
systems. They are also used in consumer electronics products, such as gaming
systems, digital cameras, and audio players.

What are the elements of a microcontroller?


The core elements that make up a microcontroller are the central processing
unit (CPU), memory and I/O peripherals.
CPU
Also known as a processor, a CPU is the brain of the device. It processes and
responds to various instructions that direct the microcontroller's function. This
involves performing basic arithmetic, logic and I/O operations. It also
performs data transfer operations, which communicate commands to other
components in the larger embedded system.
Memory
A microcontroller's memory stores the data that the processor receives and
uses to respond to instructions it's programmed to carry out. A microcontroller
has two main memory types:
Program memory. This stores long-term information about the instructions
that the CPU carries out. Program memory is non-volatile memory, meaning it
stores information over time without needing a power supply.
Data memory. This temporary data storage is used while the instructions are
being executed. Data memory is volatile, meaning the data it holds is
temporary and is only maintained if the device is connected to a power source.
I/O peripherals
The I/O devices are the interface for the processor to the outside world. The
input ports receive information and send it to the processor in the form
of binary data. The processor receives that data and sends the necessary
instructions to output devices, which execute tasks external to the
microcontroller.
Other elements
While the processor, memory and I/O peripherals are the defining elements of
the microprocessor, there are other elements that are frequently included. The
term I/O peripheral refers to a supporting component that interfaces with the
memory and processor. There are many supporting components that can be
classified as peripherals. Having some manifestation of an I/O peripheral is
elemental to a microprocessor because it is the mechanism through which the
processor functions.
Other supporting elements of a microcontroller include the following:
Analog-to-digital converter. An ADC is a circuit that converts analog signals
to digital signals. It lets the processor at the center of the microcontroller
interface with external analog devices, such as sensors.
Digital-to-analog converter. A DAC performs the inverse function of an
ADC, letting the microcontroller's processor communicate its outgoing signals
to external analog components.
System bus. The system bus is the connective wire that links together all
components of the microcontroller.
Serial port. The serial port is one example of an I/O port that enables the
microcontroller to connect to external components. It has a similar function to
a USB or a parallel port but differs in the way it exchanges bits.

How do microcontrollers work?


A microcontroller is embedded inside of a system to control a single function
in a device. It uses its central processor to interpret data it receives from its I/O
peripherals. The information that the microcontroller receives is temporarily
stored in its data memory, where the processor accesses it and uses
instructions stored in its program memory to decipher and apply the incoming
data. It then uses its I/O peripherals to communicate and take the appropriate
action.
For example, a car has many microcontrollers that control various individual
systems, such as the antilock braking system, traction control, fuel injection
and suspension control. Each microcontroller communicates with the others to
inform them of the correct actions. Some might communicate with a more
complex central computer within the car, and others might only communicate
with other microcontrollers. They send and receive data using their I/O
peripherals and process that data to perform their designated tasks.

Working of Microcontroller
The microcontroller chip is a high-speed device, yet it is slow when compared
to a computer. As a result, each command will be executed quickly within the
microcontroller. The quartz oscillator is enabled and through control logic
register once the supply is powered on. Parasite capacitors will be recharged
for a few seconds while the early preparation is taking place. Once the voltage
level reaches its maximum value and the oscillator’s frequency stabilizes, the
operation of writing bits through special function registers becomes stable.
Everything is controlled by the oscillator’s CLK, and the whole electronics
will begin to function. All of this happens in a matter of nanoseconds.

types of Microcontroller:
Here are some of the most common types of microcontrollers:
8-bit Microcontrollers: These are the most basic type of microcontrollers,
typically used in simple applications such as toys, small appliances, and
remote controls. They have a limited processing power and memory capacity,
but they are easy to use and cost-effective.
16-bit Microcontrollers: These are more advanced than 8-bit microcontrollers
and are capable of performing more complex tasks. They are commonly used
in applications such as medical devices, automotive systems, and industrial
control systems.
32-bit Microcontrollers: These are the most powerful and feature-rich
microcontrollers, capable of handling large amounts of data and performing
high-speed processing. They are used in applications such as gaming systems,
multimedia devices, and high-end industrial automation.
ARM Microcontrollers: These microcontrollers are based on the ARM
architecture and are widely used in a variety of applications, including mobile
devices, automotive systems, and industrial control systems.
PIC Microcontrollers: These microcontrollers are manufactured by Microchip
Technology and are commonly used in a wide range of applications, including
home appliances, automotive systems, and medical devices.
AVR Microcontrollers: These microcontrollers are manufactured by Atmel
Corporation and are commonly used in applications such as robotics, industrial
control systems, and consumer electronics.
FPGA-based Microcontrollers: These microcontrollers use field-programmable
gate arrays (FPGAs) to provide highly customizable and flexible processing
capabilities. They are commonly used in applications such as digital signal
processing, video processing, and high-speed networking.
Uses of Microcontroller :
Microcontrollers are used in a wide range of electronic devices and systems,
including:
Home Appliances: Many home appliances, such as washing machines,
refrigerators, and air conditioners, use microcontrollers to perform various
functions, such as temperature control, timing, and monitoring.
Automotive Systems: Microcontrollers are used in automotive systems, such
as engine control units, anti-lock braking systems, and airbag systems, to
control various functions and ensure safe and efficient operation.
Medical Devices: Medical devices, such as insulin pumps, heart monitors, and
blood glucose meters, use microcontrollers to perform various functions and
provide accurate and reliable results.
Industrial Control Systems: Microcontrollers are used in industrial control
systems, such as robotics, process control systems, and manufacturing
equipment, to control and monitor various processes and operations.
Consumer Electronics: Many consumer electronics devices, such as digital
cameras, gaming systems, and audio players, use microcontrollers to perform
various functions and provide advanced features and capabilities.
IoT Devices: Internet of Things (IoT) devices, such as smart home systems,
wearables, and environmental sensors, use microcontrollers to connect to the
internet and perform various functions.
Aerospace and Defense Systems: Microcontrollers are used in aerospace and
defense systems, such as satellites, avionics, and missiles, to control and
monitor various functions and ensure safe and efficient operation.
Issues in Microcontroller :
some of the most common issues that can arise with microcontrollers:
Timing Issues: Microcontrollers rely on precise timing to execute instructions
and perform tasks. Any issues with timing can cause errors and malfunctions,
which can be difficult to diagnose and fix.
Power Issues: Microcontrollers require a stable and consistent power supply to
operate correctly. Any fluctuations or disruptions in the power supply can
cause the microcontroller to malfunction or fail.
Heat Issues: Microcontrollers generate heat during operation, and excessive
heat can damage the device or cause it to malfunction. Heat issues can be
caused by poor design, inadequate cooling, or high ambient temperatures.
Noise Issues: Microcontrollers can be affected by electromagnetic interference
(EMI) and radio frequency interference (RFI) from other electronic devices,
which can cause errors and malfunctions.
Code Issues: The programming code used to control the microcontroller can
contain errors and bugs, which can cause the device to malfunction or fail.
Security Issues: Microcontrollers can be vulnerable to security breaches,
including unauthorized access, data theft, and malware attacks.
Compatibility Issues: Microcontrollers may not be compatible with other
electronic components or devices, which can cause errors and malfunctions.

Feature Microcontroller (µC) Microprocessor (µP)


Designed for Designed for general-
Purpose specific embedded purpose computing
system applications applications
Single-chip computer system CPU with minimal on-
with on-board memory, board memory,
Architecture
peripherals, and I/O peripherals, and I/O
interfaces interfaces
Integration level Highly integrated Less integrated
System architecture Single-chip system CPU + support chips
Processing power Lower power Higher power
Instruction set Fixed instruction set More flexible
On-board memory On-chip memory No on-board memory
Input/Output (I/O) More I/O ports Fewer I/O ports
Peripheral devices On-board peripherals External peripherals
Cost Lower cost Higher cost
Power consumption Lower power Higher power
Applications Embedded systems General-purpose
Integrated development Standard development
environment (IDE) provided tools and languages
Development by manufacturers, with such as C, C++, and
specialized programming assembly
languages and tools
Higher clock speed,
Lower clock speed, typically
Clock speed typically greater than 1
less than 100 MHz
GHz
It uses Von Neumann
Architecture It uses Harvard Architecture.
Architecture.
8051 Microcontroller :-

The 8051 microcontroller is a very popular 8-bit microcontroller introduced by


Intel in the year 1981 and it has become almost the academic standard now a
days. The 8051 is based on an 8-bit CISC core with Harvard architecture. Its
8-bit architecture is optimized for control applications with extensive Boolean
processing. It is available as a 40-pin DIP chip and works at +5 Volts DC

The architecture of the 8051 microcontroller can be understood from the block diagram.

It has Harward architecture with RISC (Reduced Instruction Set Computer)


concept. The block diagram of 8051 microcontroller is shown.
It consists of: an 8-bit ALU ,one 8-bit PSW (Program Status Register) ,A and
B registers ,one 16-bit Program counter , one 16-bit Data Pointer Register
(DPTR) ,128 bytes of RAM and 4kB of ROM and four parallel I/O ports each
of 8-bit width .
Arithmetic Logic Unit (ALU)
8-bit ALU can perform all the 8-bit arithmetic and logical operations in one
machine cycle .The ALU is associated with two registers A & B which are
special function registers which hold the results of many arithmetic and logical
operations.
A Register:- It is also called the Accumulator and as it’s name suggests, it is
used as a general register to accumulate the results of a large number of
instructions. By default it is used for all mathematical operations and also data
transfer operations between CPU and any external memory.
B Register :- It is mainly used for multiplication (MUL AB) and division (
DIV AB) operations along with A register. It has no other function other than
as a location where data may be stored.
The R registers :-The "R" registers are a set of eight registers that are named
R0, R1 up to and R7. These registers are used as auxiliary registers in many
operations. These registers are also used to temporarily store values.
Program Counter (PC) :-16-bit program counter It always points to the
address of the next instruction to be executed. After execution of one
instruction the program counter is incremented to point to the address of the
next instruction to be executed. Contents of PC are placed on address bus to
find and fetch the desired instruction. Since the PC is 16-bit width, 8051 can
access program addresses from 0000H to FFFFH, a total of 6kB of code.
Stack Pointer Register (SP) :-8-bit register which stores the address of stack
top. i.e the Stack Pointer is used to indicate where the next value to be
removed from the stack should be taken from. It is also used intrinsically
whenever an interrupt is triggered. Stack
The register used to access the stack is called the Stack Pointer which is an 8-
bit register. So,it can take values of 000 to FFF H.
Data Pointer Register (DPTR) It is a 16-bit register which is the only user-
accessible. As the name suggests, DPTR is used to point to data. It is used by
a number of commands which allow the 8051 to access external memory.
When the 8051 accesses external memory it will access external memory at
the address indicated by DPTR. DPTR can also be used as two 8-registers
DPH and DPL.
Program Status Register (PSW) The 8051 has a 8-bit PSW register which is
also known as Flag register. In the 8-bit register only 6-bits are used by 8051.
Two unused bits are user definable bits. In the 6-bits four of them are
conditional flags. They are Carry - CY, Auxiliary Carry - AC, Parity - P and
Overflow - OV. These flag bits indicate some conditions that resulted after an
instruction was executed.
Salient Features of 8051
1. 4 KB on chip program memory (ROM or EPROM)
2. 128 bytes on chip data memory (RAM)
3. 8-bit data bus
4. 16-bit address bus
5. 32 general purpose registers each of 8 bits
6. Two - 16 bit timers T0 and T1
7. Five Interrupts (3 internal and 2 external)
8. Four Parallel ports each of 8-bits (PORT0, PORT1, PORT2, PORT3) with a
total of 32 I/O lines
9. One 16-bit program counter and One 16-bit DPTR (data pointer)
10. One 8-bit stack pointer
11. One Microsecond instruction cycle with 12 MHz Crystal
12. One full duplex serial communication port
 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.
Stack Pointer Register (SP) :-8-bit register which stores the address of stack
top. i.e the Stack Pointer is used to indicate where the next value to be
removed from the stack should be taken from. When a value is pushed onto the
stack, the 8051 first increments the value of SP and then stores the value at the
resulting memory location. Similarly when a value is popped off the stack, the
8051 returns the value from the memory location indicated by SP, and then
decrements the value of SP. Since the SP is only 8-bit wide it is incremented
or decremented by two. SP is modified directly by six instructions: PUSH,
POP, ACALL, LCALL, RET, and RETI.
It is also used intrinsically whenever an interrupt is triggered. Stack
The CPU needs this storage area as there is only limited number of registers.
It is a part of RAM used by the CPU to store information temporarily. This
information may be either data or address.
The register used to access the stack is called the Stack Pointer which is an 8-
bit register. So,it can take values of 000 to FFF H.
When the 8051 is powered up, the SP register contains the value 07. It means
the RAM location value 08 is the first location being used for the stack by the
8051 controller.
There are two important instructions to handle this stack.
1. PUSH: The loading of data from CPU registers to the stack is done by
PUSH
2. POP: The loading of contents of the stack back into aCPU register is done
by POP
In the above instructions the contents of the Registers R6 and R1 are moved to
stack and they occupy the 08 and 09 locations of the stack. Now the contents
of the SP are incremented by two and it is 0A.
Similarly POP 3 instruction pops the contents of stack into R3 register. Now
the contents of the SP is decremented by 1.
In 8051 the RAM locations 08 to 1F (24 bytes) can be used for the Stack.
In any program if we need more than 24 bytes of stack, we can change the SP
point to RAM locations 30 - 7F H.
This can be done with the instruction MOV SP , # XX.

You might also like