0% found this document useful (0 votes)
2 views43 pages

Module 5 Microcotroller

Uploaded by

arpithagowdan91
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)
2 views43 pages

Module 5 Microcotroller

Uploaded by

arpithagowdan91
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

INTERFACING

LCD Interfacing:

LCD is finding widespread use replacing LEDs for the following reasons:

The declining prices of LCD


The ability to display numbers, characters, and graphics
Incorporation of a refreshing controller into the LCD, thereby relieving the CPU of the task of refreshing
the LCD
Ease of programming for characters and graphics

Pin Description:
LCD timing diagram for reading and writing is as shown in figure 14 and 15.

Figure 14: LCD timing for read

Figure 15: LCD timing for write

Figure 16: 8051 Connection to LCD


Program:
ORG 0000H
MOV A,#38H ;INIT. LCD 2 LINES, 5X7 MATRIX
ACALL COMNWRT ;call command subroutine
ACALL DELAY ;give LCD some time
MOV A,#0EH ;display on, cursor on
ACALL COMNWRT ;call command subroutine
ACALL DELAY ;give LCD some time
MOV A,#01 ;clear LCD
ACALL COMNWRT ;call command subroutine
ACALL DELAY ;give LCD some time
MOV A,#06H ;shift cursor right
ACALL COMNWRT ;call command subroutine
ACALL DELAY ;give LCD some time
MOV A,#86H ;cursor at line 1, pos. 6
ACALL COMNWRT ;call command subroutine
ACALL DELAY ;give LCD some time

Y ;display letter Y
ACALL DATAWRT ;call display subroutine
ACALL DELAY ;give LCD some time
E ;display letter E
ACALL DATAWRT ;call display subroutine
ACALL DELAY ;give LCD some time
S ;display letter S
ACALL DATAWRT ;call display subroutine
AGAIN: SJMP AGAIN ;stay here

COMNWRT: ;send command to LCD


MOV P1,A ;copy reg A to port 1
CLR P2.0 ;RS=0 for command
CLR P2.1 ;R/W=0 for write
SETB P2.2 ;E=1 for high pulse
ACALL DELAY ;give LCD some time
CLR P2.2 ;E=0 for H-to-L pulse
RET
DATAWRT: ;write data to LCD
MOV P1,A ;copy reg A to port 1
SETB P2.0 ;RS=1 for data
CLR P2.1 ;R/W=0 for write
SETB P2.2 ;E=1 for high pulse
ACALL DELAY ;give LCD some time
CLR P2.2 ;E=0 for H-to-L pulse
RET
DELAY:
MOV R3,#50 ;50 or higher for fast CPUs
HERE2: MOV R4,#255 ;R4 = 255
HERE: DJNZ R4,HERE ;stay until R4 becomes 0
DJNZ R3,HERE2
RET
END
Keyboard Interfacing:

Keyboards are organized in a matrix of rows and columns. The CPU accesses both rows and columns through
ports. Therefore, with two 8-bit ports, an 8 x 8 matrix of keys can be connected to a microprocessor. When a
key is pressed, a row and a column make a contact. Otherwise, there is no connection between rows and
columns. A 4x4 matrix connected to two ports. The rows are connected to an output port and the columns are
connected to an input port.

Scanning and Identifying the Key:

Figure 17: A 4X4 matrix keyboard

It is the function of the microcontroller to scan the keyboard continuously to detect and identify the key pressed

To detect a pressed key, the microcontroller grounds all rows by providing 0 to the output latch, then it
reads the columns
If the data read from columns is D3 D0 =1111, no key has been pressed and the process continues till
key press is detected
If one of the column bits has a zero, this means that a key press has occurred For example, if D3 D0 =
1101, this means that a key in the D1 column has been pressed After detecting a key press,
microcontroller will go through the process of identifying the key
Starting with the top row, the microcontroller grounds it by providing a low to row D0 only. It reads the
columns, if the data read is all 1s, no key in that row is activated and the process is moved to the next
row
It grounds the next row, reads the columns, and checks for any zero. This process continues until the
row is identified.
After identification of the row in which the key has been pressed. Find out which column the pressed
key belongs to
Algorithm for detection and identification of key activation goes through the following stages:

1. To make sure that the preceding key has been released, 0s are output to all rows at once, and the columns are
read and checked repeatedly until all the columns are high

When all columns are found to be high, the program waits for a short amount of time before it goes to
the next stage of waiting for a key to be pressed

2. To see if any key is pressed, the columns are scanned over and over in an infinite loop until one of them has a
0 on it

Remember that the output latches connected to rows still have their initial zeros (provided in stage 1),
making them grounded
After the key press detection, it waits 20 ms for the bounce and then scans the columns again

(a) It ensures that the first key press detection was not an erroneous one due a spike noise

(b) The key press. If after the 20-ms delay the key is still pressed, it goes back into the loop to detect a
real key press

3. To detect which row key press belongs to, it grounds one row at a time, reading the columns each time

If it finds that all columns are high, this means that the key press cannot belong to that row. Therefore, it
grounds the next row and continues until it finds the row the key press belongs to
Upon finding the row that the key press belongs to, it sets up the starting address for the look-up table
holding the scan codes (or ASCII) for that row

4. To identify the key press, it rotates the column bits, one bit at a time, into the carry flag and checks to see if it
is low

Upon finding the zero, it pulls out the ASCII code for that key from the look-up table
otherwise, it increments the pointer to point to the next element of the look-up table

The flowchart for the above algorithm is as shown below:


Stepper Motor Interfacing:

Stepper motor is a widely used device that translates electrical pulses into mechanical movement. Stepper motor
is used in applications such as; disk drives, dot matrix printer, robotics etc,. The construction of the motor is as
shown in figure 1 below.

Figure 1: Structure of stepper motor

It has a permanent magnet rotor called the shaft which is surrounded by a stator. Commonly used stepper
motors have four stator windings that are paired with a center tapped common. Such motors are called as four-
phase or unipolar stepper motor.

The stator is a magnet over which the electric coil is wound. One end of the coil are connected commonly either
to ground or +5V. The other end is provided with a fixed sequence such that the motor rotates in a particular
direction. Stepper motor shaft moves in a fixed repeatable increment, which allows one to move it to a precise
position. Direction of the rotation is dictated by the stator poles. Stator poles are determined by the current sent
through the wire coils.

Step angle:
Step angle is defined as the minimum degree of rotation with a single step.
No of steps per revolution = 360° / step angle
Steps per second = (rpm x steps per revolution) / 60
Example: step angle = 2°

No of steps per revolution = 180

Switching Sequence of Motor:


As discussed earlier the coils need to be energized for the rotation. This can be done by sending a bits sequence
to one end of the coil while the other end is commonly connected. The bit sequence sent can make either one
phase ON or two phase ON for a full step sequence or it can be a combination of one and two phase ON for half
step sequence. Both are tabulated below.
Full Step:

Two Phase ON

One Phase ON

Half Step (8 sequence):

The sequence is tabulated as below:

8051 Connection to Stepper Motor: (explanation of the diagram can be done)

Figure 2: 8051 interfaces to stepper motor


DC Motor Interfacing with 8051:
Microcontrollers 10ES42
The DC motor is another widely used device that translates electrical pulses into mechanical movement. Motor
has 2 leads +ve and ve , connecting them to a DC voltage supply moves the motor in one direction. On
reversing the polarity rotates the motor in the reverse direction. Basic difference between Stepper and DC motor
is stepper motor moves in steps while DC motor moves continuously. Another difference is with stepper motor
the number of steps can be counted while it is not possible in DC motor. Maximum speed of a DC motor is
indicated in rpm. The rpm is either with no load it is few thousands to tens of thousands or with load rpm
decreases with increase in load.

Voltage and current rating : Nominal voltage is the voltage for a motor under normal condition. It ranges from
1V to 150V. As voltage increases, rpm goes up. Current rating is the current consumption when the nominal
voltage is applied with no load that is 25mA to a few amperes. As load increases, rpm increases, unless voltage
or current increases implies torque increases. With fixed voltage, as load increases, power consumption of a DC
motor is increased.

Unidirectional Control:

Figure 3 shows the rotation of the DC motor in clockwise and anticlockwise direction.

Figure 3: DC motor rotation

Bidirectional Control:

(a) Motor not running (b) Clockwise direction

SJBIT/ECE Page 70

(c) Counter clockwise direction (d) Invalid state (short circuit)

Figure 4: H-Bridge Motor Configuration


Figure 4 shows the H-Bridge motor configuration. It consists of four switches and based on the closing and
opening of these switches the motor either rotates in clockwise or anti-clockwise direction.

As seen in figure 4a, all the switches are open hence the motor is not running. In b, turning of the motor is in
one direction when the switches 1 and 4 are closed that is clockwise direction.

Similarly, in c the switches 2 and 3 are closed so the motor rotates in anticlockwise direction, while in figure 4d
all the switches are closed which indicates a invalid state or a short circuit.

Pulse Width Modulation (PWM):

The speed of the motor depends on 3 parameters: load, voltage and current. For a given load, we can maintain a
steady speed by using PWM. By changing the width of the pulse applied to DC motor, power provided can
either be increased or decreased. Though voltage has fixed amplitude, has a variable duty cycle. The wider the
pulse, higher the speed obtained. One of the reasons as to why dc motor are referred over ac is, the ability to
control the speed of the DC motor using PWM. The speed of the ac motor is dictated by the ac frequency of
voltage applied to the motor and is generally fixed. Hence, speed of the AC motors cannot be controlled when
load is increased.

Figure 5 below shows the pulse width modulation comparison.

Figure 5: PWM comparison

Digital-to-Analog (DAC) converter:

The DAC is a device widely used to convert digital pulses to analog signals. In this section we will discuss the
basics of interfacing a DAC to 8051.

The two method of creating a DAC is binary weighted and R/2R ladder.

The Binary Weighted DAC, which contains one resistor or current source for each bit of the DAC connected to
a summing point. These precise voltages or currents sum to the correct output value. This is one of the fastest
conversion methods but suffers from poor accuracy because of the high precision required for each individual
voltage or current. Such high-precision resistors and current-sources are expensive, so this type of converter is
usually limited to 8-bit resolution or less.

The R-2R ladder DAC, which is a binary weighted DAC that uses a repeating cascaded structure of resistor
values R and 2R. This improves the precision due to the relative ease of producing equal valued matched

resistors (or current sources). However, wide converters perform slowly due to increasingly large RC-constants
for each added R-2R link.

The first criterion for judging a DAC is its resolution, which is a function of the number of binary inputs. The
common ones are 8, 10, and 12 bits. The number of data bit inputs decides the resolution of the DAC since the
number of analog output levels is equal to 2n, where n is the number of data bit inputs.
DAC0808:

The digital inputs are converter to current Iout, and by connecting a resistor to the Iout pin, we can convert the
result to voltage. The total current Iout is a function of the binary numbers at the D0-D7 inputs of the DAC0808
and the reference current Iref , and is as follows:

Usually reference current is 2mA. Ideally we connect the output pin to a resistor, convert this current to
voltage, and monitor the output on the scope. But this can cause inaccuracy; hence an opamp is used to convert
the output current to voltage. The 8051 connection to DAC0808 is as shown in the figure 6 below.

Figure 6: 8051 connections to DAC0808


Analog-to-digital converter (ADC) interfacing:

ADCs (analog-to-digital converters) are among the most widely used devices for data acquisition. A physical
quantity, like temperature, pressure, humidity, and velocity, etc., is converted to electrical (voltage, current)
signals using a device called a transducer, or sensor. We need an analog-to-digital converter to translate the
analog signals to digital numbers, so microcontroller can read them.

ADC804 chip:

ADC804 IC is an analog-to-digital converter. It works with +5 volts and has a resolution of 8 bits. Conversion
time is another major factor in judging an ADC. Conversion time is defined as the time it takes the ADC to
convert the analog input to a digital (binary) number. In ADC804 conversion time varies depending on the
clocking signals applied to CLK R and CLK IN .

Pin Description of ADC804:

Figure 7: Pin out of ADC0804

CLK IN and CLK R: CLK IN is an input pin connected to an external clock source. To use the internal
clock generator (also called self-clocking), CLK IN and CLK R pins are connected to a capacitor and a
resistor and the clock frequency is determined by:
Typical values are R = 10K ohms and C =150pF. We get f = 606 kHz and the conversion time .
Vref/2 : It is used for the reference voltage. If this pin is open (not connected), the analog input voltage is
in the range of 0 to 5 volts (the same as the Vcc pin). If the analog input range needs to be 0 to 4 volts,
Vref/2 is connected to 2 volts. Step size is the smallest change can be discerned by an ADC

Vref/2 Relation to Vin Range

D0-D7: The digital data output pins. These are tri-state buffered. The converted data is accessed only when
CS =0 and RD is forced low. To calculate the output voltage, use the following formula

Dout = digital data output (in decimal),


Vin = analog voltage, and
step size (resolution) is the smallest change
Analog ground and digital ground: Analog ground is connected to the ground of the analog Vin and
digital ground is connected to the ground of the Vcc pin. To isolate the analog Vin signal from transient
voltages caused by digital switching of the output D0 D7. This contributes to the accuracy of the
digital data output.
Vin(+) & Vin(-): Differential analog inputs where Vin = Vin (+) Vin (-). Vin (-) is connected to ground
and Vin (+) is used as the analog input to be converted.
RD: -to-low RD pulse is used to get the 8-bit converted data out of ADC804.
INTR:
converted data is ready to be picked up.
WR: -to-high transition, ADC804 starts converting the
analog input value of Vin to an 8- bit digital number.
CS: It is an active low input used to activate ADC804.

The following steps must be followed for data conversion by the ADC804 chip:

1. Make CS= 0 and send a L-to-H pulse to pin WR to start conversion.


2. Monitor the INTR pin, if high keep polling but if low, conversion is complete, go to next step.
3. Make CS= 0 and send a H-to-L pulse to pin RD to get the data out

Figure 8 shows the read and write timing for ADC804. Figure 9 and 10 shows the self clocking with the RC
component for frequency and the external frequency connected to XTAL2 of 8051.
Microcontrollers 10ES42

Figure 8: Read and Write timing for ADC0804

Figure 9: 8051 Connection to ADC0804 with Self-clocking

below.(Figure 12 can be referred from the text prescribed.)

Figure 10: 8051 Connection to ADC0804 with Clock from XTAL2 of 8051

Now let us see how we write assembly as well as C program for the interfacing diagram shown in figure 10.
ADC0808/0809 chip:
ADC808 has 8 analog inputs. It allows us to monitor up to 8 different transducers using only single chip. The
chip has 8-bit data output just like the ADC804. The 8 analog input channels are multiplexed and selected
according to the values given to the three address pins, A, B, and C. that is; if CBA=000, CH0 is selected;
CBA=011, CH3 is selected and so on. The pin details of ADC0808 are as shown in the figure 11 below.
(Explanation can be done as is with ADC0804).
Figure 11: Pin out of ADC0808

Steps to Program ADC0808/0809

1. Select an analog channel by providing bits to A, B, and C addresses.


2. Activate the ALE pin. It needs an L-to-H pulse to latch in the address.
3. Activate SC (start conversion) by an H-to-L pulse to initiate conversion.
4. Monitor EOC (end of conversion) to see whether conversion is finished.
5. Activate OE (output enable) to read data out of the ADC chip. An H-to-L pulse to the OE pin will bring
digital data out of the chip.
What is Embedded System?
An embedded system is a combination of 3 types of components: a. Hardware b. Software
c. Mechanical Components and it is supposed to do one specific task only.
Or
An Electronic/Electro mechanical system which is designed to perform a specific function
and is a combination of both hardware and firmware (Software)

E.g. Electronic Toys, Mobile Handsets, Washing Machines, Air Conditioners, Automotive
Control Units, Set Top Box, DVD Player etc…

Embedded System & General-Purpose Computing system

 The Embedded System and the General-purpose computing system are at two extremes.
 The embedded system is designed to perform a specific task whereas as per definition
the general-purpose computer is meant for general use. It can be used for playing
games, watching movies, creating software, work on documents or spreadsheets etc.
 Following are certain specific points that differentiates between embedded systems
and general-purpose computers:
Classification of Embedded Systems

It is possible to have classifications for embedded systems, based on different criteria.


Some of the criteria used in the classification of embedded systems are:

 Complexity & performance requirements

 Based on generation
 Based on deterministic behavior
 Based on triggering
Based on generation

First Generation:
 The early embedded systems built around 8bit microprocessors like 8085 and Z80 and
4bit microcontrollers.
 Examples: Digital telephone keypads.

Second Generation:
 Embedded Systems built around 16 bit microprocessors and 8 or 16bit
microcontrollers, following the first generation embedded systems.
 Examples: SCADA systems

Third Generation:
 Embedded Systems built around high performance 16/32
bit Microprocessors/controllers.
 Application Specific Instruction set processors like Digital Signal Processors (DSPs),
and Application Specific Integrated Circuits (ASICs).
 Examples: Robotics, Media, etc.

Fourth Generation:
 Embedded Systems built around System on Chips (SoCs), Re configurable processors
and multicore processors.
 Highly complex & very powerful.
 Examples: Smart P
Based on Complexity & performance requirements

Small-scale:

 Simple in application need


 Performance not time-critical.
 Built around low performance& low cost 8 or 16 bit µp/µc. Example: an
electronic toy

Medium-scale
 Slightly complex in hardware & firmware requirement.
 Built around medium performance & low cost 16 or 32 bit µp/µc.
 Usually contain operating system.
 Examples: Industrial machines
Large-scale:
 Highly complex hardware & firmware.
 Built around 32 or 64 bit RISC µp/µc or PLDs or Multicore-Processors.
 Response is time-critic

Based on deterministic behaviour


This classification is applicable for “Real Time” systems.
 The task execution behaviour for an embedded system may be deterministic or
non- deterministic.
 Based on execution behaviour Real Time embedded systems are divided into
Hard and Soft.
Based on triggering
Embedded systems which are “Reactive” in nature can be classify based on triggering.
Reactive systems can be:
 Event triggered
 Time triggered
Application Area of Embedded System

We are living in a world where embedded systems play a vital role in our day-to-day life,
starting from home to the computer industry, where most of the people found their job for a
livelihood.

The application areas and the products in the embedded domain are countless. A few of the
important domains and products are listed below:

1. Consumer Electronics: Camcorders, Cameras.


2. Household appliances: Washing machine, Refrigerator.
3. Automotive industry: Anti-lock breaking system(ABS), engine control.
4. Home automation & security systems: Air conditioners, sprinklers, fire alarms.
5. Telecom: Cellular phones, telephone switches.
6. Computer peripherals: Printers, scanners.
7. Computer networking systems: Network routers and switches.
8. Healthcare: EEG, ECG machines.
9. Banking & Retail: Automatic teller machines, point of sales.
10. Card Readers: Barcode, smart card readers.

Purpose of Embedded System

Each Embedded Systems is designed to serve the purpose of any one or a combination of the
following tasks.

1. Data Collection/Storage/Representation
2. Data Communication
3. Data (Signal) Processing
4. Monitoring
5. Control
6. Application Specific User Interface
Data Collection/Storage/Representation

 Embedded system designed for the purpose of data collection performs acquisition of
data from the external world.
 Data collection is usually done for storage, analysis, manipulation and transmission.
 Data can be analog or digital.
 Embedded systems with analog data capturing techniques collect data directly in the
form of analog signal whereas embedded systems with digital data collection
mechanism converts the analog signal to the digital signal using analog to digital
converters.
 If the data is digital it can be directly captured by digital embedded system.
 A digital camera is a typical example of an embedded System with data
collection/storage/representation of data.
 Images are captured and the captured image may be stored within the memory of the
camera. The captured image can also be presented to the user through a graphic LCD
unit.
Data communication
 Embedded data communication systems are deployed in applications from complex
 satellite communication to simple home networking systems.
 The transmission of data is achieved either by a wire-lin medium or by a wire-less
 medium. Data can either be transmitted by analog means or by digital means.
 Wireless modules-Bluetooth, Wi-Fi.
 Wire-line modules-USB, TCP/IP.
 Network hubs, routers, switches are examples of dedicated data transmission
 embedded systems.

Data signal processing


 Embedded systems with signal processing functionalities are employed in
applications demanding signal processing like speech coding, audio video codec,
transmission applications etc.
 A digital hearing aid is a typical example of an embedded system employing
data processing. Digital hearing aid improves the hearing capacity of hearing
impaired person.

Monitoring
 All embedded products coming under the medical domain are with monitoring
functions. Electro cardiogram machine is intended to do the monitoring of the
heartbeat of a patient but it cannot impose control over the heartbeat.
 Other examples with monitoring function are digital CRO, digital multi-meters,
and logic analysers.
Control
 Embedded systems with control functionalities are used for imposing control over
some variables according to the changes in input variables.
 A system with control functionality contains both sensors and actuators
 Sensors are connected to the input port for capturing the changes in environmental
variable and the actuators connected to the output port are controlled according to
the changes in the input variable.
 Air conditioner system used to control the room temperature to a specified limit is a
typical example for control purpose.

Application specific user interface


 Embedded systems which are designed for a specific application
 Buttons, switches, keypad, lights, bells, display units etc. are application specific
user interfaces.
 Mobile phone, Control units in industry applications are example of application
specific user interface.
 In mobile phone the user interface is provided through the keypad, system
speaker, vibration alert etc.
‘Smart’ running shoes from Adidas – The Innovative bonding of Life Style with Embedded
Technology

 Shoe developed by Adidas, which constantly adapts its shock-absorbing


characteristics to customize its value to the individual runner, depending on
running style, pace, body weight, and running surface
 It contains sensors, actuators and a microprocessor unit which runs the
algorithm for adapting the shock-absorbing characteristics of the shoe
 A ‘Hall effect sensor’ placed at the top of the “cushioning element” senses the
compression and passes it to the Microprocessor

 A micro motor actuator controls the cushioning as per the commands from the
MPU, based on the compression sensed by the ‘Hall effect sensor’
Embedded systems are basically designed to regulate a physical variable (such Microwave
Oven) or to manipulate the state of some devices by sending some signals to the actuators or
devices connected to the output port system (such as temperature in Air Conditioner), in
response to the input signal provided by the end users or sensors which are connected to the
input ports. Hence the embedded systems can be viewed as a reactive system.

The control is achieved by processing the information coming from the sensors and user
interfaces and controlling some actuators that regulate the physical variable. Keyboards,
push button, switches, etc. are Examples of common user interface input devices and LEDs,
LCDs, Piezoelectric buzzers, etc examples for common user interface output devices
for a typical
embedded system. The requirement of type of user interface changes from application to
application based on domain.

Some embedded systems do not require any manual intervention for their operation. They
automatically sense the input parameters from real world through sensors which are
connected at input port. The sensor information is passed to the processor after signal
conditioning and digitization. The core of the system performs some predefined operations
on input data with the help of embedded firmware in the system and sends some actuating
signals to the actuator connect connected to the output port of the system.

The memory of the system is responsible for holding the code (control algorithm and other
important configuration details). There are two types of memories are used in any embedded
system. Fixed memory (ROM) is used for storing code or program. The user cannot change
the firmware in this type of memory. The most common types of memories used in embedded
systems for control algorithm storage are OTP, PROM, UVEPROM, EEPROM and FLASH.
An embedded system without code (i.e. the control algorithm) implemented memory has all
the peripherals but is not capable of making decisions depending on the situational as well as
real world changes.

Memory for implementing the code may be present on the processor or may be implemented
as a separate chip interfacing the processor. In a controller based embedded system, the
controller may contain internal memory for storing code such controllers are called Micro-
controllers with on- chip ROM, eg. Atmel AT89C51.

Core of Embedded Systems

The core of the embedded system falls into any one of the following categories.

1. General Purpose and Domain Specific Processors


1.1. Microprocessors
1.2. Microcontrollers
1.3. Digital Signal Processors
2. Programmable Logic Devices (PLDs)
3. Application Specific Integrated Circuits (ASICs)
4. Commercial off the shelf Components (COTS)
General Purpose and Domain Specific Processors

 Almost 80% of the embedded systems are processor/ controller based.


 The processor may be microprocessor or a microcontroller or digital signal
processor, depending on the domain and application.

Microprocessor:

 A silicon chip representing a Central Processing Unit (CPU), which is capable of


performing arithmetic as well as logical operations according to a pre-defined set of
Instructions, which is specific to the manufacturer.
 In general the CPU contains the Arithmetic and Logic Unit (ALU), Control Unit and
Working registers Microprocessor is a dependent unit and it requires the combination
of other hardware like Memory, Timer Unit, and Interrupt Controller etc for proper
functioning.

 Intel claims the credit for developing the first Microprocessor unit Intel 4004, a 4
bit processor which was released in Nov 1971
 Developers of microprocessors.
Intel – Intel 4004 – November 1971(4-bit)
Intel – Intel 4040.
Intel – Intel 8008 – April 1972.
Intel – Intel 8080 – April 1974(8-bit).
Motorola – Motorola 6800.
Intel – Intel 8085 – 1976.
Zilog - Z80 – July 1976

General Purpose Processor (GPP) Vs Application Specific Instruction Set Processor


(ASIP)
 General Purpose Processor or GPP is a processor designed for general computational
tasks
 GPPs are produced in large volumes and targeting the general market. Due to the
high volume production, the per unit cost for a chip is low compared to ASIC or other
other specific Ics
 A typical general purpose processor contains an Arithmetic and Logic Unit (ALU)
and Control Unit (CU)
 Application Specific Instruction Set processors (ASIPs) are processors with
architecture and instruction set optimized to specific domain/application
requirements like Network processing, Automotive, Telecom, media applications,
digital signal processing, control applications etc.
 ASIPs fill the architectural spectrum between General Purpose Processors and
Application Specific Integrated Circuits (ASICs).
 The need for an ASIP arises when the traditional general purpose processor are
unable to meet the increasing application needs.
 Some Microcontrollers (like Automotive AVR, USB AVR from Atmel), System on
Chips, Digital Signal Processors etc are examples of Application Specific Instruction
Set Processors (ASIPs)
 ASIPs incorporate a processor and on-chip peripherals, demanded by the application
requirement, program and data memory

Microcontroller:

 A highly integrated silicon chip containing a CPU, scratch pad RAM, Special and
General- purpose Register Arrays, On Chip ROM/FLASH memory for program
storage, Timer and Interrupt control units and dedicated I/O ports
 Microcontrollers can be considered as a super set of Microprocessors
 Microcontroller can be general purpose (like Intel 8051, designed for generic
applications and domains) or application specific (Like Automotive AVR from
Atmel Corporation. Designed specifically for automotive applications)
 Since a microcontroller contains all the necessary functional blocks for independent
working, they found greater place in the embedded domain in place of
microprocessors
 Microcontrollers are cheap, cost effective and are readily available in the market
 Texas Instruments TMS 1000 is considered as the world’s first microcontroller
Microprocessor Vs Microcontroller

Digital Signal Processors

 DSP are powerful special purpose 8/16/32 bit microprocessor designed to meet
the computational demands and power constraints of today’s embedded audio,
video and communication applications. DSP are 2 to 3 times faster than general
purpose microprocessors in signal processing applications.
 This is because of the architectural difference between DSP and general
purpose microprocessors.
 DSPs implement algorithms in hardware which speeds up the execution whereas
general purpose processor implement the algorithm in software and the speed of
execution depends primarily on the clock for the processors.
 DSP includes following key units:
i. Program memory: It is a memory for storing the program required by DSP to process the
data. ii. Data memory: It is a working memory for storing temporary variables and data/signal
to be processed. iii. Computational engine: It performs the signal processing in accordance
with the stored program memory computational engine incorporated many specialized
arithmetic units and each of them operates simultaneously to increase the execution speed. It
also includes multiple hardware
shifting operands and saves execution time. iv. I/O unit: It acts as an interface between the
outside world and DSP. It is responsible for capturing signals to be processed and delivering the
processed [Link] for
 Examples: Audio video signal processing, telecommunication and multimedia
applications. SOP(Sum of Products) calculation, convolution, FFT(Fast Fourier
Transform), DFT(Discrete Fourier Transform), etc are some of the operation
performed by DSP.

RISC Vs CISC Processors/Controllers


Harvard V/s Von-Neumann Processor/Controller Architecture

 Microprocessors/controllers based on the Von-Neumann architecture shares a single


common bus for fetching both instructions and data. Program instructions and data
are stored in a common main memory
 Microprocessors/controllers based on the Harvard architecture will have separate
data bus and instruction bus. This allows the data transfer and program fetching to
occur simultaneously on both buses
 With Harvard architecture, the data memory can be read and written while the
program memory is being accessed. These separated data memory and code memory
buses allow one instruction to execute while the next instruction is fetched (“Pre-
fetching”)

Program
Memory

Single shared Bus


Big-endian V/s Little-endian processors:

 Endianness specifies the order in which the data is stored in the memory by
processor operations in a multi byte system (Processors whose word size is greater
than one byte). Suppose the word length is two byte then data can be stored in
memory in two different ways

 Higher order of data byte at the higher memory and lower order of data byte
at location just below the higher memory
 Lower order of data byte at the higher memory and higher order of data byte
at location just below the higher memory

 Little-endian means the lower-order byte of the data is stored in memory at the
lowest address, and the higher-order byte at the highest address. (The little end
comes first)
 Big-endian means the higher-order byte of the data is stored in memory at the lowest
address, and the lower-order byte at the highest address. (The big end comes first.)
Load Store Operation & Instruction Pipelining:

 The RISC processor instruction set is orthogonal and it operates on registers. The
memory access related operations are performed by the special instructions load and
store. If the operand is specified as memory location, the content of it is loaded to a
register using the load instruction.
 The instruction store stores data from a specified register to a specified memory location

R1 R2 R3
1 3 3 1
load R1, x
2
x 00 load R2, y
3
y 7F ALU 3 add R3, R1, R2 4
z 23
store R3, z

 The conventional instruction execution by the processor follows the Fetch-


Decode- Execute sequence
 During the decode operation the memory address bus is available and it is
possible to effectively utilize it for an instruction fetch, the processing speed can
be increased
 In its simplest form instruction pipelining refers to the overlapped
execution of instructions

Clock Pulses Clock Pulses Clock Pulses

Machine Cycle 1 Machine Cycle 2 Machine Cycle 3


Fetch (PC)

DEPT OF ECE, AIT TUMKUR


Execute (PC - 1) Fetch (PC+1)
Execute (PC) Fetch (PC+2)
PC : Program Counter Execute (PC+1)

The Single stage pipelining concept

Application Specific Integrated Circuit (ASIC):

 A microchip designed to perform a specific or unique application. It is used as


replacement to conventional general purpose logic chips.
 ASIC integrates several functions into a single chip and thereby reduces the system
development cost
 Most of the ASICs are proprietary products. As a single chip, ASIC consumes very
small area in the total system and thereby helps in the design of smaller systems with
high capabilities/functionalities

 ASICs can be pre-fabricated for a special application or it can be custom fabricated


by using the components from a re-usable „building block‟ library of components for
a particular customer application
 Fabrication of ASICs requires a non-refundable initial investment (Non Recurring
Engineering (NRE) charges) for the process technology and configuration expenses
 If the Non-Recurring Engineering Charges (NRE) is born by a third party and the
Application Specific Integrated Circuit (ASIC) is made openly available in the
market, the ASIC is referred as Application Specific Standard Product (ASSP)
 The ASSP is marketed to multiple customers just as a general-purpose product , but
to a smaller number of customers since it is for a specific application.

DEPT OF ECE, AIT TUMKUR


Programmable Logic Devices (PLDs)

 Logic devices provide specific functions, including device-to-device interfacing, data


communication, signal processing, data display, timing and control operations, and
almost every other function a system must perform.
 Logic devices can be classified into two broad categories - Fixed and Programmable.
The circuits in a fixed logic device are permanent, they perform one function or set of
functions
- once manufactured, they cannot be changed
 Programmable logic devices (PLDs) offer customers a wide range of logic capacity,
features, speed, and voltage characteristics - and these devices can be re-configured
to perform any number of functions at any time
 Designers can use inexpensive software tools to quickly develop, simulate, and test
their logic designs in PLD based design. The design can be quickly programmed into
a device, and immediately tested in a live circuit
 PLDs are based on re-writable memory technology and the device is reprogrammed
to change the design
 Two major types of programmable logic devices

Field Programmable Gate Arrays (FPGAs) and


Complex Programmable Logic Devices (CPLDs)

FPGAs:

 FPGAs offer the highest amount of logic density, the most features, and the highest
performance.
 These advanced FPGA devices also offer features such as built-in hardwired
processors (such as the IBM Power PC), substantial amounts of memory, clock
management systems, and support for many of the latest, very fast device-to-device
signaling technologies
 FPGAs are used in a wide variety of applications ranging from data processing and
storage, to instrumentation, telecommunications, and digital signal processing

CPLDs:

DEPT OF ECE, AIT TUMKUR


 CPLDs, by contrast, offer much smaller amounts of logic - up to about 10,000 gates
 CPLDs offer very predictable timing characteristics and are therefore ideal for
critical control applications
 CPLDs such as the Xilinx CoolRunner series also require extremely low amounts of
power and are very inexpensive, making them ideal for cost-sensitive, battery-
operated, portable applications such as mobile phones and digital handheld assistants

Commercial off the Shelf Component (COTS)

 A Commercial off-the-shelf (COTS) product is one which is used ‘as-is’.


 COTS products are designed in such a way to provide easy integration and
interoperability with existing system components
 Typical examples for the COTS hardware unit are Remote Controlled Toy Car control
unit including the RF Circuitry part, High performance, high frequency microwave
electronics (2 to 200 GHz), High bandwidth analog-to-digital converters, Devices
and components for operation at very high temperatures, Electro-optic IR imaging
arrays, UV/IR Detectors etc.
 A COTS component in turn contains a GPP / ASIP / ASIC / ASSP / PLD
 Advantages: Readily available in the market, cheap and cuts down development time

Memory

 Memory is an important part of an embedded system. The memory used in


embedded system can be either
1. Program Storage Memory (ROM)
2. Data memory (RAM)
 Certain Embedded processors/controllers contain built in program memory and
data memory and this memory is known as on-chip memory

DEPT OF ECE, AIT TUMKUR


Program Storage Memory

 Stores the program instructions (CODE)


 Retains its contents even after the power to it is turned off. It is generally
known as Nonvolatile storage memory
 Depending on the fabrication, erasing and programming techniques they are classified into

Masked ROM (MROM)


 One-time programmable memory. Uses hardwired technology for storing data. The
device is factory programmed by masking and metallization process according to the
data provided by the end user
 The primary advantage of MROM is low cost for high volume production. They are
the least expensive type of solid-state memory
 Different mechanisms are used for the masking process of the ROM, like

 Creation of an enhancement or depletion mode transistor through channel implant


 By creating the memory cell either using a standard transistor or a high
threshold transistor. In the high threshold mode, the supply voltage required to
turn ON the transistor is above the normal ROM IC operating voltage. This
ensures that the transistor is always off and the memory cell stores always
logic 0.
 The limitation with MROM based firmware storage is the inability to modify the device
firmware against firmware upgrades.
PROM / OTP
 Unlike MROM it is not pre-programmed by the manufacturer
 PROM/OTP has nichrome or polysilicon wires arranged in a matrix, these wires
can be functionally viewed as fuses
 It is programmed by a PROM programmer which selectively burns the fuses
according to the bit pattern to be stored
 Fuses which are not blown/burned represents a logic “1” where as fuses which are
blown/burned represents a logic “0”. The default state is logic “1”
 OTP is widely used for commercial production of embedded systems whose proto-
typed versions are proven and the code is finalized
 It is a low-cost solution for commercial production.
 OTPs cannot be reprogrammed

EPROM
 Erasable Programmable Read Only (EPROM) memory gives the flexibility to re-
program the same chip
 EPROM stores the bit information by charging the floating gate of an FET
 Bit information is stored by using an EPROM Programmer, which applies high
voltage to charge the floating gate
 EPROM contains a quartz crystal window for erasing the stored information. If
the window is exposed to Ultra violet rays for a fixed duration, the entire
memory will be erased
 Even though the EPROM chip is flexible in terms of re-programmability, it needs
to be taken out of the circuit board and needs to be put in a UV eraser device for
20 to 30 minutes

EEPROM

 Erasable Programmable Read Only (EPROM) memory gives the flexibility to re-
program the same chip using electrical signals
 The information contained in the EEPROM memory can be altered by using
electrical signals at the register/Byte level
 They can be erased and reprogrammed within the circuit
 These chips include a chip erase mode and in this mode they can be erased in a
few milliseconds
 It provides greater flexibility for system design
 The only limitation is their capacity is limited when compared with the standard
ROM (A few kilobytes).

FLASH
 FLASH memory is a variation of EEPROM technology
 It combines the re-programmability of EEPROM and the high capacity of standard ROMs
 FLASH memory is organized as sectors (blocks) or pages
 FLASH memory stores information in an array of floating gate MOSFET transistors
 The erasing of memory can be done at sector level or page level without affecting the
other sectors or pages
 Each sector/page should be erased before re-programming

Read-Write Memory/Random Access Memory (RAM)

 RAM is the data memory or working memory of the controller/processor


 RAM is volatile, meaning when the power is turned off, all the contents are destroyed
 RAM is a direct access memory, meaning we can access the desired memory
location directly without the need for traversing through the entire memory locations
to reach the desired memory position (i.e. Random Access of memory location)



Static RAM (SRAM)

 Static RAM stores data in the form of Voltage. They are made up of flip-flops
 In typical implementation, an SRAM cell (bit) is realized using 6 transistors (or 6
MOSFETs). Four of the transistors are used for building the latch (flip-flop) part of
the memory cell and 2 for controlling the access.
 Static RAM is the fastest form of RAM available. SRAM is fast in operation due to

its resistive networking and switching capabilities

Dynamic RAM (DRAM)

 Dynamic RAM stores data in the form of charge. They are made up of MOS
transistor gates
 The advantages of DRAM are its high density and low cost compared to SRAM
 The disadvantage is that since the information is stored as charge it gets leaked off
with time and to prevent this, they need to be refreshed periodically
 Special circuits called DRAM controllers are used for the refreshing operation.
The refresh operation is done periodically in milliseconds inter

+
-
Non Volatile RAM (NVRAM)
 Random access memory with battery backup
 It contains Static RAM based memory and a minute battery for providing supply to
the memory in the absence of external power supply
 The memory and battery are packed together in a single package
 NVRAM is used for the non volatile storage of results of operations or for setting up
of flags etc
 The life span of NVRAM is expected to be around 10 years
 DS1744 from Maxim/Dallas is an example for 32KB NVRAM

 Memory selection for Embedded Systems: Selection of suitable memory is very much
essential step-in high-performance applications, because the challenges and
limitations of the system performance are often decided upon the type of memory
architecture.
 Systems memory requirement depend primarily on the nature of the application that
is planned to run on the system.
 Memory performance and capacity requirement for low cost systems are small,
whereas memory throughput can be the most critical requirement in a complex, high
performance system.
 Following are the factors that are to be considered while selecting the memory devices,
• Speed
• Data storage size and capacity
• Bus width
• Power consumption
• Cost
Sensors & Actuators:

 Embedded system is in constant interaction with the real world


 Controlling/monitoring functions executed by the embedded system is achieved
in accordance with the changes happening to the Real World.
 The changes in the system environment or variables are detected by the sensors
connected to the input port of the embedded system.
 If the embedded system is designed for any controlling purpose, the system will
produce some changes in controlling variable to bring the controlled variable to the
desired value.
 It is achieved through an actuator connected to the out port of the embedded system.

Sensor:
 A transducer device which converts energy from one form to another for any
measurement or control purpose. Sensors acts as input device Eg. Hall Effect Sensor
which measures the distance between the cushion and magnet in the Smart Running
shoes from adidas
 Example: IR, humidity , PIR(passive infra red) , ultrasonic , piezoelectric , smoke sensors

Actuator:
 A form of transducer device (mechanical or electrical) which converts
signals to corresponding physical action (motion).
 Actuator acts as an output device
 Example: Micro motor actuator which adjusts the position of the cushioning element
in the Smart Running shoes from adidas.

The I/O Subsystem:

 The I/O subsystem of the embedded system facilitates the interaction of the
embedded system with external world
 The interaction happens through the sensors and actuators connected to the Input and
output ports respectively of the embedded system
 The sensors may not be directly interfaced to the Input ports, instead they may be
interfaced through signal conditioning and translating systems like ADC.
I/O Devices - Light Emitting Diode (LED):

 LED is a p-n junction diode and contains a CATHODE and ANODE For
functioning the anode is connected to +ve end of power supply and cathode is
connected to –ve end of power supply.
 The maximum current flowing through the LED is limited by connecting a
RESISTOR in series between the power supply and LED as shown in the figure
below

There are two ways to interface an LED to a microprocessor/microcontroller:

 The Anode of LED is connected to the port pin and cathode to Ground : In this
approach the port pin sources the current to the LED when it is at logic high(ie. 1).
 The Cathode of LED is connected to the port pin and Anode to Vcc : In this
approach the port pin sources the current to the LED when it is at logic high (ie. 1).
Here the port pin sinks the current and the LED is turned ON when the port pin is at
Logic low (ie. 0)

I/O Devices – 7-Segment LED Display

 The 7 – segment LED display is an output device for displaying alpha numeric characters
 It contains 8 light-emitting diode (LED) segments arranged in a special form. Out of
the 8 LED segments, 7 are used for displaying alpha numeric characters
 The LED segments are named A to G and the decimal point LED segment is named
as DP
 The LED Segments A to G and DP should be lit accordingly to display numbers and
characters
 The 7 – segment LED displays are available in two different configurations, namely;
Common anode and Common cathode
 In the Common anode configuration, the anodes of the 8 segments are connected
commonly whereas in the Common cathode configuration, the 8 LED segments
share a common cathode line

Based on the configuration of the 7 – segment LED unit, the LED segment anode or cathode is
connected to the Port of the processor/controller in the order, A‟ segment to the Least
significant port Pin and DP segment to the most significant Port Pin.
 The current flow through each of the LED segments should be limited to the
maximum value supported by the LED display unit
Anode Common Cathode LED Display

DP G F E D C B A

DP G F E D C B A

Common Anode LED Display Cathode

I/O Devices – Optocoupler

 Optocoupler is a solid state device to isolate two parts of a circuit.


 Optocoupler combines an LED and a photo-transistor in a single housing (package)
 In electronic circuits, optocoupler is used for suppressing interference in data
communication, circuit isolation, High voltage separation, simultaneous separation
and intensification signal etc.

Vcc

LED AT89C51 LED


I/p interface Port Pin
O/p interface
Port Pin
Photo-transistor Photo-transistor

Microcontroller Opto-Coupler
IC MCT2M IC MCT2M
Communication Interface

 Communication interface is essential for communicating with various subsystems of


the embedded system and with the external world.
 For an embedded product, the communication interface can be viewed in two
different perspectives:
 Onboard Communication Interface (Device/board level communication interface):
 The communication channel which interconnects the various components
within an embedded product is referred as Device/board level communication
interface (Onboard Communication Interface)
 E.g.: Serial interfaces like I2C, SPI, UART, 1-Wire, etc. and parallel bus interface.

 External Communication Interface (Product level communication interface):


 The communication channel which interconnects the embedded product with
the external world is called Product level communication interface (External
Communication Interface)
 The external communication interface can be either wired media or wireless
media and it can be a serial or parallel interface.

E.g.: Wireless interfaces like Infrared (IR), Bluetooth (BT), Wireless LAN (Wi- Fi), Radio
Frequency waves (RF), GPRS, etc. and wired interfaces like RS- 232C/RS-422/RS-485, USB,
Ethernet IEEE 1394 port, Parallel port, CF-II interface, SDIO, PCMCIA, etc.

You might also like