Professional Documents
Culture Documents
of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
System: a system is a mapping of a set of inputs into a set of outputs. When the
internal details of the system are not of particular interest, the mapping function
between input and output spaces can be considered as a black box with one or more
input entering and one or more outputs exiting the system.
The system inputs are often associated with sensors, cameras, and other devices that
provide analog inputs, which are converted to digital data, or provide direct digital
inputs. The digital outputs of computer systems, on the other hand, can be converted to
analog outputs to control external hardware devices, such as actuators and displays, or
used directly without any conversion.
Real-Time System (RTS): a RTS is a computer system must satisfy bounded response
time constraints or risk severe consequences, including failure. It is one whose logical
correctness is based on both the correctness of the outputs and their timeliness.
An RTS is defined as a system in which the time where the outputs are produced is
significant. The outputs must be produced within specified time bounds referred to as
deadlines. The correctness of a RTS depends not only on the logical results produced,
but also on the times at which such results were produced.
Page 1 of 7
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
Basic Model of a real-time system: Fig. 3 shows a simple model of a real-time system
in terms of its important functional blocks. Observe that in Fig. 3, the sensors are
interfaced with the input conditioning block, which in turns is connected to the input
interface. The output interface, output conditioning, and the actuator are interfaced in a
complementary manner. In the following we briefly describe the roles of the different
functional blocks of a real-time system.
Page 2 of 7
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
Page 4 of 7
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
Overall Structure of RTS: as shown on figure 4 the overall structure of RTS consists
of:
Page 5 of 7
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
considered to have failed whenever any of its hard real-time tasks does not
produce its required results before the specified time bound. An example of a
system having hard real-time tasks is a robot and anti-missile system.
Applications having hard real-time tasks are typically safety-critical. This means
that any failure of a real-time task, including its failure to meet the associated
deadlines, would result in severe consequences.
For hard real-time tasks in practical systems, the time bounds usually range from
several micro seconds to a few milli seconds. It may be noted that a hard real-
time task does not need to be completed within the shortest time possible, but it
is merely required that the task must complete with in the specified time bound.
In other words, there is no reward in completing a hard real-time task much
ahead of its deadline.
2. Firm Real-Time Tasks: every firm real-time task is associated with some
predefined deadline before which it is required to produce its results. However,
unlike a hard real-time task, even when a firm real-time task does not complete
within its deadline, the system does not fail. The late results are merely
discarded. In other words, the utility of the results computed by a firm real-time
task becomes zero after deadline.
Firm real-time tasks typically abound in multimedia applications. The following
are two examples of firm real-time tasks: Video conferencing and satellite-based
tracking of enemy movements.
For firm real-time tasks, the associated time bounds typically range from a few
milli seconds to several hundreds of milli seconds.
3. Soft Real-Time Tasks: soft real-time tasks also have time bounds associated
with them. However, unlike hard and firm real-time tasks, the timing constraints
on soft real-time tasks are not expressed as absolute values. Instead the
constraints are expressed either in terms of the average response times
required.
An example of soft-real time task is web browsing. Normally, after an URL
(Uniform Resource Locater) is clicked, the corresponding web page is fetched
and displayed within a couple of seconds on the average. However, when it
Page 6 of 7
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
takes several minutes to display a requested page, we still do not consider the
system to have failed, but merely express that the performance of the system
has degrade. Another example of soft real-time task is seat reservation in a
railway reservation application.
Page 7 of 7
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
Characteristics of Real Time System
We now discuss a few key characteristics of real-time systems. These characteristics
distinguish real-time systems from non-real-time systems. However, the reader may
note that all the discussed characteristics many not be applicable to every real-time
system.
1. Time constraints: every real-time task is associated with some time constraints.
One form of time constraints that is very common is deadlines associated with
tasks. A task deadline specifies the time before which the task must complete
and produce the results. Other type of timing constraints are delay and duration.
It is the responsibility of the real-time operating system (RTOS) to ensure that all
tasks meet their respective time constraints. Time constraints can be classified
into the following three types;
a. Delay constraint: a delay constraint captures the minimum time (delay)
that must elapse between the occurrence of two arbitrary events e1 and
e2 .
b. Deadline constraint: a deadline constraint captures the permissible
maximum separation between any two arbitrary events e1 and e2.
c. Duration constraints: a duration constraints on an event specifies the time
period over which the event acts. A duration constraint can either be
minimum type or maximum type. The minimum type duration constraint
requires that once the event starts the event must not end before a certain
minimum duration. Whereas a maximum type duration constraint requires
that once the event starts, the event must end before a certain maximum
duration elapses.
2. New correctness criterion: the notion of correctness in real-time systems is
different from that used in the context of traditional systems. In real-time systems,
correctness implies not only logical correctness of the results, but the time at
which the results are produced is important. A logically correct result produced
after the deadline would be considered as an incorrect result.
Page 1 of 10
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
3. Embedded: A vast majority of real-time systems are embedded in nature. An
embedded computer system is physically “embedded” in its environment and
often controls it. The sensors of the real-time computer collect data from the
environment pass them on to the real-time computer for processing. The
computer, in turn passes information (processed data) to the actuators to carry
out the necessary work on the environment, which results in controlling some
characteristics of the environment. An example of an embedded real-time system
is Multi-Point Fuel Injection (MPFI) system.
4. Safety-Criticality: For traditional non-real-time system safety and reliability are
independent issues. However, in many real-time systems these two issues are
intricately bound together making them safety-critical. Note that a safe system is
one that does not cause any damage even when it fails. A reliable system is one
that can operate for long durations of time without exhibiting any failures.
5. Concurrency: A real-time system usually needs to respond to several
independent events within very short and strict time bounds. For instance,
consider a chemical plant automation system, which monitors the progress of a
chemical reaction and controls the rate of reaction. These parameters are
sensed using sensors fixed in the chemical reaction chamber. These sensors
may generate data asynchronously at different rates. Therefore, the real-time
system must process data from all the sensors concurrently, otherwise signals
may be lost and the system may malfunction.
6. Distributed and Feedback Structure: in many real-time systems, the different
components of the system are naturally distributed across widely spread
geographic locations. Therefore, these events may often have to be handled
locally and responses produced to them to prevent overloading of the underlying
communication network. Therefore, the sensors and the actuators may be
located at the places where the events are generated.
7. Task Criticality: task criticality is a measure of the cost of failure of a task. Task
criticality is determined by examining how critical are the results produced by the
task to the proper functioning of the system. A real-time system may have tasks
of very different criticalities. It is therefore natural to expect that the criticalities of
Page 2 of 10
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
the different tasks must be taken into consideration while designing for fault-
tolerance. The higher the criticality of a task, the more reliable it should be made.
Further, in the event of the failure of a highly critical task, immediate failure
detection and recovery are important.
8. Custom Hardware: A real-time system is often implemented on custom hardware
that is specifically designed and developed for the purpose. For example, an
MPFI car used a processor that must be powerful general purpose processor
such as a Pentium or an Athlon processor. Some of the most powerful computers
used in MPFI engines are 16- or 32-bit processors running at approximately 40
MHz. However, unlike the conventional PCs, a processor used in these car
engines do not deal with processing frills such as screen-savers or a dozen of
different applications running at the same time. All that the processor in an MPFI
system need to do is to compute the required fuel injection rate that is most
efficient for a given speed and acceleration.
9. Reactive: real-time systems are often reactive. A reactive system is one in which
an on-going interaction between the computer and the environment is
maintained. Traditional systems compute functions on the input data to generate
the output data. In contrast to traditional computation of the output as a simple
function of the input data, real-time systems do not produce any output data but
enter into on-going interaction with their environment. In each interaction step,
the results computed are used to carry out some actions on the environment.
The reaction of the environment is sampled and is fed back to the system.
Therefore, the computations in a real-time system can be considered to be non-
terminating.
10. Stability: Under overload conditions, real-time systems need to continue to meet
the deadline of the most critical tasks, though the deadlines of non-critical task
may not be met. This is in contrast to the requirement of fairness for traditional
systems even under overload conditions.
11. Exception Handling: Many real-time systems work round-the-clock and often
operate without human operators. For example, consider a small automated
chemical plant that is set up to work non-stop. When there are no human
Page 3 of 10
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
operators, taking corrective actions on a failure become difficult. Even if no
corrective actions can be immediate taken, it is desirable that a failure does not
result in catastrophic situations. A failure should be detected and the system
should continue to operate in a gracefully degraded mode rather than shutting off
abruptly.
Real-time systems have applications in wide ranging areas. In the following, we list
some of the prominent areas of application of real-time systems and in each identified
case; we discuss a few example applications in some detail. As we can imagine, the list
would become very vast if we try to exhaustively list all areas of applications of real-time
system. We have therefore restricted our list to only a handful of areas, and out of these
we have explained only a few selected applications to conserve space.
Page 4 of 10
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
b. Example 2: Automated Car Assembly Plant
An automated car assembly plant is an example of a plant automation
system. In an automated car assembly plant, the work product (partially
assembled car) moves on a conveyor belt. Alongside the conveyor belt,
several workstations are placed. Each workstation performs some specific
work on the work product such as fitting engine, fitting door, fitting wheel,
and spray painting the car, etc. as it moves on the conveyor belt. An
empty chassis is introduced near the first workstation on the conveyor
belt. A fully assembled car comes out after the work product goes past all
the workstations. At each workstation, a sensor senses the arrival of the
next partially assembled product. As soon as the partially assembled
product is sensed, the workstation begins to perform its work on the work
product. The time constraint imposed on the workstation computer is that
the workstation must complete its work before the work product moves
away to the next workstation. The time bounds involved here are typically
of the order of a few hundreds of milli seconds.
c. Example 3: Supervisory Control And Data Acquisition (SCADA)
SCADA are a category of distributed control systems being used in many
industries. A SCADA system helps monitor and control a large number of
distributed events of interest. In SCADA systems, sensors are scattered at
various geographic locations to collect raw data (called events of interest).
These data are then processed and stored in a real-time database. The
database models (or reflects) the current state of the environment. The
database is updated frequently to make it a realistic model of the up-to-
date state of the environment. An example of a SCADA application is an
Energy Management System (EMS). An EMS helps to carry out load
balancing in an electrical energy distribution network. The EMS senses
the energy consumption at the distribution points and computes the load
across different phases of power supply. It also helps dynamically balance
the load. Another example of a SCADA system is a system that monitors
and controls traffic in a computer network. Depending on the sensed load
Page 5 of 10
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
in different segments of the network, the SCADA system makes the router
change traffic routing policy dynamically. The time constraint in such a
SCADA application is that the sensors must sense the system state at
regular intervals (say every few millis seconds) and the same must be
processed before the next state is sensed.
2. Medical: A few examples of medical applications of real-time system are: robots,
MRI scanners, radiation therapy equipments, bedside monitors, and
computerized axial tomography (CAT).
a. Example 4: Robot Used in Recovery of Displaced Radioactive Material
Robots have become very popular nowadays and are being used in a
wide variety of medical applications. An application that we discuss here is
a robot used in retrieving displaced radioactive materials. Radioactive
materials such as Cobalt and Radium are used for treatment of cancer. At
times during treatment, the radioactive Cobalt (or Radium) gets dislocated
and falls down. Since human beings cannot come near a radioactive
material, a robot is used to restore the radioactive material to its proper
position. The robot has to sense its environment frequently and based on
this information, plan its path. The real-time constraint on the path
planning task of the robot is that unless it plans the path fast enough after
an obstacle is detected, it may collide with it. The time constraints involved
here are of the order of a few milli seconds.
3. Peripheral equipments: A few examples of peripheral equipments that contain
embedded real-time system are: laser printers, digital copiers, fax machines,
digital camera, and scanners.
a. Example 5: Laser printer
Most laser printers have powerful microprocessors embedded in them to
control different activities associated with printing. The important activities
that a microprocessor embedded in a laser printer performs include the
following: getting data from the communication port(s), typesetting fonts,
sensing paper jams, noticing when the printer runs out of paper. Sensing
when the user presses a button on the control panel, and displaying
Page 6 of 10
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
various messages to the users. The most complex activity that the
microprocessor performs is driving the laser engine. The basic command
that a laser engine supports is to put a black dot on the paper. However,
the laser engine has no idea about the exact shapes of different fonts, font
sizes, italic, underlining, boldface, etc. that it may be asked to print. The
embedded microprocessor receives print commands on its input port and
determines how the dots can be composed to achieve the desired
document and manages printing the exact shapes through a series of dot
commands issued to the laser engine. The time constraints involved here
are of the order of a few milli seconds.
4. Automotive and Transportation: a few examples of automotive and transportation
applications of real-time system are: automotive engine control systems, road
traffic control, air-traffic control, high-speed train control, car navigation systems,
and MPFI engine control systems.
a. An MPFI system is an automotive engine control system. It is a real-time
system that controls the rate of fuel injection and allows the engine to
operate at its optimal efficiency. In older models of cars, a mechanical
device called the carburettor was used to control the fuel injection rate to
the engine. It was the responsibility of the carburettor to vary the fuel
injection rate depending on the current speed of the vehicle and the
desired acceleration.
In MPFI engines, the precise fuel injection rate at each injection point is
determined by a computer. An MPFI system injects fuel into individual
cylinders resulting in better ‘power balance’ among the cylinders as well
as higher output from each one along with faster throttle response. The
processor primarily controls the ignition timing and the quantity of fuel to
be injected. The latter is achieved by controlling the duration for which the
injector valve is open.
The actions of the processor are determined by the data gleaned from
sensors located all over the engine. The sensors constantly monitor the
ambient temperature, the engine coolant temperature; exhaust
Page 7 of 10
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
temperature, emission gas contents, engine r pm (speed), vehicle road
speed, crankshaft position, camshaft position, etc. An MPFI system not
only makes a vehicle more fuel efficient, it also minimizes pollution by
reducing partial combustion.
5. Telecommunication Applications: a few example uses of real-time system in
telecommunication applications are: cellular systems, video conferencing, and
cable modems.
a. Example 7: A cellular system
Cellular systems have become a very popular means of mobile
communication. A cellular system usually maps a city into cells. In each
cell, a base station monitors the mobile handsets present in the cell.
Among other tasks, base station controls hand-off of calls as the mobile
moves. Call hand-off is required when a mobile moves away from a base
station. As a mobile moves away, its received signal strength (RSS) falls
at the base station. The base station monitors this and as soon as the
RSS falls below a certain threshold value, it hands-off the details of the
on-going call of the mobile to the base station of the cell to which the
mobile moved. The hand-off must be completed within a sufficient small
predefined time interval. So that the user does not feel any temporary
disruption of service during the hand-of. Typically call hand-off is required
to be achieved within a few milliseconds.
6. Aerospace: a few important use of real-time system in aerospace application are:
avionics, flight simulation, airline cabin management system, satellite tracking
systems, and computer on-board an aircraft.
a. Example 8: computer on-board an aircraft
In many modern aircrafts, the pilot can select an “auto pilot” option. As
soon as the pilot switches to the “auto pilot” mode, an on-board computer
takes over all controls of the aircraft including navigation, take-off, and
landing of the aircraft. In the “auto pilot” mode, the computer periodically
samples velocity and acceleration of the aircraft. From the sampled data,
the on-board computers computes X, Y and Z co-ordinates of the current
Page 8 of 10
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
aircraft position and compares them with the pre-specified track data.
Before the next sample values are obtained, it computes the deviation
from the specified track values and takes any corrective actions that may
be necessary. In this case, the sampling of the various parameters, their
processing need to be completed within few micro seconds.
7. Internet and Multimedia Applications: important use of real-time systems in
multimedia and internet applications include: video conferencing and multimedia
multicast, internet routers and switches.
a. Example 9: video conferencing
In a video conferencing application, video and audio signals are generated
by cameras and microphones respectively. The data are sampled at a
certain pre-specified frame rate. These are then compressed and sent as
packets to the receiver over a network. At the receiver-end, packets are
ordered, decompressed, and then played. The time constraint at the
receiver-end is that the receiver must process and play the received
frames at a predetermined constant rate. Thus if thirty frames are to be
shown every minute, once a frame play-out is complete, the next frame
must be played within two seconds.
8. Consumer Electronics: consumer electronics area abounds numerous application
of real-time systems. A few sample applications of real-time systems in
consumer electronics are: set-top boxes, audio equipment, internet telephony,
microwave ovens, intelligent washing machines, home security systems, air
conditioning and refrigeration, toys, and cell phones.
a. Example 10: Cell phones
A cell phone at any point of time carries out a number of tasks
simultaneously. These include: converting input voice to digital signals by
deploying digital signal processing (DSP) techniques, converting electrical
signals generated by microphone to output voice signals, and sampling
incoming base station signals in the control channel. A cell phone
responds to the communications received from the base station within
certain specified time bounds. For example, a base station might
Page 9 of 10
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
command a cell phone to switch the on-going communication to a specific
frequency. The cell phone must comply to such commands from the base
station with a few milli seconds.
9. Defense Applications: typical defense applications of real-time systems include:
missile guidance systems, anti-missile systems, satellite-base surveillance
systems.
a. Example 11: missile guidance system
A guided missile is one that is capable of sensing the target and homes
onto it. Homing becomes easy when the target emits either electrical or
thermal radiation. In a missile guidance system, missile guidance is
achieved by a computer mounted on the missile. The mounted computer
computes the deviation from the required trajectory and effects track
changes of the missile to guide it onto the target. The time constraint on
the computer-based guidance system is that the sensing and the track
correction tasks must be activated frequently enough to keep the missile
from diverging from the target. The target sensing and track correction
tasks are typically required to be completed within a few hundreds of
microseconds or even lesser time depending on the speed of the missile
and the type of the target.
10. Miscellaneous Applications: besides the areas of applications already discussed,
real-time systems have found numerous other applications in our every day life.
An example of such an application is a railway reservation system.
a. Example 12: Railway reservation system
In a railway reservation system, a central repository maintains the up-to-
date data on booking status of various trains. Ticket booking counters are
distributed across different geographic location. Customers queue up at
different booking counters and submit their reservation requests. After a
reservation request is made at a counter, it normally takes only a few
seconds for the system to confirm the reservation and print the ticket. Or
display the seat unavailability message with in an average response time
of 20 seconds.
Page 10 of 10
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
Signals, System and Specification - PART 1
1. What is Signal?
Any physical phenomenon that conveys or carries some information can be
called a signal. For example, music, speech, motion pictures, still photos, heart
beat, etc. are examples of signals that we normally encounter in day to day life.
Signal is defined as any physical quantity that varies with one or more
independent variables.
2. Types of signals
The signals can be classified in number of ways, some way of classifying the
signals are:
a. Depending on the number of the sources for the signals.
Page 1 of 8
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
i. One-channel signals: signal generated by a single source or sensor
signal.
X1 (t) = 0.7 t
Page 2 of 8
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
1. Continuous Time Signal: in a signal with time as independent variable, if the
signal is defined continuously for any value of the independent variable time “t”,
then the signal is called continuous time signal (CTS). The continuous time
The continuous time signal is defined for every instant of the independent
variable time and so the magnitude (or the value) of continuous time signal is
continuous in the specified range of time. Hence both the magnitude of the signal
2. Discrete Time Signal: in a signal whit time as independent variable, if the signal
is defined only for discrete instants of the independent variable time, then the
In discrete time signal the independent variable time “t” is uniformely divided into
discrete intervals of time and each interval of time is denoted by an integer “n”,
where “n” stands for discrete interval of time and “n” can take any integer value.
Page 3 of 8
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
Where T is a positive constant. The smallest value of T that satisfies the above
On the other hand, any signal X(t) for which there is no value of T satisfy the
The classification of signals into periodic and nonperiodic signals presented thus
Page 4 of 8
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
X[n] = X[n + N] for all integers n
The smallest value of integer N for which the above equation is satisfied is called
An issue of fundamental importance is the study of signals and system is the use
Y(t) = C X(t)
ii. Addition: let X1(t) and X2(t) denote a pair of continuous-time signals.
The signal Y(t) obtained by the addition of X1(t) and X2(t) is defined
by :
Page 5 of 8
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
A physical example of a device that adds signals is an audio mixer.
That is, for each prescribed time t the value of Y(t) is given by the
Y(t) = X(at)
X(t).
Page 6 of 8
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
ii. Reflection: let X(t) denote a continuous-time signal. Let Y(t) denote
Y(t) = X(-t)
iii. Time shifting: let X(t) denote a continuous-time signal. The time-
Y(t) =X (t - t0)
Page 7 of 8
Department of Computer Engineering Techniques (Stage: 3)
Real‐Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq
Figure below shows an example of time shift operation, on it t0
Let Y(t) denote a continuous-time signal that is derived from another continuous-
time signal X(t) through a combination of time shifting and time scaling.
To correctly obtain Y(t) from X(t), the time-shifting and time-scaling operations
must be performed in the correct order. The proper order is based on the fact
that the scaling operation always replaces t by at, while the time-shifting
performed first on X(t), resulting in intermediate signal V(t). Next, the time-
Page 8 of 8
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
1. Introduction:
The electronic machines tend to fall mainly into two broad classes, the “digital”
machines and the “analogue” machines. In this section we presented the main features
of electronic machines in such a way as to emphasize differences between the digital
and analogue types.
The two main types (digital and analog) have features which fit them for different fields
of application, and which make them attractive in different degrees to mathematicians,
physicists, engineers, accountants, and many other users.
2. Digital Machines
3. Analog Machines
The common feature of analogue machines is that the various quantities in the problem
to be solved are represented by corresponding physical quantities in the machine. In
Page 1 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
analogue machines the analogue quantities are commonly voltages which correspond
in some predetermined manner with the quantities in the problem.
Electronic analogue machines can perform addition, subtraction and some other
operations directly, and can deal with continuously varying quantities. In particular they
can perform integration directly, provided that the independent variable is time.
Analogue machines have found widest application in the fields of aerodynamics and
electrodynamics. When the analogue machine is used in this way the variables and
constants in the machine, and the way these quantities react on each other, often
present a close parallel with the behavior of the actual system being studied, so the
machine is effectively a model of the system (simulator). Analogue machines of this
type are now highly developed as flight simulators, unclear reactor control simulators,
and missile training equipment.
The term operational amplifier evolved from original applications in analog computation
where these circuits were used to perform various mathematical operations such as
summation and integration. Because of the performance and economic advantages of
available units, present applications extend far beyond the original ones, and modern
operational amplifiers are used as general purpose analog data-processing elements.
The OP-AMP is a simple building block of analogue machines, it has two inputs, one is
called the inverting input (often labeled -) and other is called the non-inverting input
(often labeled +). And usually has single output. The OP-AMP also has two power
supply connections, one for the positive rail and one for the negative rail.
Page 2 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
• The OP-AMP is a high gain DC amplifier; the output voltage is simply the
difference in voltage between the inverting and non-inverting inputs, multiplied by
the gain.
• The OP-AMP must have feedback in order to perform useful functions.
5. Feedback and the OP-AMP
There are two basic ways of applying feedback to an OP-AMP:
• The inverting configuration.
• The non-inverting configuration.
5.1. The inverting configuration:
Inverting Configuration
Page 3 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
Let us look at the case of an inverting AMP in a little more detail. Referring to
the above figure in more details, the non-inverting terminal is connected to
ground. Since the OP AMP will force the differential voltage across the inputs to
zero, the inverting input will also appear to be at ground. In fact, this node is
often referred as “virtual ground”.
If there is a voltage (Vi) applied to the input resistor (Z1), it will set up a current
(Ia) throw resister (Z1). Since the input impedance of the OP-AMP is finite, no
current will flow into the inverting input, therefore the same current (Ib) must flow
through the feedback resistor (Z2). Hence :
Ia = Ib
𝑽𝒊 − 𝑽𝒂 𝑽𝒂 − 𝑽𝒐
=
𝒁𝟏 𝒁𝟐
𝑽𝒊 − 𝑽𝒐
=
𝒁𝟏 𝒁𝟐
𝑽𝒐 − 𝒁𝟐
=
𝑽𝒊 𝒁𝟏
− 𝒁𝟐
Closed Loop Gain (A) =
𝒁𝟏
Page 4 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
Example No.1: Find the closed loop gain of the following inverting amplifier circuit.
Solution:
− 𝒁𝟐
Closed Loop Gain (A) =
𝒁𝟏
(A) = - 100k/10k = - 10
Example 2: To increase the Gain of example (1) to 40, find the value of the resister (R2)
required? (Homework)
Non-inverting Configuration
Page 5 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
Let examine the above figure in more details, the input voltage is applied to the non-
inverting terminal. The output voltage drives a voltage divider consisting of Z1 and Z2.
The voltage at the inverting terminal Va, which is at the junction of the two resistors, is:
𝒁𝟏
𝑽𝒂 = 𝑽
𝒁𝟏 + 𝒁𝟐 𝒐
Since Vi equal to Va
𝑽𝒐 𝒁𝟏 + 𝒁𝟐
=
𝑽𝒊 𝒁𝟏
𝐕𝐨 𝒁𝟐
The Close loop Gain (A) = =1+
𝐕𝐢 𝒁𝟏
Example: compute the voltage gain and the output voltage for the non-
inverting OP-AMP circuit shown in figure below, given that Vi = 1 mV.
Solution:
𝒁𝟐
Voltage Gain (A) = 1 +
𝒁𝟏
120 𝐾𝛺
A=1+ =1+6= 7
60 𝐾𝛺
Page 6 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
V out = - Rf I
Vout = − Rf (I1 + I2 + …………. + IN)
Vin1 Vin2 V
Vout = − Rf ( + + …………. + 𝑅inN )
𝑅1 𝑅2 𝑁
𝑅 𝑅 𝑅
Vout = − (𝑅𝑓 Vin1 + 𝑅𝑓 Vin2 + …………. +𝑅 𝑓 VinN )
1 2 𝑁
If R1 = R2 = …………….. = RN = R
𝑅𝑓
V out =− 𝑅
(Vin1 + Vin2 + …………. + VinN )
If Rf = R
V out = − (Vin1 + Vin2 + …………. + VinN )
The above equation indicates that the circuit of the OP-AMP adder can be used to
find the negative sum of any number of input voltages.
The above circuit can also be used to find the average value of all input voltages.
𝑅𝑓
The ration 𝑅
is selected such that the sum of the input voltage is divided by the
number of the input voltages applied at the inverting input of the OP-AMP. For
𝑅𝑓 1 1
example, if we have three inputs voltages, hence the ration 𝑅
= 𝑛
= 3
. and overall
Page 7 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
Figure below shows the non-inverting summing, averaging OP-AMP. It can been
seen that the voltage sources Vin1, Vin2, …., VinN and the associated resistors R1, R2,
Vin1 Vin2
……….., RN can be replaced by the current sources whose values are: , ,
𝑅1 𝑅2
VinN
…………. , respectively.
𝑅𝑁
Page 8 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
𝑅3
𝑊ℎ𝑒𝑛 𝑉2 = 0, (𝑖𝑛𝑣𝑒𝑟𝑡𝑖𝑛𝑔)𝑡ℎ𝑒𝑛, 𝑉𝑜𝑢𝑡(𝑎) = − 𝑉1 � �
𝑅1
𝑅1 + 𝑅3
𝑤ℎ𝑒𝑛 𝑉1 = 0, (𝑁𝑜𝑛 − 𝑖𝑛𝑣𝑒𝑟𝑡𝑖𝑛𝑔)𝑡ℎ𝑒𝑛 𝑉𝑜𝑢𝑡(𝑏) = 𝑉𝑎 � �
𝑅1
𝑅4
𝑊ℎ𝑒𝑛 𝑉𝑎 = 𝑉𝑏 = 𝑉2 � �
𝑅2 + 𝑅4
𝑅4 𝑅1 + 𝑅3
𝑡ℎ𝑒𝑛, 𝑉𝑜𝑢𝑡(𝑏) = 𝑉2 � �� �
𝑅2 + 𝑅4 𝑅1
𝑆𝑖𝑛𝑐𝑒, 𝑉𝑜𝑢𝑡 = 𝑉𝑜𝑢𝑡(𝑎) + 𝑉𝑜𝑢𝑡(𝑏)
𝑅 𝑅4 𝑅1 + 𝑅3
𝑡ℎ𝑒𝑛, 𝑉𝑜𝑢𝑡 = − 𝑉1 �𝑅3 � + 𝑉2 �𝑅 � � �
1 2 + 𝑅4 𝑅1
A comparator is a circuit used to sense when a varying signal reaches some threshold
value. The simplest comparator circuit has the signal voltage directly to one of the input
terminals and a reference voltage to the other. When the OP-AMP is used open loop, its
output makes a transition between saturated states as the input signal passes through.
A basic OP-AMP comparator circuit can be used to detect either a positive or a negative
going input voltage depending upon which input of the operational amplifier we connect
the fixed reference voltage source and the input voltage too.
Page 9 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
8.1. Negative Voltage Comparator (inverting comparator) circuit detects when the
input signal Vin is BELOW or more negative than the reference voltage. Then the
comparator circuit will produce Vout which is HIGH as shown.
8.2. Positive Voltage Comparator (non-inverting) circuit detects when the input signal
Vin is ABOVE or more positive than the reference voltage then the circuit
produces an output at Vout which is HIGH as shown.
Page 10 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
( 𝑎𝑠𝑠𝑢𝑚𝑖𝑛𝑔 𝑉𝑜𝑢𝑡(0) = 0)
1 𝑡
𝑉𝑜𝑢𝑡(𝑡) = ∫0 𝑉𝑖𝑛 𝑑𝑡
−𝑅𝐶
Page 11 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
The basic operational amplifier differentiator circuit produces an output signal which is
the first derivative of the input signal. Figure below depicts the OP-AMP amplifier circuit.
𝐼𝑖𝑛 = 𝐼𝑓
𝑑𝑣𝑐 −𝑉𝑜𝑢𝑡
𝐶 =
𝑑𝑡 𝑅𝑓
𝑊ℎ𝑒𝑛 𝑉𝑐 = 𝑉𝑖𝑛
𝑑𝑣𝑖𝑛 −𝑉𝑜𝑢𝑡
𝐶 =
𝑑𝑡 𝑅𝑓
− 𝑉𝑜𝑢𝑡 𝑑𝑡 = 𝐶 𝑑𝑣𝑖𝑛 𝑅𝑓
𝑑𝑣𝑖𝑛
𝑉𝑜𝑢𝑡 = −𝐶 𝑅𝑓
𝑑𝑡
Page 12 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
Exercises
OP-AMP
Exercise 1: Compute the voltage gain Gv and then the output voltage Vout for the
inverting OP-AMP circuit shown in figure below, given that Vin = 1 mV.
Rf
120 K𝛺
R in
V in
20 K𝛺
V out
Solution:
Since the circuit is an inverting amplifier, then the voltage gain Gv is:
𝑅𝑓 120 KΩ
𝐺𝑣 = − = − =-6
𝑅𝑖𝑛 20 KΩ
And , Vout = Gv Vin = - 6 X 1mV = - 6 mV
Exercise 2: Compute the voltage gain Gv and then the output voltage Vout for the
non-inverting OP-AMP circuit shown in figure below, given that Vin = 1 mV.
Rf
120 K𝛺
R in
20 K𝛺
V out
V in
Page 1 of 6
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
𝑉𝑜𝑢𝑡 𝑅𝑓 120 𝐾𝛺
= 1+ =1+ = 1+6 =7
𝑉𝑖𝑛 𝑅𝑖𝑛 20 𝐾𝛺
Exercise 3: For the circuit shown in figure below, calculate the input voltage if the
final output voltage is 10.08 V.
10 K𝛺
5 K𝛺
5 K𝛺 100 K𝛺
5 K𝛺
Va 5 K𝛺
Vb
V0
V1
10.08 = −20 𝑉𝑏
𝑉𝑏 = − 0.504 𝑉
Then:
𝑉𝑏 5
= −
𝑉𝑎 5
𝑉𝑏 = − 𝑉𝑎
− 0.504 = − 𝑉𝑎
𝑉𝑎 = 0.504 𝑉𝑜𝑙𝑡
Finally:
Page 2 of 6
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
𝑉𝑎 10
=1+
𝑉1 5
10
𝑉𝑎 = � 1 + � 𝑉1
5
0.504 = 3 𝑉1
𝑉1 = 0.168 𝑉𝑜𝑙𝑡
R1 = 24 K𝛺 Rf
Vin1 24 K𝛺
R2 = 24 K𝛺
-2 V
R3 = 24 K𝛺 +12 V
-6 V
Solution:
𝑽𝒐𝒖𝒕 = −𝑹𝒇 𝑰 = − 𝑹𝒇 ( 𝑰𝟏 + 𝑰𝟐 + 𝑰𝟑 )
𝟏𝟐 = − 𝑽𝒊𝒏𝟏 + 2 + 6
𝑽𝒊𝒏𝟏 = −𝟒 𝑽𝒐𝒍𝒕
Page 3 of 6
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
Exercise 5: For the circuit shown below, calculate the output voltage, Vo if V1 = V2
= 700 mV.
500 K𝛺
500 K𝛺
V1 250 K𝛺
100 K𝛺
Va
Vo
50 K𝛺
V2
Solution:
𝑉𝑎 = −(500⁄250) 0.7
𝑉𝑎 = 1.4 𝑉𝑜𝑙𝑡
𝑉0 = 0 𝑉𝑜𝑙𝑡
Page 4 of 6
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
Exercise 6: The input voltage to the amplifier for the circuit on figure (a) is
explained in figure (b), find the output voltage assuming that the initial condition
is zero, that is, V0 = 0.
Solution:
𝒕
𝟏
𝑽𝒐𝒖𝒕 = − � 𝑽𝒊𝒏 𝒅𝒕
𝑹𝟏 𝑪
𝟎
Then , 𝑹𝟏 𝑪 = 1,
When 𝑽𝟎 = 𝟎,
𝟑 𝟑 𝟑
Then, 𝑽𝒐𝒖𝒕 = − ∫𝟎 𝑽𝒊𝒏 𝒅𝒕 = − ∫𝟎 𝟐 𝒅𝒕 = −𝟐𝒕 ⃒ = −𝟔
𝟎
Page 5 of 6
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
250 K𝛺
10 μF
Vin = 12t
Solution:
𝒅𝒗𝒊𝒏
𝑽𝑶𝒖𝒕 = −𝑹𝑪
𝒅𝒕
𝑹𝑪 = 𝟐𝟓𝟎 ∗ 𝟏𝟎𝟑 ∗ 𝟏𝟎 ∗ 𝟏𝟎−𝟔 = 𝟐. 𝟓
𝒅
𝑽𝒐𝒖𝒕 = −𝟐. 𝟓 (𝟏𝟐𝒕)
𝒅𝒕
𝑽𝒐𝒖𝒕 = −𝟑𝟎 𝒎𝑽
Page 6 of 6
Department of Computer Engineering Techniques (Stage: 3) Real‐Time system design
Dr.: Hasanein Alharbi
Ahmad Rida Jawad
1st Assignment
Q 1. Define system, and explain how Real‐Time system (RTS) differ from ordinary computer
system?
Q 2. Draw a block diagram which explains the functionality of Real‐Time System and explain in
Q7. What is main difference between Digital Machines and Analog Machines?
amplifier circuit.
Solution:
Closed Loop Gain (A) = − ��/��
(A) = - 100k/10k = - 10
Q9. Example: compute the voltage gain and the output voltage for the
noninverting OP-AMP circuit shown in figure below, given that Vi = 1 mV.
Solution:
Voltage Gain (A) = 1 + ��/��
A = 1 + 120 ��/20 ��
=1+6=7
Vout = A Vin = 7 * 1 mV = 7 mV.
Q10. Define comparator and what is the different between Negative Voltage
Comparator and Positive Voltage Comparator?
1. Introduction:
The electronic machines tend to fall mainly into two broad classes, the “digital”
machines and the “analogue” machines. In this section we presented the main features
of electronic machines in such a way as to emphasize differences between the digital
and analogue types.
The two main types (digital and analog) have features which fit them for different fields
of application, and which make them attractive in different degrees to mathematicians,
physicists, engineers, accountants, and many other users.
2. Digital Machines
3. Analog Machines
The common feature of analogue machines is that the various quantities in the problem
to be solved are represented by corresponding physical quantities in the machine. In
Page 1 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
analogue machines the analogue quantities are commonly voltages which correspond
in some predetermined manner with the quantities in the problem.
Electronic analogue machines can perform addition, subtraction and some other
operations directly, and can deal with continuously varying quantities. In particular they
can perform integration directly, provided that the independent variable is time.
Analogue machines have found widest application in the fields of aerodynamics and
electrodynamics. When the analogue machine is used in this way the variables and
constants in the machine, and the way these quantities react on each other, often
present a close parallel with the behavior of the actual system being studied, so the
machine is effectively a model of the system (simulator). Analogue machines of this
type are now highly developed as flight simulators, unclear reactor control simulators,
and missile training equipment.
The term operational amplifier evolved from original applications in analog computation
where these circuits were used to perform various mathematical operations such as
summation and integration. Because of the performance and economic advantages of
available units, present applications extend far beyond the original ones, and modern
operational amplifiers are used as general purpose analog data-processing elements.
The OP-AMP is a simple building block of analogue machines, it has two inputs, one is
called the inverting input (often labeled -) and other is called the non-inverting input
(often labeled +). And usually has single output. The OP-AMP also has two power
supply connections, one for the positive rail and one for the negative rail.
Page 2 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
• The OP-AMP is a high gain DC amplifier; the output voltage is simply the
difference in voltage between the inverting and non-inverting inputs, multiplied by
the gain.
• The OP-AMP must have feedback in order to perform useful functions.
5. Feedback and the OP-AMP
There are two basic ways of applying feedback to an OP-AMP:
• The inverting configuration.
• The non-inverting configuration.
5.1. The inverting configuration:
Inverting Configuration
Page 3 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
Let us look at the case of an inverting AMP in a little more detail. Referring to
the above figure in more details, the non-inverting terminal is connected to
ground. Since the OP AMP will force the differential voltage across the inputs to
zero, the inverting input will also appear to be at ground. In fact, this node is
often referred as “virtual ground”.
If there is a voltage (Vi) applied to the input resistor (Z1), it will set up a current
(Ia) throw resister (Z1). Since the input impedance of the OP-AMP is finite, no
current will flow into the inverting input, therefore the same current (Ib) must flow
through the feedback resistor (Z2). Hence :
Ia = Ib
𝑽𝒊 − 𝑽𝒂 𝑽𝒂 − 𝑽𝒐
=
𝒁𝟏 𝒁𝟐
𝑽𝒊 − 𝑽𝒐
=
𝒁𝟏 𝒁𝟐
𝑽𝒐 − 𝒁𝟐
=
𝑽𝒊 𝒁𝟏
− 𝒁𝟐
Closed Loop Gain (A) =
𝒁𝟏
Page 4 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
Example No.1: Find the closed loop gain of the following inverting amplifier circuit.
Solution:
− 𝒁𝟐
Closed Loop Gain (A) =
𝒁𝟏
(A) = - 100k/10k = - 10
Example 2: To increase the Gain of example (1) to 40, find the value of the resister (R2)
required? (Homework)
Non-inverting Configuration
Page 5 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
Let examine the above figure in more details, the input voltage is applied to the non-
inverting terminal. The output voltage drives a voltage divider consisting of Z1 and Z2.
The voltage at the inverting terminal Va, which is at the junction of the two resistors, is:
𝒁𝟏
𝑽𝒂 = 𝑽
𝒁𝟏 + 𝒁𝟐 𝒐
Since Vi equal to Va
𝑽𝒐 𝒁𝟏 + 𝒁𝟐
=
𝑽𝒊 𝒁𝟏
𝐕𝐨 𝒁𝟐
The Close loop Gain (A) = =1+
𝐕𝐢 𝒁𝟏
Example: compute the voltage gain and the output voltage for the non-
inverting OP-AMP circuit shown in figure below, given that Vi = 1 mV.
Solution:
𝒁𝟐
Voltage Gain (A) = 1 +
𝒁𝟏
120 𝐾𝛺
A=1+ =1+6= 7
60 𝐾𝛺
Page 6 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
V out = - Rf I
Vout = − Rf (I1 + I2 + …………. + IN)
Vin1 Vin2 V
Vout = − Rf ( + + …………. + 𝑅inN )
𝑅1 𝑅2 𝑁
𝑅 𝑅 𝑅
Vout = − (𝑅𝑓 Vin1 + 𝑅𝑓 Vin2 + …………. +𝑅 𝑓 VinN )
1 2 𝑁
If R1 = R2 = …………….. = RN = R
𝑅𝑓
V out =− 𝑅
(Vin1 + Vin2 + …………. + VinN )
If Rf = R
V out = − (Vin1 + Vin2 + …………. + VinN )
The above equation indicates that the circuit of the OP-AMP adder can be used to
find the negative sum of any number of input voltages.
The above circuit can also be used to find the average value of all input voltages.
𝑅𝑓
The ration 𝑅
is selected such that the sum of the input voltage is divided by the
number of the input voltages applied at the inverting input of the OP-AMP. For
𝑅𝑓 1 1
example, if we have three inputs voltages, hence the ration 𝑅
= 𝑛
= 3
. and overall
Page 7 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
Figure below shows the non-inverting summing, averaging OP-AMP. It can been
seen that the voltage sources Vin1, Vin2, …., VinN and the associated resistors R1, R2,
Vin1 Vin2
……….., RN can be replaced by the current sources whose values are: , ,
𝑅1 𝑅2
VinN
…………. , respectively.
𝑅𝑁
Page 8 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
𝑅3
𝑊ℎ𝑒𝑛 𝑉2 = 0, (𝑖𝑛𝑣𝑒𝑟𝑡𝑖𝑛𝑔)𝑡ℎ𝑒𝑛, 𝑉𝑜𝑢𝑡(𝑎) = − 𝑉1 � �
𝑅1
𝑅1 + 𝑅3
𝑤ℎ𝑒𝑛 𝑉1 = 0, (𝑁𝑜𝑛 − 𝑖𝑛𝑣𝑒𝑟𝑡𝑖𝑛𝑔)𝑡ℎ𝑒𝑛 𝑉𝑜𝑢𝑡(𝑏) = 𝑉𝑎 � �
𝑅1
𝑅4
𝑊ℎ𝑒𝑛 𝑉𝑎 = 𝑉𝑏 = 𝑉2 � �
𝑅2 + 𝑅4
𝑅4 𝑅1 + 𝑅3
𝑡ℎ𝑒𝑛, 𝑉𝑜𝑢𝑡(𝑏) = 𝑉2 � �� �
𝑅2 + 𝑅4 𝑅1
𝑆𝑖𝑛𝑐𝑒, 𝑉𝑜𝑢𝑡 = 𝑉𝑜𝑢𝑡(𝑎) + 𝑉𝑜𝑢𝑡(𝑏)
𝑅 𝑅4 𝑅1 + 𝑅3
𝑡ℎ𝑒𝑛, 𝑉𝑜𝑢𝑡 = − 𝑉1 �𝑅3 � + 𝑉2 �𝑅 � � �
1 2 + 𝑅4 𝑅1
A comparator is a circuit used to sense when a varying signal reaches some threshold
value. The simplest comparator circuit has the signal voltage directly to one of the input
terminals and a reference voltage to the other. When the OP-AMP is used open loop, its
output makes a transition between saturated states as the input signal passes through.
A basic OP-AMP comparator circuit can be used to detect either a positive or a negative
going input voltage depending upon which input of the operational amplifier we connect
the fixed reference voltage source and the input voltage too.
Page 9 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
8.1. Negative Voltage Comparator (inverting comparator) circuit detects when the
input signal Vin is BELOW or more negative than the reference voltage. Then the
comparator circuit will produce Vout which is HIGH as shown.
8.2. Positive Voltage Comparator (non-inverting) circuit detects when the input signal
Vin is ABOVE or more positive than the reference voltage then the circuit
produces an output at Vout which is HIGH as shown.
Page 10 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
( 𝑎𝑠𝑠𝑢𝑚𝑖𝑛𝑔 𝑉𝑜𝑢𝑡(0) = 0)
1 𝑡
𝑉𝑜𝑢𝑡(𝑡) = ∫0 𝑉𝑖𝑛 𝑑𝑡
−𝑅𝐶
Page 11 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
The basic operational amplifier differentiator circuit produces an output signal which is
the first derivative of the input signal. Figure below depicts the OP-AMP amplifier circuit.
𝐼𝑖𝑛 = 𝐼𝑓
𝑑𝑣𝑐 −𝑉𝑜𝑢𝑡
𝐶 =
𝑑𝑡 𝑅𝑓
𝑊ℎ𝑒𝑛 𝑉𝑐 = 𝑉𝑖𝑛
𝑑𝑣𝑖𝑛 −𝑉𝑜𝑢𝑡
𝐶 =
𝑑𝑡 𝑅𝑓
− 𝑉𝑜𝑢𝑡 𝑑𝑡 = 𝐶 𝑑𝑣𝑖𝑛 𝑅𝑓
𝑑𝑣𝑖𝑛
𝑉𝑜𝑢𝑡 = −𝐶 𝑅𝑓
𝑑𝑡
Page 12 of 12
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
Exercises
OP-AMP
Exercise 1: Compute the voltage gain Gv and then the output voltage Vout for the
inverting OP-AMP circuit shown in figure below, given that Vin = 1 mV.
Rf
120 K𝛺
R in
V in
20 K𝛺
V out
Solution:
Since the circuit is an inverting amplifier, then the voltage gain Gv is:
𝑅𝑓 120 KΩ
𝐺𝑣 = − = − =-6
𝑅𝑖𝑛 20 KΩ
And , Vout = Gv Vin = - 6 X 1mV = - 6 mV
Exercise 2: Compute the voltage gain Gv and then the output voltage Vout for the
non-inverting OP-AMP circuit shown in figure below, given that Vin = 1 mV.
Rf
120 K𝛺
R in
20 K𝛺
V out
V in
Page 1 of 6
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
𝑉𝑜𝑢𝑡 𝑅𝑓 120 𝐾𝛺
= 1+ =1+ = 1+6 =7
𝑉𝑖𝑛 𝑅𝑖𝑛 20 𝐾𝛺
Exercise 3: For the circuit shown in figure below, calculate the input voltage if the
final output voltage is 10.08 V.
10 K𝛺
5 K𝛺
5 K𝛺 100 K𝛺
5 K𝛺
Va 5 K𝛺
Vb
V0
V1
10.08 = −20 𝑉𝑏
𝑉𝑏 = − 0.504 𝑉
Then:
𝑉𝑏 5
= −
𝑉𝑎 5
𝑉𝑏 = − 𝑉𝑎
− 0.504 = − 𝑉𝑎
𝑉𝑎 = 0.504 𝑉𝑜𝑙𝑡
Finally:
Page 2 of 6
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
𝑉𝑎 10
=1+
𝑉1 5
10
𝑉𝑎 = � 1 + � 𝑉1
5
0.504 = 3 𝑉1
𝑉1 = 0.168 𝑉𝑜𝑙𝑡
R1 = 24 K𝛺 Rf
Vin1 24 K𝛺
R2 = 24 K𝛺
-2 V
R3 = 24 K𝛺 +12 V
-6 V
Solution:
𝑽𝒐𝒖𝒕 = −𝑹𝒇 𝑰 = − 𝑹𝒇 ( 𝑰𝟏 + 𝑰𝟐 + 𝑰𝟑 )
𝟏𝟐 = − 𝑽𝒊𝒏𝟏 + 2 + 6
𝑽𝒊𝒏𝟏 = −𝟒 𝑽𝒐𝒍𝒕
Page 3 of 6
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
Exercise 5: For the circuit shown below, calculate the output voltage, Vo if V1 = V2
= 700 mV.
500 K𝛺
500 K𝛺
V1 250 K𝛺
100 K𝛺
Va
Vo
50 K𝛺
V2
Solution:
𝑉𝑎 = −(500⁄250) 0.7
𝑉𝑎 = 1.4 𝑉𝑜𝑙𝑡
𝑉0 = 0 𝑉𝑜𝑙𝑡
Page 4 of 6
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
Exercise 6: The input voltage to the amplifier for the circuit on figure (a) is
explained in figure (b), find the output voltage assuming that the initial condition
is zero, that is, V0 = 0.
Solution:
𝒕
𝟏
𝑽𝒐𝒖𝒕 = − � 𝑽𝒊𝒏 𝒅𝒕
𝑹𝟏 𝑪
𝟎
Then , 𝑹𝟏 𝑪 = 1,
When 𝑽𝟎 = 𝟎,
𝟑 𝟑 𝟑
Then, 𝑽𝒐𝒖𝒕 = − ∫𝟎 𝑽𝒊𝒏 𝒅𝒕 = − ∫𝟎 𝟐 𝒅𝒕 = −𝟐𝒕 ⃒ = −𝟔
𝟎
Page 5 of 6
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
250 K𝛺
10 μF
Vin = 12t
Solution:
𝒅𝒗𝒊𝒏
𝑽𝑶𝒖𝒕 = −𝑹𝑪
𝒅𝒕
𝑹𝑪 = 𝟐𝟓𝟎 ∗ 𝟏𝟎𝟑 ∗ 𝟏𝟎 ∗ 𝟏𝟎−𝟔 = 𝟐. 𝟓
𝒅
𝑽𝒐𝒖𝒕 = −𝟐. 𝟓 (𝟏𝟐𝒕)
𝒅𝒕
𝑽𝒐𝒖𝒕 = −𝟑𝟎 𝒎𝑽
Page 6 of 6
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr. Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
Digital System
Electronic circuits can be divided into two broad categories: digital and analog.
• Digital electronic involves quantities with discrete values.
• Analog electronics involves quantities with continuous values
Digital representation has certain advantages over analog representation in electronics
applications:
1. Digital data can be processed and transmitted more efficiently and reliably than analog
data.
2. Digital data stored more compactly and reproduced with greater accuracy and clarity
than its analog form.
3. Noise (unwanted voltage fluctuations) does not affect digital data nearly as much as it
does analog signals.
Digital electronic involves circuits and systems in which there are only two possible states.
These states are represented by two different voltage levels: HIGH and LOW. In digital system
such as computers, combinations of the two states, called codes, are used to represent:
numbers, symbols, alphabetic characters, and others types of information. The two-state
number system is called binary and its two digits are 0 and 1.
Binary information that is handled by digital systems appears as waveforms that represent
sequences of bits. When the waveform is HIGH, a binary 1 is present, when the waveform is
LOW, a binary 0 is present. Each bit in a sequence occupies a defined time interval called a bit
time. All waveforms are synchronized with a basic timing waveform called the clock. The clock
is a periodic waveform in which each interval between pulses (the period) equals to the time
for one bit.
The term logic is applied to digital circuits used to implement logic functions. Several kinds of
digital logic circuits are the basic elements that from the building blocks of such complex digital
systems as the computer. The three basic logic operations are (NOT, AND, and OR). In logic
operations, the true/false conditions mentioned earlier are represented by HIGH (true) and a
LOW (false).
Page 1 of 11
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr. Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
The basic logic operations that have been mentioned and many more are available in
integrated circuit (IC) form. Digital systems have incorporated ICs for long because of their:
1. Small size.
2. High reliability
3. Low cost
4. Low power consumption.
An integrated circuit (IC) is an electronic circuit that is constructed entirely on a single small
chip of silicon. All the components that make up the circuit – transistors, diodes, resistors, and
capacitors are an integral part of that single chip. Digital ICs are classified into Fixed-function
logic and programmable logic. In fixed-function logic, the logic functions are set by the
manufacturer and cannot be altered.
Number System:
The binary number system and digital codes are fundamental to computers and digital
electronics in general. It is simply another way to represent quantities. The binary system is less
complicated than the decimal system because it has only two digits. While the decimal system
with its ten digits is a base-ten system, the binary system with its two digits is a base-two
system. The two binary digits (bits) are 1 and 0. The position of a 1 or 0 in a binary number
indicates its weight, or value within the number, just as the position of a decimal digit
determines the value of that digit. The weights in a binary number are based on powers of two.
Decimal Binary
10 10 10 102 101 100.10-1 10-2 10-3
5 4 3
2 2 2 2 2 20.2-1 2-2 2-3 2-4 2-5
5 4 3 2 1
Page 2 of 11
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr. Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
Logic Gates:
1. THE INVERTER (NOT circuit): performs the operation called inversion or
complementation. The inverter changes one logic level to the opposite level. In terms of
bits, it changes a 1 to a 0 and a 0 to a 1.
Logic expression:
𝑋 = 𝐴̅
Truth table:
Input Output
LOW (0) HIGH (1)
HIGH (1) LOW (0)
2. THE AND GATE: the AND gate is composed of two or more inputs and a single output. It
produces a HIGH output only when all of the inputs are HIGH. When any of the input is
LOW the output is LOW.
Logic expression:
𝑋 = 𝐴𝐵
Truth Table:
A B AB = X
0 0 0.0 = 0
0 1 0.1 = 0
1 0 1.0 = 0
1 1 1.1 =1
3. THE OR GATE: the OR gate has two or more inputs and one output. It produces a HIGH
on the output when any of the inputs is HIGH. The output is LOW only when all of the
inputs are LOW.
Page 3 of 11
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr. Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
Logical expression:
𝑋 =𝐴+𝐵
Truth table:
A B X
0 0 0
0 1 1
1 0 1
1 1 1
4. THE NAND GATE: the NAND gate perform an AND function with complemented
(inverted) output. It is equivalent to AND gate followed by an inverter. For 2 input NAND
gate, output X is LOW if inputs A and B are HIGH, X is HIGH if either A or B is LOW or
both A and B are LOW.
Logic expression:
𝑋 = ����
𝐴𝐵
Truth table:
A B ����
𝐴𝐵 = 𝑋
0 0 ����
0.0 = 0� = 1
0 1 ����
0.1 = 0� = 1
1 0 ����
1.0 = 0� = 1
1 1 ����
1.1 = 1� = 0
5. THE NOR GATE: the term NOR is a contraction of NOT-OR and implies an OR function
with an inverted (complemented) output. For 2 inputs NOR gate, output X is LOW if
Page 4 of 11
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr. Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
either input A or input B is HIGH, or if both A and B are HIGH. X is HIGH if both A and B
are LOW.
Logical expression:
𝑋 = ��������
𝐴+𝐵
Truth table:
A B ��������
𝐴+𝐵 =X
0 0 �������
0 + 0 = 0� = 1
0 1 �������
0 + 1 = 1� = 0
1 0 �������
1 + 0 = 1� = 0
1 1 �������
1 + 1 = 1� = 1
6. THE Exclusive-OR GATE: the output of an exclusive-OR gate is HIGH only when the two
inputs are at opposite logic levels. In other word, for an exclusive-OR gate, output X is
HIGH if input A is LOW and input B is HIGH , or if input A is HIGH and input B is LOW, X is
LOW if A and B are both HIGH or both LOW.
Truth table:
A B X
0 0 0
0 1 1
1 0 1
1 1 0
Page 5 of 11
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr. Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
7. THE Exclusive-NOR GATE: Like the XOR gate, XNOR has only two inputs. The bubble on
the output of the XNOR symbol indicates that its output is opposite that of the XOR
gate. When the two input logic levels are opposite, the output of the exclusive-NOR gate
is LOW. In other words, for an exclusive-NOR gate, output X is LOW if input A is LOW and
input B is HIGH, of if A is HIGH and B is LOW. X is HIGH if A and B are both HIGH and both
LOW.
Truth table:
A B X
0 0 1
0 1 0
1 0 0
1 1 1
Boolean algebra and Logic Simplification:
Boolean algebra is a convenient and systematic way of expressing and analyzing the operation
of logic circuits. This section covers the laws, rules and theorems of Boolean algebra and their
application to digital circuits. We will learn how to define a given circuit with Boolean
expressing and then evaluate its operation. We will also learn how to simplify logic circuits
using the methods of Boolean algebra and karnaugh maps. Boolean algebra is the mathematics
of digital systems. A basic knowledge of Boolean algebra is indispensable to the study and
analysis of logic circuits.
Complement: is the inverse of a variable and is indicated by bar over the variable (overbar). For
example the complement of the variable A is 𝐴̅. If A = 1 then 𝐴̅ = 0. And if A = 0 then 𝐴̅ = 1. The
complement of a variable is read as “not A” or “A bar”.
Page 6 of 11
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr. Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
A+B≡B+A
Commutative law of multiplication: the order in which the variables are ANDed makes no
difference.
A.B ≡ B.A
Page 7 of 11
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr. Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
Associative law of addition: when ORing more than two variables, the result is the same
regardless of the grouping of the variables.
A+(B+C) ≡ (A+B)+C
Associative law of multiplication: when ANDing more than two variables the order makes no
difference.
A.(B.C) ≡ (A.B).C
Distributive law: ORing two or more variable and then ANDing the result with a single
variable is equivalent to ANDing the single variable with each of the two or more variables
and then ORing the products.
A.(B+C) ≡ A.B+A.C
Page 8 of 11
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr. Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
� ≡ 1)
6. A variable ORed with its complement is always equal to 1 (A+𝑨
Page 9 of 11
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr. Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
� ≡ 0)
8. A variable ANDed with its complement is always equal to 0. (A.𝑨
� ≡ A)
9. The double complement of a variable is always equal to the variable. (𝑨
10. (A + AB ≡ A)
A + AB ≡ A ≡ A (1+B) Factoring (distribution law)
≡A . 1 : Rule 2: (1+B ≡ 1)
≡ A : Rule 4 (A.1 ≡ A)
� 𝑩 ≡ A + B)
11. (A + 𝑨
A+𝑨� B ≡ (A + AB) + 𝑨� B Rule 10 : A ≡ A + AB
≡ (AA + AB) + 𝑨 � B Rule 7: A ≡ AA
≡AA + AB + A𝑨 �+𝑨 � B Rule 8: adding A𝑨�≡ 0
� ) (A+B) Factoring
≡ (A + 𝑨
≡ 1 . (A +B) Rule 6: A + 𝑨�≡1
≡(A + B) Rule 4: drop the 1
Page 10 of 11
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr. Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
12. (A + B) (A + C) ≡ A + BC
(A + B)(A + C) ≡ AA + AC + AB + BC distributed law
≡ A + AC + AB + BC Rule 7 : AA ≡ A
≡ A (1 + C) + AB + BC Factoring (distribution law)
≡A . 1 + AB + BC Rule 2: 1 + C ≡ 1
≡ A (1 + B ) + BC Factoring (distribution law)
≡ A .1 + BC Rule 2: 1 + B ≡ 1
≡ A+ BC Rule 4: A . 1 ≡ A
Page 11 of 11
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
• Digital-to-Analog Converters:
Digital systems recognize only two levels of voltage referred to as HIGH and
LOW signals or as logical 1 and logical 0. This two-level scheme works well
with the binary numbers system. It is customary to indicate the HIGH
(logical 1) and LOW (logical 0) by Single-Pole-Double-Throw (SPDT) switches
that can be set to a positive non-zero voltage like 5 volts for HIGH and zero
volts or ground for LOW as shown in figure below.
Page 1 of 7
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
The first 16 binary numbers representing all possible combinations of the four
switches with voltage settings VA (least significant position) through VD (most
significant position) and their decimal equivalents are shown in table below:
Page 2 of 7
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
OR:
𝑹
𝑹𝒆𝒒 =
𝟏+𝟐+𝟒+𝟖
Since:
𝑽𝒂𝒏𝒂𝒍𝒐𝒈 = 𝑹𝒆𝒒 𝑰𝑻
𝑹 𝟏
𝑽𝒂𝒏𝒂𝒍𝒐𝒈 = ∗ ( 𝑽𝑨 + 𝟐𝑽𝑩 + 𝟒𝑽𝑪 + 𝟖𝑽𝑫 )
𝟏+𝟐+𝟒+𝟖 𝑹
𝑽𝑨 + 𝟐𝑽𝑩 + 𝟒𝑽𝑪 + 𝟖𝑽𝑫
𝑽𝒂𝒏𝒂𝒍𝒐𝒈 =
𝟏+𝟐+𝟒+𝟖
Page 3 of 7
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
The above figure show R-2R ladder network. It requires more resistors, but
only two sets of precision resistance values, R and 2R. The output analog
voltage Vanalog of the above figure can be obtained from the relation.
𝑽𝑨 + 𝟐𝑽𝑩 + 𝟒𝑽𝑪 + 𝟖𝑽𝑫
𝑽𝒂𝒏𝒂𝒍𝒐𝒈 =
𝟐𝒏
Where n is the number of digital inputs.
The problem with the DAC covered so far is that if one loads its output
(draw current from its output) the circuit will be unbalance. The loading
causes the circuit’s output voltage to change, and the circuit will no longer
accurately convert our digital to a proportional analog signal. To prevent
loading the DAC, it is good idea to add a unity-gain buffer to the output of
the DAC.
A typical example of four-bit DAC is illustrated in figure below; the four-bit
can be realized using the binary weighted resistors shown in figure below.
The bits are weighted according to the magnitude of their place value, so
that lesser bit has half the weight of the next higher bit. The output
(analog) related to the input (digital) shown in the following equation.
Page 4 of 7
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
𝑅𝑓 𝑅𝑓 𝑅𝑓 𝑅𝑓
− 𝑉𝑜 = 𝑉1 + 𝑉2 + 𝑉3 + 𝑉
𝑅1 𝑅2 𝑅3 𝑅4 4
The above figure shows a DAC connected to an inverting amplifier;
alternatively, a non-inverting op amp could be used with a positive value of
Vref.
Example 1: For the DAC circuit in the above figure, Given: Rf = 10 K, R1 = 10 K, R2 =
20 K𝛺, R3 = 40 K𝛺, R4 = 80 K𝛺 and Vref = 1 V.
Find the analog output voltage for the following digital input
[0000],[0001],[0010], …….., [1111].
Solution:
𝑅𝑓 𝑅𝑓 𝑅𝑓 𝑅𝑓
− 𝑽𝒐 = 𝑉1 + 𝑉2 + 𝑉3 + 𝑉
𝑅1 𝑅2 𝑅3 𝑅4 4
10 10 10 10
− 𝑽𝒐 = 𝑉1 + 𝑉2 + 𝑉3 + 𝑉
10 20 40 80 4
− 𝑽𝒐 = 𝑉1 + 0.5 𝑉2 + 0.25 𝑉3 + 0.125 𝑉4
Page 5 of 7
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
Example 2: Given the R-2R DAC circuit in figure below, find the output for the
digital input signal in the following table.
Page 6 of 7
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq
Solution:
Based on these results, we can plot the output versus the inputs voltages of the R-
2R network.
Page 7 of 7