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

What is an Embedded System ?

An embedded system is an
Unit 1: electrical/electro mechanical system

It is a combination of specialized
hardware and firmware (software)
• Processing unit
• I/O subsystem
• On-board and external
Components: communication interfaces
• External systems
• Other supervisory systems and
support units
Microprocessor Microcontroller
A silicon chip representing a central processing unit (CPU), A microcontroller is a highly integrated chip that contains a
which is capable of performing arithmetic as well as logical CPU, scratchpad RAM, special and general purpose register
operations according to a predefined set of instructions arrays, on chip ROM/FLASH memory for program storage, timer
and interrupt control units and dedicated I/O ports

It is a dependent unit. It requires the combination of other


It is a self-contained unit and it doesn’t require external
chips like timers, program and data memory chips, interrupt
interrupt controller, timer, UART, etc. for its functioning
controllers, etc. for functioning
Most of the time general purpose in design and operation Mostly application-oriented or domain-specific
Doesn’t contain a built in I/O port. The I/O port functionality Most of the processors contain multiple built-in I/O ports
needs to be implemented with the help of external program which can be operated as a single 8 or 16 or 32 bit port or
mable peripheral interface chips like 8255 as individual port pins
Targeted for embedded market where performance is not so
Targeted for high end market where performance is important
critical (At present this demarcation is invalid)
Limited power saving options compared to microcontrollers Includes lot of power saving features
Factors need to be considered while
selecting a microcontroller for an
embedded design
• Selection of a microcontroller for any application depends on
some design factors. A good designer finalizes his selection
based on a comparative study of the design factors.
• The important factors to be considered in the selection
process of a microcontroller are
• Feature Set
• Speed of Operation
• Code Memory Space
• Data Memory Space
• Development Support
• Availability
• Power Consumption
• Cost
• Feature Set
The important queries related to the
feature set are:
• Does the microcontroller support all the
Factors to peripherals required by the application, say
serial interface, parallel interface, etc.?
be • Does it satisfy the general I/O port
requirements by the application?
considered • Does the controller support sufficient number
of timers and counters?
• Does the controller support built-in ADC/DAC
hardware in case of signal processing
applications?
• Does the controller provide the required
performance?
• Speed of Operation
• The number of clocks required per
Factors to instruction cycle and the maximum
operating clock frequency supported by
be the processor greatly affects the speed
of operation of the controller.
considered • The speed of operation of the
controller is usually expressed in terms
of Million Instructions Per Second
(MIPS)
• Code Memory Space
• If the target processor/controller application is
written in C or any other high level language,
factors to does the controller support sufficient code
memory space to hold the compiled hex code
be (In case of controllers with internal code
memory)?
considered • Data Memory Space
• Does the controller support sufficient internal
data memory (on chip RAM) to hold run time
variables and data structures?
• Development Support
• Does the controller manufacture provide cost-
effective development tools?
factors to • Does the manufacture provide product
samples for prototyping and sample
be development stuffs to alleviate the
development pains?
considered • Does the controller support third party
development tools?
• Does the manufacture provide technical
support if necessary?
• Availability
• Since the product is entirely dependent on the
Factors to controller, the product development time and
time to market the product solely depends on
be its availability.
• By technical terms it is referred to as Lead
considered time.
• Lead time is the time elapsed between the
purchase order approval and the supply of the
product
• Power Consumption
• The power consumption of the controller
should be minimal.
• It is a crucial factor since high power
requirement leads to bulky power supply
designs.
factors to • The high power dissipation also demands for
cooling fans and it will make the overall system
be messy and expensive.
• Controllers should support idle and power
down modes of operation to reduce power
considered consumption.
• Cost
• The cost should be within the reachable limit of
the end user and the targeted user should not
be high tech.
• Remember the ultimate aim of a product is to
gain marginal benefit.
Microcontroller
vs. General
Purpose
Microprocessor
OVERVIEW OF
8051 FAMILY
:8051
Microcontroller
8051 Family
PIN
DESCRIPTION
XTAL1 and
XTAL2
XTAL1 and
XTAL2
XTAL1 and
XTAL2
RST
RST
𝐸𝐴
𝑃𝑆𝐸𝑁 and ALE
I/O Port Pins
Port 0
Port 0
Port 1 and 2
Port 3
FLAG BITS AND PSW REGISTER
• The program status word (PSW) register, also referred
to as the flag register, is an 8 bit register
• Only 6 bits are used
• These four are CY (carry), AC (auxiliary carry), P (parity), and OV
(overflow)
• They are called conditional flags, meaning that they indicate
some conditions that resulted after an instruction was executed
• The PSW3 and PSW4 are designed as RS0 and RS1, and are
used to change the bank
• The two unused bits are user-definable
FLAG BITS AND PSW REGISTER
CY AC --- RS1 RS0 OV -- P

CY PSW.7 Carry flag.


AC PSW.6 Auxiliary carry flag.
RS1 RS0 Register Address
-- PSW.5 Available to the user for general purpose Bank
RS1 PSW.4 Register Bank selector bit 1. 0 0 0 00H-07H
RS0 PSW.3 Register Bank selector bit 0. 0 1 1 08H-0FH
OV PSW.2 Overflow flag. 1 0 2 10H-17H
-- PSW.1 User definable bit. 1 1 3 18H-1FH
P PSW.0 Parity flag. Set/cleared by hardware each instruction
cycle to indicate an odd/even number of 1 bits in the
accumulator
Instruction CY OV AC

FLAG BITS AND PSW REGISTER ADD X X X


ADDC X X X
SUBB X X X
• Instructions that affect flag bits MUL 0 X
DIV 0 X
DA X
RRC X
RLC X
SETB C 1
CLR C 0
CPL C X
ANL C, bit X
ORL C,BIT X
MOV C,BIT X
CJNE X
FLAG BITS AND PSW REGISTER
• Show the status of the CY, AC and P flag after the addition of 38H
and 2FH in the following instructions

MOV A, #38H
ADD A, #2FH ;after the addition A=67H,
REGISTER BANKS AND STACK
• There are 128 bytes of RAM in the 8051
• Assigned addresses 00 to 7FH
• The 128 bytes are divided into three different groups as
follows:
✓A total of 32 bytes from locations 00H to 1FH are set aside for
register banks and the stack
✓A total of 16 bytes from locations 20H to 2FH are set aside for bit-
addressable read/write memory
✓A total of 80 bytes from locations 30H to 7FH are used for read
and write storage, called scratch pad
8051
REGISTER
BANKS AND
STACK
8051 REGISTER BANKS AND STACK
• These 32 bytes are divided into 4 banks of registers in which
each bank has 8 registers, R0-R7
• RAM location from 0 to 7 are set aside for bank 0 of R0-R7 where
R0 is RAM location 0, R1 is RAM location 1, R2 is RAM location 2,
and so on, until memory location 7 which belongs to R7 of bank 0
• It is much easier to refer to these RAM locations with names such
as R0, R1, and so on, than by their memory locations
• Register bank 0 is the default when 8051 is powered up
8051
REGISTER
BANKS AND
STACK
8051 REGISTER BANKS AND STACK
8051
REGISTER
BANKS AND
STACK

You might also like