0% found this document useful (0 votes)
17 views61 pages

Micro Controller

This document discusses various topics related to microcontroller interfacing, including asynchronous and synchronous serial communication, I/O concepts, sensor interfacing, display interfacing, and stepper motor interfacing. It provides details on asynchronous transmission using start, stop and parity bits compared to synchronous transmission using a shared clock. It also describes interfacing temperature, humidity and other sensors to a microcontroller as well as interfacing a 7-segment display and stepper motor.

Uploaded by

Yisehak Temesgen
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)
17 views61 pages

Micro Controller

This document discusses various topics related to microcontroller interfacing, including asynchronous and synchronous serial communication, I/O concepts, sensor interfacing, display interfacing, and stepper motor interfacing. It provides details on asynchronous transmission using start, stop and parity bits compared to synchronous transmission using a shared clock. It also describes interfacing temperature, humidity and other sensors to a microcontroller as well as interfacing a 7-segment display and stepper motor.

Uploaded by

Yisehak Temesgen
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/ 61

• MICROCOMPUTER INTERFACING

• EMBEDDED SYSTEM SOFTWARE ARCHITECTURE


• COMPUTER CONTROLLED SYSTEMS
 Sample data Control systems
 - Net worked Control Systems
 - Sampling ,Aliasing ,Anti Aliasing filter,

prep by Temesgen Yisehak (Lt.Col) 1


prep by Temesgen Yisehak (Lt.Col) 2
prep by Temesgen Yisehak (Lt.Col) 3
• Parallel communication implies sending a whole byte (or more) of data over multiple
parallel wires.

• Serial communication implies sending data bit by bit over a single wire Many popular serial
communication standards exist—some examples are:

– RS-232 (using UART) - Universal asynchronous receiver/transmitter

– Serial peripheral interface (SPI)

– System management bus (SMBus)


There are 2 types of serial communication:

– Asynchronous

– Synchronous Serial Communication Buses


Asynchronous Serial Communication
• With asynchronous communication, the transmitter and receiver do not share a
common clock

Add: Start, Stop, Parity Bits Remove: Start, Stop, Parity Bits

Transmitter + – Receiver
Data

1 byte-wide Data 1 byte-wide Data

The Transmitter The Receiver

 Shifts the parallel data onto  Extracts the data using its own
the serial line using its own clock
clock
 Converts the serial data back to
 Also adds the start, stop and the parallel form after stripping
parity check bits off the start, stop and parity bits
prep by Temesgen Yisehak (Lt.Col) 6
Asynchronous Serial Communication
Start Bit Parity Bit 1 or 2 Stop Bits

D0 D1 D2 D3 D4 D5 D6 D7

1 Asynchronous Byte

Asynchronous transmission is easy to implement but less efficient as it requires an extra


2-3 control bits for every 8 data bits.
Start bit—indicates the beginning of the data word
Stop bit—indicates the end of the data word
Parity bit—added for error detection (optional)
Data bits—the actual data to be transmitted
Baud rate—the bit rate of the serial port. If one baud is given as 10 bits
Throughput—actual data transmitted per sec (total bits transmitted—overhead)
Example: 115200 baud = 115200 bits/sec
If using 8-bit data, 1 start, 1 stop, and no parity bits, the effective
throughput is: 115200 * 8 / 10 = 92160 bits/sec
This method is usually used for low volume transmission
prep by Temesgen Yisehak (Lt.Col) 7
Synchronous Serial Communication
• In the synchronous mode, the transmitter and receiver share a common clock.
• The transmitter typically provides the clock as a separate signal in addition to the
serial data
Clock
Transmitter Receiver
Data

1 byte-wide Data 1 byte-wide Data

The Transmitter The Receiver


 Shifts the data onto the serial  Extracts the data using the
line using its own clock clock provided by the
transmitter
 Provides the clock as a separate
signal  Converts the serial data
back to the parallel form
 No start, stop, or parity bits
added to data prep by Temesgen Yisehak (Lt.Col) 8
Basic I/O Concepts
• Peripherals such as LEDs and keypads are essential components of
microcontroller-based systems

• Input devices

– Provide digital information to an MPU

– Examples: switch, keyboard, scanner, and digital camera

• Output devices

– Receive digital information from an MPU

– Examples: LED, seven-segment display, LCD, and printer

• Devices are interfaced to an MPU using I/O ports

prep by Temesgen Yisehak


9
(Lt.Col)
I/O Interfacing

prep by Temesgen Yisehak


10
(Lt.Col)
Interfacing and Addressing
• I/O ports
– Generally bidirectional
• Internal data direction registers
– To read binary data from an input peripheral
• MPU places the address of an input port on the address bus
• Enables the input port by asserting the RD signal
• Reads data using the data bus
– To write binary data to an output peripheral
• MPU places the address of an output port on the address bus
• Places data on data bus
• Asserts the WR signal to enable the output port

prep by Temesgen Yisehak


11
(Lt.Col)
Interfacing Examples
• sensor interfacing
• display interfacing
• interfacing of stepper motors
• interfacing of DC motors

prep by Temesgen Yisehak (Lt.Col) 12


Sensor Types

• Temperature • Frequency
• Humidity • Flow
• Light • Pressure
• Acceleration • Torque
• Force • Proximity
• Displacement

prep by Temesgen Yisehak (Lt.Col) 13


Interfacing PIC16F877A with LM35
Temperature Sensor

Components Needed

1.Microcontroller PIC16F877A – {1}


2.Reset Circuitry (Tactile Switch – {1} + 1K Resistor – {1})
3.Oscillator Circuitry (20MHz Crystal {1}, 15pF Capacitor {2})
4.LM35 Temperature Sensor – {1}

prep by Temesgen Yisehak (Lt.Col) 14


Functioning
• LM35 is analog temperature
sensor, it is a 3 Pin device,
Two pins are for Vcc and GND
and the third pin gives
voltage proportional to the
temperature.
• The output of LM35 will be a
varying voltage proportional
to the temperature,
• So Port A is configured as
analog and the output of
LM35 is given into any of the
analog channels, this could
be stored in any variable in
the program and could be
used for further analysis.prep by Temesgen Yisehak (Lt.Col) 15
Display interfacing
• A 7-Segment display is a useful electronic
component use to reduce numeric, alphabetic
and some non-alphabetic symbols using a specific
arrangement of LEDs.
• A 7-Segment display has 10-
pins representing each a, b, c, b, e, f, g and h LEDs
respectively along with two extra pins for GND
anenoted VSS. following shown an original 7-
Segment display device along with its pin
diagram. LED h is also dd by symbol dp.

prep by Temesgen Yisehak (Lt.Col) 16


Cont..
• A 7-Segment display has 10-
Pins representing each a, b, c, b, e, f, g and
h LEDs respectively along with two extra pins
for GND and VSS. following shown
an original 7-Segment display device along
with its pin diagram. LED h is also denoted by
symbol dp.

prep by Temesgen Yisehak (Lt.Col) 17


Cont…..
LED interfacing a 7-segment display is also interfaced in same way as
it is also made of LEDs. 7-Segment displays comes in two types
"Common Anode" and "Common Cathode“.
• Two ways of connecting LEDs to I/O
ports
– Common Cathode
• LED cathodes are grounded
• Logic 1 from the I/O port turns
on the LEDs
• Current is supplied by the I/O
port called current sourcing
– Common Anode
• LED anodes are connected to
the power supply
• Logic 0 from the I/O port turns
on the LEDs
• Current is received by the chip
called current sinking
prep by Temesgen Yisehak (Lt.Col) 18
7-Segment Display Interfacing
We interface 7-Segment display
with port zero of
microcontroller; and to do so
we connect P0.0 to P0.7 to Pin
a to dp (h) of 7-Segment display
respectively; and connect Vss
terminal of display to 5V Power
supply and GND pin to ground.
the configuration is shown in
figure below.

prep by Temesgen Yisehak (Lt.Col) 19


Stepper Motor Interfacing With Microcontroller
►Introduction
• A stepper motor is a brushless, synchronous electric motor that converts
electrical pulses into mechanical movement. Every revolution of the stepper motor
is divided into a discrete number of steps, and the motor must be sent a separate
pulse for each step.
• The stepper motor can only take one step at a time and each step is the same size.
Since each pulse causes the motor to rotate a precise angle, the motor’s position can
be controlled without any feedback mechanism. As the electrical pulses increase in
frequency, the step movement changes into continuous rotation, with the speed of
rotation directly proportional to the frequency of the pulses.
• Step motors are used every day in both industrial and commercial applications
because of their
a. low cost, high reliability,
b. high torque at low speeds and a simple,
c. rugged construction that operates in almost any environment.

prep by Temesgen Yisehak (Lt.Col) 20


Unipolar stepper motor
• Unipolar stepper motor
The unipolar stepper motor has five or six wires and four coils (actually two coils
divided by center connections on each coil). The center connections of the coils
are tied together and used as the power connection. They are called unipolar
steppers because power always comes in on this one pole.

prep by Temesgen Yisehak (Lt.Col) 21


Unipolar Stepper Motor Windings
Bipolar stepper motor
• The bipolar stepper motor usually has
1. four wires coming out of it.
2.Unlike unipolar steppers, bipolar steppers have no common center connection.
3.They have two independent sets of coils instead. You can distinguish them from
unipolar steppers by measuring the resistance between the wires. You should find
two pairs of wires with equal resistance. If you’ve got the leads of your meter
connected to two wires that are not connected (i.e. not attached to the same coil),
you should see infinite resistance (or no continuity).

Bipolar Stepper Motor


prep by Temesgen windings
Yisehak (Lt.Col) 22
CIRCUIT DIAGRAM FOR STEPPER MOTOR USING PIC microcontroller :

• Circuit diagram of stepper motor interfacing with pic16f877a microcontroller is


given below:

prep by Temesgen Yisehak (Lt.Col) 23


Interfacing DC Motor with PIC Microcontroller using L293D
• A direct current (DC) motor is a fairly simple electric motor that uses electricity and
a magnetic field to produce torque, which causes it to turn.

prep by Temesgen Yisehak (Lt.Col)

24
Embedded system
• Embedded system is an electronic system, which includes a
single chip microcomputers(Microcontrollers).
• It is configured to perform a specific dedicated application
.Software is programmed into the on chip ROM of
the single chip computer. This software is not accessible to
the user , and software solves only a limited range of
problems .Here the microcomputer is embedded or hidden
inside the system.
• Every embedded microcomputer system , accepts inputs,
performs computations, and generates outputs and runs
in “real time.”
Characteristics of an Embedded
System :
The important characteristics of an embedded system are

• Speed (bytes/sec) : Should be high speed


• Power (watts) : Low power dissipation
• Size and weight : As far as possible small in size and
low weight
• Accuracy (% error) : Must be very accurate
• Adaptability : High adaptability and accessibility.
• Reliability : Must be reliable over a long period of time
CATEGORIES OF EMBEDDED SYSTEMS
• Embedded systems can be classified into the following 4
categories based on their functional and performance
requirements.
1. Stand-alone embedded systems
2. Real-time embedded systems -- Hard real-time
systems & Soft real-time system
3. Networked embedded systems and
4. Mobile Embedded systems.

• Based on the performance of the Microcontroller they


are also classified in to
(i) Small scaled embedded system
(ii) Medium scaled embedded system and
(iii) Large scaled embedded system.
Cont…
• .
Stand alone Embedded systems: A stand-alone embedded system works by itself. It
is a self-contained device, which does not require any host system like a computer. It
takes either digital or analog inputs from its input ports, calibrates, converts, and
processes the data, and outputs the resulting data to its attached output device,
which either displays data, or controls and drives the attached devices. Temperature
measurement systems, Video game consoles , MP3 players, digital cameras, and
microwave ovens are the examples for this category.
• Real-time embedded systems : An embedded system which gives the required
output in a specified time or which strictly follows the time dead lines for
completion of a task is known as a Real time system. i.e. a Real Time system , in
addition to functional correctness, also satisfies the time constraints .
• There are two types of Real time systems.
(i) Soft real time system and
(ii) Hard real time system.
• Soft Real-Time system : A Real time system in which ,the violation of time
constraints will cause only the degraded quality, but the system can continue to
operate is known as a Soft real time system. In soft real-time systems, the design
focus is to offer a guaranteed bandwidth to each real-time task and to distribute
the resources to the tasks.
• Ex: A Microwave Oven , washing machine ,TV remote etc.
Cont
• Mobile Embedded systems … : The portable embedded devices
like mobile and cellular phones , digital camaras,MP3 players,
PDA (Personal Digital Assistants) are the example for mobile
embedded systems. The basic limitation of these devices is
the limitation of memory and other resources.
• Small scaled embedded system : An embedded system
supported by a single 8–16 bit Microcontroller with on-chip
RAM and ROM designed to perform simple tasks is a Small
scale embedded system.
• Medium scaled embedded system : An embedded system
supported by 16–32 bit Microcontroller /Microprocessor
with external RAM and ROM that can perform more complex
operations is a Medium scale embedded system.
• Large scaled embedded system: An embedded system
supported by 32-64 bit multiple chips which can perform
distributed jobs is considered as a Large scale embedded
system.
Application Areas of Embedded Systems:
Software architecture
• To design an efficient embedded system , both
hardware and software aspects are equally
important.
• The software of an embedded system is mainly aimed
at accessing the hardware resources properly.
• The software of an embedded system means both
operating system and application software. But every
embedded system need not contain the operating system.
For low end applications , operating system is not needed.
In such cases the designer has to write
the necessary software routines to access the hardware.
The architecture of the software in an embedded system can
be shown by the following figure.
Cont

• The central part or nucleus of the operating


system is the Kernel .
• A kernel connects the application
software to the hardware of an
embedded system.
• The other important components of the OS are
Device manager, Communication software,
Libraries and File system.
• The kernel will take care of task scheduling
, priorities , memory management etc. It
manages the tasks to achieve the desired
performance of the system . It schedules the
tasks and provide inter process
communication between different tasks.
Application programming interface

• is used by the designer to


write the application
software. The API provides
the function calls to access
the operating system
services.
Application Specific software :
• It sits above the O.S.
• The application software is developed according to
the features of the development tools available in
the OS.
• These development tools provide the function calls
to access the services of the OS. These function
calls include, creating a task ,to read the data from
the port and write the data to the memory etc.

The various function calls provided by an operating


system are
i. To create ,suspend and delete tasks.
ii. To do task scheduling to providing real time
environment.
iii. To create inter task communication and achieve the
synchronization between tasks.
iv. To access the I/O devices.
vi. To access the communication protocol stack .
• The designer develops the application software
based on these function calls.
Communication Software:
• To connect to the external world through
internet ,the embedded system need a
communication interface. The
communication software include the
Ethernet interface and the TCP/IP protocol
suit .Now a days even small embedded
systems like mobile phones,PDAs are network
enabled through these TCP/IP support. The
TCP/IP protocol suite is shown in the diagram
below.

Application layer

Transport Layer TCP/UDP


IP Layer
Data Link Layer

Physical Layer
Embedded software architectures
• Simple control loop
– software simply has a loop. The loop calls subroutines, each of which
manages a part of the hardware or software.
• Interrupt controlled system
– tasks performed by the system are triggered by different kinds of
events. (e.g. a timer, or by a serial port controller receiving a byte)
– Usually there is a simple task in a main loop also. The tasks performed
in the interrupt handlers should be as short as possibl
– Some times longer tasks are added to a queue structure
• Cooperative multitasking
– A nonpreemptive multitasking system is very similar to the simple
control loop scheme, except that the loop is hidden in an API. (usually
called "pause", "wait", "yield", etc.).
– The advantages and disadvantages are very similar to the control loop,
except that adding new software is easier.
Sampled-data control system
• Sampling refers to the process of converting an
analog signal from a continuously valued range of
amplitude values to one of a finite set of possible
numerical values.
• There are two aspects of a sampled signal:
 sampling in time and
 quantization in amplitude.
Networked Control System (NCS)
• A Networked Control System (NCS) is a control system wherein the control
loops are closed through a communication network. The defining feature of
an NCS is that control and feedback signals are exchanged among the
system's components in the form of information packages through a
network.
• The functionality of a typical NCS is established by the use of four basic
elements:
 Sensors, to acquire information,
 Controllers, to provide decision and commands,
 Actuators, to perform the control commands and
 Communication network, to enable exchange of information.
• The most important feature of a NCS is that it connects cyberspace to
physical space enabling the execution of several tasks from long distance.
• In addition, networked control systems eliminate unnecessary wiring
reducing the complexity and the overall cost in designing and implementing
the control systems. They can also be easily modified or upgraded by adding
sensors, actuators and controllers to them with relatively low cost and no
major changes in their structure.
Sampling

Most input signals to an electronic system start out as analog signals. For
processing, the signal is normally converted to a digital signal by sampling the
input.
Before sampling, the analog
input must be filtered with a
low-pass anti-aliasing filter.
Analog
The filter eliminates input
signal
Sampling
circuit
frequencies that exceed a
certain limit that is Sampling
pulses

determined by the sampling


rate.

Sampled
version of
input signal

Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Aliasing
• Digital sampling of any signal, whether sound,
digital photographs, or other, can result in apparent
signals at frequencies well below anything present
in the original. Aliasing occurs when a signal is
sampled at a less than twice the highest frequency
present in the signal. If an audio signal of .
containing a ultrasonic 45 kHz tone is sampled at
44.75 kHz, the resulting signal contains a 0.25 kHz
tone, approximately middle C!
Cont….
• The figure illustrates what happens if
a signal is sampled at regular time
intervals that are slightly less often
than once per period of the original
signal.
• The blue curve is the original signal,
and the red dots indicate the
sampled values.
• The red dots are what are recorded,
since they represent the signal
values at the times the signal is
sampled. The pattern of the red dots
is a terrible representation of the
signal. The red sampled data looks
like a sine wave at about one-tenth
the frequency of the original. This is
aliasing.
Anti-aliasing Filter

To understand the need for an anti-aliasing filter, you need to understand the
sampling theorem which essentially states:

In order to recover a signal, the sampling rate must be greater than


twice the highest frequency in the signal.

Stated as an equation, fsample > 2fa(max)


where fsample = sampling frequency
fa(max) = highest harmonic in the analog signal

If the signal is sampled less than this, the recovery process will
produce frequencies that are entirely different than in the original
signal. These “masquerading” signals are called aliases.

Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Anti-aliasing Filter

The anti-aliasing filter is a low-pass filter that limits high frequencies in the
input signal to only those that meet the requirements of the sampling
theorem.
Ant aliasing is the application of techniques that reduce or eliminate aliasing.

Filtered
Unfiltered
analoganalog Sampling frequency
frequency
frequency
spectrum
spectrum spectrum

f
fc fsample
Overlap causes
aliasing error
The filter’s cutoff frequency, fc, should be less than ½ fsample.

Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Analog-to-Digital Conversion

To process naturally occurring analog quantities with a digital system, the analog
signal is converted to digital form after the anti-aliasing filter.

The first step in converting a signal to digital form is to use a sample-


and-hold circuit. This circuit samples the input signal at a rate
determined by a clock signal and holds the level on a capacitor until the
next clock pulse.

10 V
A positive half-wave from 0-10 V is
shown in blue. The sample-and-
hold circuit produces the staircase
representation shown in red.
0V

Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Anti-aliasing Filter

Most signals have higher frequency harmonic and noise. For most ADCs, the
sampling and filter cutoff frequencies are selected to be able to reconstruct
the desired signal without including unnecessary harmonics and noise.

An example of a reasonable sampling rate is in a digital audio CD. For


audio CDs, sampling is done at 44.1 kHz because audio frequencies
above 20 kHz are not detectable by the ear.

What cutoff frequency should an


anti-aliasing filter have for a
digital audio CD?
Less than 22.05 kHz.

Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Low Pass Filters – I
• Signals are often contaminated by high-frequency noises that need to be
removed.
• The following is a simple two-stage active filter:

• The Op-Amp isolates the interactions between two RC circuits.


• This allows a simple analysis. You can get such filters on a chip
Low Pass Filters – 2
• The more the number of stages, the sharper is the rate of
reduction of the signal after the cut-off frequency. If you
want a sharper rate of reduction, you need more stages.
– In filter literature, the number of stages is called the order of the filter.
Low Pass Filters – 3
• The magnitude attenuation and the phase delay of a N-stage filter illustrated
earlier are as follows, where wcutoff = R1C1 = R2C2 = …

• The formula for the commonly used Butterworth filter is


SQRT(1 /(1 + (w/wcutoff)2N ))
Application Notes
• We have two control variables, the cut-off frequency and the
order of the filter.
1. The lower the cutoff frequency, the more effective is the filtering. But
if the cutoff frequency is too close to the useful signal, the signal will
also be reduced.
2. The higher the order, the more powerful is the filter.

• The design of a filter is iterative.


– You may need to adjust the cutoff frequency and the order of the
filter until the requirements are met.
Application Example
• The frequencies of interest in the signal are from 10 to 60 Hz.
There is significant noise with frequencies in the range 500 - 1000
Hz seen on the scope.
– An anti-aliasing filter is used to filter out the high-frequency noises.
• Suppose that we pick a cut-off frequency at 100 Hz. What should
be the order (stages) of the filter so that the signal will be
reduced no more than 30% while the noise will be reduced at
least 96%?

• Max. magnitude reduction in signal:

• Min. magnitude reduction in noise:


Sample-and-Hold and ADC

Following the anti-aliasing filter, is the sample-and-hold circuit and the


analog-to-digital converter. At this point, the original analog signal has been
converted to a digital signal.

Samples held for


one clock pulse

0100 0101 1100 1010


ADC

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Many ICs can perform both functions on a single chip and include
two or more channels. For audio applications, the AD1871 is an
example of a stereo audio ADC.

Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Analog-to-Digital Conversion Methods
+VREF
Op-amp
R comparators

Input from +
sample- –
and-hold
R + Priority
– encoder

The flash ADC: R +


7
6

5
The flash ADC uses a series high- R
+ 4
1
2
D0 Parallel
D1 binary
– 3
speed comparators that compare the R
2
4 D2
output

+ 1
input with reference voltages. Flash – 0 EN

ADCs are fast but require 2n – 1 R


+

comparators to convert an analog R


+
Enable

input to an n-bit binary number. R
pulses

How many comparators are needed by a 10-bit flash ADC?


1023

Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Analog-to-Digital Conversion Methods

One option for the sigma-delta method is to count the one-bit quantized
output for a set interval. The output of the counter is latched with the parallel
binary code.

Summing
point
Analog + ∆ 1-bit n-bit Binary code
input Σ Integrator
quantizer counter
Latch
output
signal – . .
. .
. .
. .
. .
1-bit
DAC

Sigma-delta ADCs can have high resolution and have advantages for
rejecting noise signals (such as 60 Hz power line interference). They
are available in ICs with internal programmable amplifiers. For these
reasons, they are widely used in instrumentation applications.

Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Digital-to-Analog Conversion Methods

Binary-weighted-input DAC:
The binary-weighted-input DAC is a basic DAC in which the input current in
each resistor is proportional to the column weight in the binary numbering
system. It requires very accurate resistors and identical HIGH level voltages for
accuracy.

LSB 8R
D0 Rf
The MSB is represented by the + –
I0
4R If
largest current, so it has the D1
smallest resistor. To simplify I1 – Vout
2R
analysis, assume all current D2 I=0
+ Analog
goes through Rf and none into R
I2
output
the op-amp. D3
MSB I3

Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Digital-to-Analog Conversion Methods

A certain binary-weighted-input DAC has a binary input of


1101. If a HIGH = +3.0 V and a LOW = 0 V, what is Vout?
120 kW
+3.0 V Rf

60 kW 10 kW
0V
30 kW

+3.0 V Vout
+
15 kW
+3.0 V

I out  ( I 0  I1  I 2  I 3 )
 3.0 V 3.0 V 3.0 V 
  0 V    0.325 mA
 120 kW 30 kW 15 kW 
Vout = Iout Rf = (−0.325 mA)(10 kW) = −3.25 V

Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Digital-to-Analog Conversion Methods

R-2R ladder:
The R-2R ladder requires only two values of resistors. By calculating
a Thevenin equivalent circuit for each input, you can show that the
output is proportional to the binary weight of inputs that are HIGH.
VS
Each input that is HIGH contributes to the output: Vout   n i
2
where VS = input HIGH level voltage
n = number of bits Inputs
i = bit number D0 D1 D2 D3
For accuracy, the resistors R1 R3 R5 R7 Rf = 2R
must be precise ratios, 2R 2R 2R 2R
R2 R4 R6 R8
which is easily done in –
integrated circuits. 2R R R R Vout
+

Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Digital-to-Analog Conversion Methods

An R-2R ladder has a binary input of 1011. If a HIGH


= +5.0 V and a LOW = 0 V, what is Vout?
D0 D1 D2 D3
+5.0 V +5.0 V 0V +5.0 V

R1 R3 R5 R7 Rf = 50 kW
50 kW 50 kW 50 kW 50 kW
R2 R4 R6 R8

50 kW 25 kW 25 kW 25 kW Vout
+

VS
Apply Vout   to all inputs that are HIGH, then sum the results.
2 n i
5V 5V
Vout ( D0 )   40  0.3125 V Vout ( D1 )   41  0.625 V
2 2
5V
Vout ( D3 )   43  2.5 V Applying superposition, Vout = −3.43 V
2
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Resolution and Accuracy of DACs

The R-2R ladder is relatively easy to manufacturer and is available in IC


packages. DACs based on the R-2R network are available in 8, 10, and 12-bit
versions. The resolution is an important specification, defined as the
reciprocal of the number of steps in the output.

What is the resolution of the BCN31 R-2R


ladder network, which has 8-bits?
28 – 1 = 255 1/255 = 0.39%
The accuracy is another important specification and is derived from a
comparison of the actual output to the expected output. For the
BCN31, the accuracy is specified as ±½ LSB = 0.2%.

Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Assignment
APPLICATION OF MICROCOMPUTER SYSTEM
1. Motion Control
- Dc motor ………………… group 1
- Induction ………………….group 2

Introduction
Operation
Mathematical relation
Using pIc17f877a microcontroller show the forward and
reverse running in simulation.
Why we use for industrial application.

Presentation date one week before exam week

You might also like