You are on page 1of 82

Department 

of Computer Engineering Techniques (Stage: 3) 
Real‐Time system design 
Dr.: Hasanein Alharbi 
Hasanein.Y.M.Alharbi@mustaqbal‐college.edu.iq 
     

Chapter One: Basic Terms and Concepts

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.

Fig. 1: A general system with input and outputs

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 
     

Fig. 2: an example of a real-time system


Response Time: the time between the presentation of a set of input to a system and
the realization of the required behavior, including the availability of all associated
outputs, is called the response time of the system. How fast and punctual the response
time needs to be depends on the characteristics and purpose of the specific system.

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 
     

Fig. 3: A Model of a Real-Time System


Sensor: A sensor converts some physical characteristic of its environment into
electrical signals. An example of a sensor is photo-voltaic cell which converts light
energy into electrical energy. A wide variety of temperature and pressure sensors are
also used.
Actuator: an actuator is any device that takes its inputs from the output interface of a
computer and converts these electrical signals into some physical actions on its
environment. The physical actions may be in the form of motion, change of thermal,
electrical, pneumatic, or physical characteristics of some objects. A popular actuator is a
motor. Heaters are also very commonly used. Besides, several hydraulic and pneumatic
actuators are also popular.
Signal Conditioning Units: The electrical signals produced by a computer can rarely
be used to directly drive an actuator. The computer signals usually need conditioning
before they can be used by the actuator. This is termed output conditioning. Similarly,
input conditioning is required to be carried out on sensor signals before they can be
accepted by the computer. For example, analog signals generated by a photo-voltaic
cell are normally in the milli volts range and need to be conditioned before they can be
processed by a computer. The following are some important types of conditioning
carried out on raw signals generated by sensors and digital signal generated by
computers:
1. Voltage amplification: voltage amplification is normally required to be carried
out to match the full scale sensor voltage output with the full scale voltage input
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 
     
to the interface of a computer. For example, a sensor might produce voltage in
the milli volts range; whereas the input interface of a computer may require the
input signal level to be of the order of a volt.
2. Voltage level shifting: voltage level shifting is often required to align the voltage
level generated by a sensor with that acceptable to the computer. For example, a
sensor may produce voltage in the range -0.5 to +0.5 volt, whereas the input
interface of the computer may accept voltage only in the range of 0 to 1 volt. In
this case, the sensor voltage must undergo level shifting before it can be used by
the computer.
3. Frequency range shifting and filtering: frequency range shifting is often used
to reduce the noise components in a signal. Many types of noise occur in narrow
bands and the signal must be shifted from the noise bands so that noise can be
filtered out.
4. Signal mode conversion: a type of signal mode conversion that is frequently
carried out during signal conditioning involves changing direct current into
alternating current and vice-versa. Another type signal mode conversion that is
frequently used is conversion of analog signals to a constant amplitude pulse
train such that the pulse rate or pulse width is proportional to the voltage level.
Conversion of analog signals to a pulse train is often necessary for input to
systems such as transformer coupled circuits that do not pass direct current.
Interface Unit: normally commands from the CPU are delivered to the actuator through
an output interface. An output interface converts the stored voltage into analog form and
then outputs this to the actuator circuitry. This of course would require the value
generated to be written on a register. In an output interface, in order to produce an
analog output, the CPU selects a data register of the output interface writes the
necessary data to it. The interface takes care of the buffering and the handshake control
aspects. Analog to digital conversion is frequently deployed in an input interface.
Similarly, digital to analog conversion is frequently used in an output interface.

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:

1. Hardware (CPU, I/O devices, memory ….etc)


a. Single CPU or more.
b. Clock
2. Real time operating system: function as a standard OS, with predictable behavior
and well-defined functionality.
3. A collection of RT task/processes (share resources; communicate/synchronize
with each other and the environment).

Fig. 4: overall structure of RTS


Types of Real-Time Tasks: we have already seen that a real-time task is one for which
quantitative expressions of time are needed to describe its behavior. This quantitative
expression of time usually appears in the form of a constraint on the time at which the
task produces results. The most frequently occurring timing constraint is a deadline
constraint which used to express a task is required to compute its results within some
deadline. A real-time task can be classified into either hard, soft, or firm real-time task
depending on the consequences of a task missing its deadline.

1. Hard Real-Time Tasks: A hard real-time task is one that is constrained to


produce it results within certain predefined time bounds. The system is

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.

Application of Real-Time Systems

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.

1. Industrial Applications: industrial applications constitute a major usage area of


real-time systems. A few examples of industrial applications of real-time systems
are: process control systems, industrial automation systems, SCADA
applications, test and measurement equipments, and robotic equipments.
a. Example 1: Chemical Plant Control
In an automated chemical plant, a real-time computer periodically
monitors plant conditions. The plant conditions are determined based on
current readings of pressure, temperature, and chemical concentration of
the reaction chamber. These parameters are sampled periodically. Based
on the values sampled at any time, the automation system decides on the
corrective actions necessary at that instant to maintain the chemical
reaction at a certain rate. Each time the plant conditions are sample, the
automation system should decide on the exact instantaneous corrective
actions required such as changing the pressure, temperature, or chemical
concentration and carry out these actions within certain redefined tie
bounds. Typically, the time bounds in such a chemical plant control
application range from a few micro seconds to several milli seconds.

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.

Mathematically, any signal can be represented as a function of one or more


independent variables. Therefore:

Signal is defined as any physical quantity that varies with one or more
independent variables.

X1 (t) = 0.7 t (vary linearly with time)

X2 (t) = 1.8 t2 (vary quadratically with time)

X(p,q) = 0.6p+0.5q + 1.1 q2

Usually, the information carried by a signal will be a function of independent


variable, one or more. The independent variable can be time, spatial coordinates,
intensity of colors, pressure, temperature, etc.

Amplitude is the value of a signal at any specified value of the independent


variable.

Waveform is the sketch or plot of the amplitude of a signal as a function of


independent variable.

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

are called one-channel signals. For example, the record of

temperature with respect to time is an example of one-channel

signal.

ii. Multichannel signals: signals that are generated by multiple sources

or sensors are called multichannel signals. The record of ECG

(Electro Cardio Graph) at eight different places in a human body is

an example of eight-channel signal.

b. Depending on the number of independent variables

i. One-dimensional signals: A signal which is a function of single

independent variable is called one-dimensional signal.

X1 (t) = 0.7 t

ii. Multidimensional signals: a signal which is a function of two or more

independent variables is called multidimensional signal.

X(p,q) = 0.6p+0.5q + 1.1 q2

c. Depending on whether the independent variable is continuous or discrete.

i. Analog or continuous signals: when a signal is defined continuously

for any value of independent variable, it is called analog or

continuous signal. Most of the signals encountered in science and

engineering are analog in nature.

ii. Discrete signals: When a signal is defined for discrete intervals of

independent variable, it is called discrete signal.

In this lecture we will focus on the following types of signals.

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

signal is denoted as “X(t)”.

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

and the independent variable are continuous.

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

signal is called discrete time signal.

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.

The DTS is denoted by “X[n]”.

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 
     

3. Periodic signals, nonperiodic signals.

A periodic signal X(t) is a function that satisfies the following condition:

X(t) = X(t + T) for all t

Where T is a positive constant. The smallest value of T that satisfies the above

equation is called the fundamental period of X(t).

On the other hand, any signal X(t) for which there is no value of T satisfy the

condition is called nonperiodic signal.

Figure below presents examples of periodic and nonperiodic signals.

The classification of signals into periodic and nonperiodic signals presented thus

far applies to continous-time signals.

Hereafter, we consider the case of discrete-time signals. A discrete-time signal

X[n] is said to be periodic if it satisfies the condition:

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

Where N is a positive integer.

The smallest value of integer N for which the above equation is satisfied is called

the fundamental period of the discrete-time signal X[n].

4. Basic Operation on Signals

An issue of fundamental importance is the study of signals and system is the use

of systems to process or manipulate signals. This issue usually involves a

combination of some basic operations. In particular, we may identify two classes

of operations, as described here.

a. Operation performed on dependent variables.

i. Amplitude scaling (amplification) : Let X(t) denote a continuous-time

signal. The signal Y(t) resulting from amplitude scaling applied to

X(t) is defined by.

Y(t) = C X(t)

Where C is the scaling factor, and example of physical device that

performs amplitude scaling is an electronic amplifier.

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 :

Y(t) = X1(t) + X2(t)

For discrete-time signals we write:

Y[n] = X1[n] + X2[n]

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.

iii. Multiplication: let X1(t) and X2(t) denote a pair of continuous-time

signals. The signal Y(t) resulting from the multiplication of X1(t) by

X2(t) is defined by the following equation :

Y(t) = X1(t) X2(t)

That is, for each prescribed time t the value of Y(t) is given by the

product of the corresponding values of X1(t) and X2(t).

For discrete-time signals we write:

Y[n] = X1[n] X2[n]

b. Operations performed on the independent variable

i. Time scaling: let X(t) denote a continuous-time signal. The signal

Y(t) obtained by scaling the independent variable, time t, by a factor

“a” is defined by the following equation:

Y(t) = X(at)

If a > 1, the signal Y(t) is a compressed version of X(t).

If 0 < a < 1, the signal Y(t) is an expanded (stretched) version of

X(t).

These two operations are illustrated in figure below.

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

the signal obtained by replacing time t with –t, as shown by

Y(t) = X(-t)

The signal Y(t) represents a reflected version of X(t) about the

amplitude axis. Figure below shows the reflection operations.

iii. Time shifting: let X(t) denote a continuous-time signal. The time-

shifted version of X(t) is defined by:

Y(t) =X (t - t0)

Where t0 is the time shift.

If the t0 > 0 the waveform representing X(t) is shifted intact to the

right, relative to the time axis.

If t0 < 0 the waveform representing X(t) is shifted to the left, relative

to the time axis.

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

equal to 2 time units. Hence, by shifting X(t) to the right by 2 time

unit we get the rectangular pulse Y(t) as shown in figure below.

5. Precedence Rule for Time Shifting and Time Scaling

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

operation always replaces t by t – b. Hence the time-shifting operation is

performed first on X(t), resulting in intermediate signal V(t). Next, the time-

scaling operation is performed on V(t).

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

Analog Computer Components, Systems

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 analogue machine is in no sense a replacement or substitute for the digital


machine, and indeed it is rare to find problems which can be solved equally well by
either type, and hence the present-day effort being put into the development of hybrid
machines.

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

Digital machines handle quantities represented as integral numbers of electrical pulses.


Hence, continuous changes in the values of variables cannot be represented exactly,
because the number of pulses representing a quantity cannot change by less than a
single pulse. Despite its various advantages, for certain classes of problems digital
machines are much slower than analogue machines. Additionally, digital machines need
a central set of equipment for pulse generating which does not alter rapidly in size as
the capacity of the machine changes and its size cannot be reduced below a certain
minimum. Hence the machine cannot be smaller than this central equipment allows.

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.

Analogue machine need no central set of equipment corresponding to the pulse-


generating equipment of the digital machine, and it is economical and practical to build
quite small machines and extend these later if required.

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.

4. Operational Amplifiers (OP-AMP)

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 implied relationship among input and out variables is:

Vout = a (V+ – V-) Where a is the open loop gain

• 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

To calculate the closed-loop gain two conditions must satisfied.

1. The differential input voltage is zero.


2. No current flows into either input terminal of the ideal amplifier.

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)

5.2. The Non-inverting configuration:

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 𝐾𝛺

Vout = A Vin = 7 * 1 mV = 7 mV.

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

6. The OP-AMP as Adder (Summing) and Averaging Circuit.


The figure below shows the basic inverting summing and averaging OP-AMP circuit.

In the above circuit, the total current is:


I = I1 + I2 + …………. + IN
Vin1 Vin2 VinN
𝐼1 = , 𝐼2 = ,………….. , 𝐼𝑁 =
𝑅1 𝑅2 𝑅𝑁

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

equation will be : V out = − (Vin1 + Vin2 + Vin3 ) / 3.

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.
𝑅𝑁

7. The OP-AMP as Differential (subtraction) Circuit:


The subtraction OP-AMP amplifier amplifies the voltage difference present on it
inverting and non-inverting inputs. Figure below shows the OA-AMP as difference
(subtraction) circuit.

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

The differential amplifier circuit allows input signals to be applied simultaneously to


both input terminals and produce an output of the difference between the input
signals. However, to solve for Vout we will connect each input to ground in turn.
Consequently, the rules of inverting and non-inverting circuits will be applied.
𝑉𝑎 = 𝑉𝑏
𝑅4
𝑉𝑏 = 𝑉2 �𝑅 + 𝑅4

2

𝑅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

𝑆𝑝𝑒𝑖𝑐𝑎𝑙 𝑐𝑎𝑠𝑒 (1): 𝑖𝑓 𝑅1 = 𝑅2 = 𝑅3 = 𝑅4


𝑇ℎ𝑒𝑛 ∶ 𝑉𝑜𝑢𝑡 = 𝑉2 − 𝑉1
𝑆𝑝𝑒𝑖𝑐𝑎𝑙 𝑐𝑎𝑠𝑒 (2): 𝑖𝑓 𝑅1 = 𝑅2 𝑎𝑛𝑑 𝑅3 = 𝑅4
𝑅3
𝑇ℎ𝑒𝑛, 𝑉𝑜𝑢𝑡 = [𝑉2 − 𝑉1 ]
𝑅1
8. The OP-AMP as Comparator Circuit:

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.

9. The OP-AMP as Integrator Circuit


As its name implies, the OP-AMP integrator is an operational amplifier circuit that
performs the mathematical operational of integration. Figure below shows the OP-
AMP integrator circuit.

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

According to the above circuit the Vout is:


𝑉𝑖𝑛
𝐼1 =
𝑅𝑖𝑛
𝑑 𝑉𝑜𝑢𝑡
𝐼2 = −𝐶
𝑑𝑡
(𝐴𝑐𝑐𝑜𝑟𝑑𝑖𝑛𝑔 𝑡𝑜 𝐶𝑎𝑝𝑎𝑠𝑖𝑡𝑜𝑟 𝑐𝑢𝑟𝑟𝑒𝑛𝑡 𝑙𝑜𝑤)
𝑆𝑖𝑛𝑐𝑒: 𝐼1 = 𝐼2
𝑉𝑖𝑛 𝑑 𝑉𝑜𝑢𝑡
= −𝐶
𝑅 𝑑𝑡
− 𝑅𝐶 𝑑 𝑉𝑜𝑢𝑡 = 𝑉𝑖𝑛 𝑑 𝑡
1
𝑑 𝑉𝑜𝑢𝑡 = 𝑉 𝑑𝑡
− 𝑅𝐶 𝑖𝑛
𝑡 1 𝑡
∫0 𝑑𝑣𝑜𝑢𝑡 = −𝑅𝐶 ∫0 𝑉𝑖𝑛 𝑑𝑡
1 𝑡
𝑉𝑜𝑢𝑡(𝑡) − 𝑉𝑜𝑢𝑡(0) = ∫0 𝑉𝑖𝑛 𝑑𝑡
−𝑅𝐶

( 𝑎𝑠𝑠𝑢𝑚𝑖𝑛𝑔 𝑉𝑜𝑢𝑡(0) = 0)
1 𝑡
𝑉𝑜𝑢𝑡(𝑡) = ∫0 𝑉𝑖𝑛 𝑑𝑡
−𝑅𝐶

Capacitor current law:


𝑞
𝐶=
𝑣
𝑞=𝑐𝑣
𝑑𝑞 dv
=𝐶
𝑑𝑡 dt
dv
𝐼=𝐶
dt

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

10. The OP-AMP as Differentiator Circuit:

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.

According to the above circuit Vout is equal to:

𝐼𝑖𝑛 = 𝐼𝑓

𝑑𝑣𝑐 −𝑉𝑜𝑢𝑡
𝐶 =
𝑑𝑡 𝑅𝑓

𝑊ℎ𝑒𝑛 𝑉𝑐 = 𝑉𝑖𝑛

𝑑𝑣𝑖𝑛 −𝑉𝑜𝑢𝑡
𝐶 =
𝑑𝑡 𝑅𝑓

− 𝑉𝑜𝑢𝑡 𝑑𝑡 = 𝐶 𝑑𝑣𝑖𝑛 𝑅𝑓

𝑑𝑣𝑖𝑛
𝑉𝑜𝑢𝑡 = −𝐶 𝑅𝑓
𝑑𝑡

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 𝐾𝛺

And thus, 𝑉𝑜𝑢𝑡 = 𝐺𝑣 𝑉𝑖𝑛 = 7 ∗ 1 = 7 𝑚𝑉

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

Note: have to work backwards.


𝑉𝑜 100 𝐾𝛺
= −
𝑉𝑏 5 𝐾𝛺

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 𝑉𝑜𝑙𝑡

Exercise 4: Calculate the value of (Vin1) from the circuit below.

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:

First OP-AMP work as inverting OP-AMP, hence:


𝑉𝑎 500
= −
𝑉1 250

𝑉𝑎 = −(500⁄250) 0.7

𝑉𝑎 = 1.4 𝑉𝑜𝑙𝑡

Second OP-AMP work as summing OP-AMP:

𝑉𝑜 = −500 [ 𝑉𝑎 ⁄100 + 𝑉2 ⁄50]

𝑉𝑜 = −500 [ − 1.4⁄100 + 0.7⁄50]

𝑉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:
𝒕
𝟏
𝑽𝒐𝒖𝒕 = − � 𝑽𝒊𝒏 𝒅𝒕
𝑹𝟏 𝑪
𝟎

Since 𝑹𝟏 = 𝟏𝟎𝟔 and 𝑪 = 𝟏𝟎−𝟔

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

Exercise 7: The OP-AMP circuit in figure below has R = 250 K𝛺 , C = 10 μF and


input voltages is 12t mV, Find the output voltage.

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

detail the functionalities (activities) of each component?

Q 3. Compare among Hard, Firm and Soft Real‐Time System tasks?

Q4. What are the main Characteristics of Real Time System?

Q5. Explain only five Applications of Real-Time Systems?

Q6. What is signal? Discus five types of signals?

Q7. What is main difference between Digital Machines and Analog Machines?

Q8.Find the closed loop gain of the following inverting

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?

Q11. Define and give example for each of the following


- Sensor - Actuator - Signal Conditioning
Units
- Interface Unit

Q12. What is the Structure of RTS? Draw the diagram of RTS.

Q13. Give some important types of Signal Conditioning Units?

Q14. Compare between Amplitude and Waveform?

Q15. Clarify the Basic Operation implemented on Signals?


Page 1 of 1
Department of Computer Engineering Techniques (Stage: 3)
Real-Time system design
Dr.: Hasanein Alharbi
Hasanein.Y.M.Alharbi@mustaqbal-college.edu.iq

Analog Computer Components, Systems

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 analogue machine is in no sense a replacement or substitute for the digital


machine, and indeed it is rare to find problems which can be solved equally well by
either type, and hence the present-day effort being put into the development of hybrid
machines.

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

Digital machines handle quantities represented as integral numbers of electrical pulses.


Hence, continuous changes in the values of variables cannot be represented exactly,
because the number of pulses representing a quantity cannot change by less than a
single pulse. Despite its various advantages, for certain classes of problems digital
machines are much slower than analogue machines. Additionally, digital machines need
a central set of equipment for pulse generating which does not alter rapidly in size as
the capacity of the machine changes and its size cannot be reduced below a certain
minimum. Hence the machine cannot be smaller than this central equipment allows.

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.

Analogue machine need no central set of equipment corresponding to the pulse-


generating equipment of the digital machine, and it is economical and practical to build
quite small machines and extend these later if required.

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.

4. Operational Amplifiers (OP-AMP)

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 implied relationship among input and out variables is:

Vout = a (V+ – V-) Where a is the open loop gain

• 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

To calculate the closed-loop gain two conditions must satisfied.

1. The differential input voltage is zero.


2. No current flows into either input terminal of the ideal amplifier.

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)

5.2. The Non-inverting configuration:

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 𝐾𝛺

Vout = A Vin = 7 * 1 mV = 7 mV.

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

6. The OP-AMP as Adder (Summing) and Averaging Circuit.


The figure below shows the basic inverting summing and averaging OP-AMP circuit.

In the above circuit, the total current is:


I = I1 + I2 + …………. + IN
Vin1 Vin2 VinN
𝐼1 = , 𝐼2 = ,………….. , 𝐼𝑁 =
𝑅1 𝑅2 𝑅𝑁

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

equation will be : V out = − (Vin1 + Vin2 + Vin3 ) / 3.

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.
𝑅𝑁

7. The OP-AMP as Differential (subtraction) Circuit:


The subtraction OP-AMP amplifier amplifies the voltage difference present on it
inverting and non-inverting inputs. Figure below shows the OA-AMP as difference
(subtraction) circuit.

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

The differential amplifier circuit allows input signals to be applied simultaneously to


both input terminals and produce an output of the difference between the input
signals. However, to solve for Vout we will connect each input to ground in turn.
Consequently, the rules of inverting and non-inverting circuits will be applied.
𝑉𝑎 = 𝑉𝑏
𝑅4
𝑉𝑏 = 𝑉2 �𝑅 + 𝑅4

2

𝑅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

𝑆𝑝𝑒𝑖𝑐𝑎𝑙 𝑐𝑎𝑠𝑒 (1): 𝑖𝑓 𝑅1 = 𝑅2 = 𝑅3 = 𝑅4


𝑇ℎ𝑒𝑛 ∶ 𝑉𝑜𝑢𝑡 = 𝑉2 − 𝑉1
𝑆𝑝𝑒𝑖𝑐𝑎𝑙 𝑐𝑎𝑠𝑒 (2): 𝑖𝑓 𝑅1 = 𝑅2 𝑎𝑛𝑑 𝑅3 = 𝑅4
𝑅3
𝑇ℎ𝑒𝑛, 𝑉𝑜𝑢𝑡 = [𝑉2 − 𝑉1 ]
𝑅1
8. The OP-AMP as Comparator Circuit:

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.

9. The OP-AMP as Integrator Circuit


As its name implies, the OP-AMP integrator is an operational amplifier circuit that
performs the mathematical operational of integration. Figure below shows the OP-
AMP integrator circuit.

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

According to the above circuit the Vout is:


𝑉𝑖𝑛
𝐼1 =
𝑅𝑖𝑛
𝑑 𝑉𝑜𝑢𝑡
𝐼2 = −𝐶
𝑑𝑡
(𝐴𝑐𝑐𝑜𝑟𝑑𝑖𝑛𝑔 𝑡𝑜 𝐶𝑎𝑝𝑎𝑠𝑖𝑡𝑜𝑟 𝑐𝑢𝑟𝑟𝑒𝑛𝑡 𝑙𝑜𝑤)
𝑆𝑖𝑛𝑐𝑒: 𝐼1 = 𝐼2
𝑉𝑖𝑛 𝑑 𝑉𝑜𝑢𝑡
= −𝐶
𝑅 𝑑𝑡
− 𝑅𝐶 𝑑 𝑉𝑜𝑢𝑡 = 𝑉𝑖𝑛 𝑑 𝑡
1
𝑑 𝑉𝑜𝑢𝑡 = 𝑉 𝑑𝑡
− 𝑅𝐶 𝑖𝑛
𝑡 1 𝑡
∫0 𝑑𝑣𝑜𝑢𝑡 = −𝑅𝐶 ∫0 𝑉𝑖𝑛 𝑑𝑡
1 𝑡
𝑉𝑜𝑢𝑡(𝑡) − 𝑉𝑜𝑢𝑡(0) = ∫0 𝑉𝑖𝑛 𝑑𝑡
−𝑅𝐶

( 𝑎𝑠𝑠𝑢𝑚𝑖𝑛𝑔 𝑉𝑜𝑢𝑡(0) = 0)
1 𝑡
𝑉𝑜𝑢𝑡(𝑡) = ∫0 𝑉𝑖𝑛 𝑑𝑡
−𝑅𝐶

Capacitor current law:


𝑞
𝐶=
𝑣
𝑞=𝑐𝑣
𝑑𝑞 dv
=𝐶
𝑑𝑡 dt
dv
𝐼=𝐶
dt

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

10. The OP-AMP as Differentiator Circuit:

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.

According to the above circuit Vout is equal to:

𝐼𝑖𝑛 = 𝐼𝑓

𝑑𝑣𝑐 −𝑉𝑜𝑢𝑡
𝐶 =
𝑑𝑡 𝑅𝑓

𝑊ℎ𝑒𝑛 𝑉𝑐 = 𝑉𝑖𝑛

𝑑𝑣𝑖𝑛 −𝑉𝑜𝑢𝑡
𝐶 =
𝑑𝑡 𝑅𝑓

− 𝑉𝑜𝑢𝑡 𝑑𝑡 = 𝐶 𝑑𝑣𝑖𝑛 𝑅𝑓

𝑑𝑣𝑖𝑛
𝑉𝑜𝑢𝑡 = −𝐶 𝑅𝑓
𝑑𝑡

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 𝐾𝛺

And thus, 𝑉𝑜𝑢𝑡 = 𝐺𝑣 𝑉𝑖𝑛 = 7 ∗ 1 = 7 𝑚𝑉

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

Note: have to work backwards.


𝑉𝑜 100 𝐾𝛺
= −
𝑉𝑏 5 𝐾𝛺

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 𝑉𝑜𝑙𝑡

Exercise 4: Calculate the value of (Vin1) from the circuit below.

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:

First OP-AMP work as inverting OP-AMP, hence:


𝑉𝑎 500
= −
𝑉1 250

𝑉𝑎 = −(500⁄250) 0.7

𝑉𝑎 = 1.4 𝑉𝑜𝑙𝑡

Second OP-AMP work as summing OP-AMP:

𝑉𝑜 = −500 [ 𝑉𝑎 ⁄100 + 𝑉2 ⁄50]

𝑉𝑜 = −500 [ − 1.4⁄100 + 0.7⁄50]

𝑉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:
𝒕
𝟏
𝑽𝒐𝒖𝒕 = − � 𝑽𝒊𝒏 𝒅𝒕
𝑹𝟏 𝑪
𝟎

Since 𝑹𝟏 = 𝟏𝟎𝟔 and 𝑪 = 𝟏𝟎−𝟔

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

Exercise 7: The OP-AMP circuit in figure below has R = 250 K𝛺 , C = 10 μF and


input voltages is 12t mV, Find the output voltage.

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

Logic Gates: Basic building elements of digital systems

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.

Terms used in Boolean algebra


Variable: is a symbol (usually an italic uppercase letter) used to represent a logical quantity.
Any single variable can have a 1 or 0 value.

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

Literal: is a variable of the complement of a variable.

Boolean Operation and Expressions


Boolean Addition
Boolean addition is equivalent to the OR operation.

Sum example of addition terms are: A + B, A + 𝐵�


Boolean Multiplication
Boolean multiplication is equivalent to the AND operation

Sum example of addition terms are: AB, A𝐵�, ABC

Laws and Rules of Boolean Algebra


Commutative law of addition: the order in which the variables are ORed makes no difference.

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

Rules of Boolean Algebra


1. A variable ORed with 0 is always equal to the variable (A + 0 ≡ A)

2. A variable ORed with 1 is always equal to 1 ( A + 1 ≡ 1)

3. A variable ANDed with 0 is always equal to 0. (A . 0 ≡ 0)

4. A variable ANDed with 1 is always equal to the variable. (A . 1 ≡ 1)

5. A variable ORed with itself is always equal to the variable ( A+A ≡ A)

� ≡ 1)
6. A variable ORed with its complement is always equal to 1 (A+𝑨

7. A variable ANDed with itself is always equal to the variable ( A.A ≡ 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 (DAC)


AND
Analog to Digital (ADC)
Converters
Electric voltage and current signals are often referred to as analog signals. Analog
signals must be converted to digital signals prior to input into computers. Analog
to Digital Converters (ADCs) are used to convert analog signals to digital signals.
Inversely, the computer output that is in digital form must sometimes be
converted to analog signal prior to input to an electrical device. Digital to Analog
Converters (DACs) are used to perform this operation. In this chapter we will
examine the important characteristics associated with ADC/DAC converters.

• 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.

In the above figure, 𝑉𝐷 = 0, 𝑉𝐶 = 1, 𝑉𝐵 = 0 𝑎𝑛𝑑 𝑉𝐴 = 1, that is, switches A


and C are HIGH (5 volts) and switches B and D are LOW (0 volts).

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:

A digital to analog (DAC) converter is used to convert a binary output from a


digital system to an equivalent analog voltage. If there are 16 combinations of the
voltages VD through VA, the analog device should have 16 possible values. For
example, since the binary number 1010 (decimal 10) is twice the value of the
binary number 0101 (decimal 5), an analog equivalent voltage of 1010 must be
double the analog voltage representing 0101.

• DAC (Binary-Weighted Resistors):

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

Digital-to-Analog converter using binary-weighted resistors


𝑽𝑨 + 𝟐𝑽𝑩 + 𝟒𝑽𝑪 + 𝟖𝑽𝑫 + … .
𝑽𝒂𝒏𝒂𝒍𝒐𝒈 =
𝟏 + 𝟐 + 𝟒 + 𝟖 + ⋯..
Prove:
𝑰𝑻 = 𝑰𝑨 + 𝑰𝑩 + 𝑰𝑪 + 𝑰𝑫
𝑽𝑨 𝑽𝑩 𝑽𝑪 𝑽𝑫
𝑰𝑻 = + + +
𝑹 𝑹� 𝑹� 𝑹�
𝟐 𝟒 𝟖
𝟏
𝑰𝑻 = ( 𝑽𝑨 + 𝟐𝑽𝑩 + 𝟒𝑽𝑪 + 𝟖𝑽𝑫 )
𝑹

Using parallel resistor law:


𝟏 𝟏 𝟏 𝟏 𝟏
= + + +
𝑹𝒆𝒒 𝑹 𝑹� 𝑹� 𝑹�
𝟐 𝟒 𝟖

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 binary-weighted resistors shown in figure above have the disadvantage


that it requires a large number of precision resistors.
• R-2R ladder network:

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

Input Digital Signals:

Solution:

𝑽𝑨 + 𝟐𝑽𝑩 + 𝟒𝑽𝑪 + 𝟖𝑽𝑫 𝟏∗ 𝟖 + 𝟐∗ 𝟖+ 𝟒 ∗ 𝟖 + 𝟖 ∗ 𝟖


a) 𝑉𝑎𝑛𝑎𝑙𝑜𝑔 = = = 𝟕. 𝟓 𝑽
𝟐𝒏 𝟐𝟒
𝑽𝑨 + 𝟐𝑽𝑩 + 𝟒𝑽𝑪 + 𝟖𝑽𝑫 𝟏∗ 𝟖 + 𝟐∗ 𝟎+ 𝟒 ∗ 𝟎 + 𝟖 ∗ 𝟖
b) 𝑉𝑎𝑛𝑎𝑙𝑜𝑔 = = = 𝟒. 𝟓 𝑽
𝟐𝒏 𝟐𝟒
𝑽𝑨 + 𝟐𝑽𝑩 + 𝟒𝑽𝑪 + 𝟖𝑽𝑫 𝟏∗ 𝟖 + 𝟐∗ 𝟎+ 𝟒 ∗ 𝟖 + 𝟖 ∗ 𝟎
c) 𝑉𝑎𝑛𝑎𝑙𝑜𝑔 = = = 𝟐. 𝟓 𝑽
𝟐𝒏 𝟐𝟒
𝑽𝑨 + 𝟐𝑽𝑩 + 𝟒𝑽𝑪 + 𝟖𝑽𝑫 𝟏∗ 𝟎 + 𝟐∗ 𝟖+ 𝟒 ∗ 𝟎 + 𝟖 ∗ 𝟎
d) 𝑉𝑎𝑛𝑎𝑙𝑜𝑔 = = = 𝟏. 𝟎 𝑽
𝟐𝒏 𝟐𝟒

Based on these results, we can plot the output versus the inputs voltages of the R-
2R network.

Page 7 of 7

You might also like