Uploaded by Lalmani Jaishi

Instrumentation II by Hari Aryal

advertisement
Instrumentation II
Chapter 1: Microprocessor Based Instrumentation System
Chapter – 1
Microprocessor Based Instrumentation System
ed
u.
np
Microprocessor: A Microprocessor is a multipurpose programmable, clock driven,
register based electronic device fabricated using signal integrations from SSI to VLSI that
reads binary instructions from a storage device called memory, accepts binary data as
input, processes data according to those instructions and provide result s as output.
Instrumentation System: The system which is defined as the assembly of various
instruments and other components interconnected to measure, analyze and control
physical quantities such as electrical, thermal, mechanical etc.
io
en
ot
es
.
Microprocessor based Instrumentation System: Any instrumentation systems centered
around a microprocessor are known as microprocessor based system. Logical and
computing power of microprocessor has extended the capabilities of many basic
instruments, improving accuracy and efficiency of use. Microprocessor is versatile device
for use in any instrumentation system. Examples are ATM, automatic washing machine,
fuel control, oven etc.
m
Why microprocessor?
 Can be used in any system.
 Can be used in specific applications and specific design.
 Logical and computational power of microprocessor has been used to develop
more accurate and efficient system.
de
d
fro
Why, not Microprocessor?
 Complexity in interfacing.
 Need to learn complex machine dependent language.
 Need of an expensive microprocessor development system.
But all these problems are accepted if system designed sells a number of units so that
the development cost spreads out.
D
ow
nl
oa
Features for selecting microprocessor
 How fast the data has to be processed
 Cost-amount of memory intelligence
 Complexity of work
 Field for which system is designed
1.1
Basic Features of Microprocessor Based System
 Three components: Microprocessor, I/O, and memory
 Decision making power based on previous entered values
 Repeatability of readings
 User friendly (Signal readout)
 Parallel processing
 Timeshare and multiprocessing
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Fowler |
1
Instrumentation II



Data storage, retrieval and transmission
Effective control of multiple equipments on time sharing basis
A lot of processing capability
Open Loop and Closed Loop Microprocessor Based System
Any instrumentation system can be controlled by microprocessor in two ways
open loop control system and closed loop control system.
ed
u.
np
1.2
Chapter 1: Microprocessor Based Instrumentation System
ot
es
.
Open loop control system
 Microprocessor gives output of control variable in the form of some display to
human operator and then on the basis of displayed information, the human
operator makes changes in the necessary control inputs.
 Example: pressure and temperature monitoring system in any chemical
processing plant
 It is simple, low cost and used when feedback is not critical.
Pressure (Analog
Signal)
ADC
io
en
Data / Address / Control Bus
RAM
Memory
Panel
Interface
Microprocesor
Panel

fro
d

Upper and lower limit of desired pressure is set
Pressure is converted to digital form to be fed to microprocessor
The microprocessor compares a sample of pressure measurement with present
pressure limits.
If sample is beyond limits, the microprocessor indicates in form of come
alarm or lamp.
So, according to output signal, human operator makes necessary changes.
de



m
Fig: Block diagram of pressure monitoring system - Open loop control
D
ow
nl
oa
Closed loop control system
 Microprocessor monitors the process variables continuously and then supplies
the output signal to the electromechanical devices, which in turn controls the
values of process variables.
 Example: automatic temperature control system in an oven
 Accurate and Adaptive
 No human operator required
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Fowler |
2
Chapter 1: Microprocessor Based Instrumentation System
DAC
To Heater
Control System
Port
RAM
Data / Address / Control Bus
Panel
ot
es
.
Temperature of
Oven
Microprocesor
Panel
Interface
port
ed
u.
np
Instrumentation II
ADC

fro

In microprocessor, upper and lower limits of temperature are set.
Every sample of temperature measurement from transducer is compared by
the processor.
If temperature exceeds the preset higher limit, the microprocessor transmits an
output signal to a system which in turn turns off the supply to some of the
heater elements.
If temperature is less than the preset lower limit, the microprocessor transmits
signal to system so that it turns on the supply to the heater element of the
oven.
m


io
en
Fig: Block diagram of automatic temperature control system – Closed loop
control
d
Benefits of Microprocessor Based System
Complete automation
Added intelligence
Reduced manpower
Flexibility to modify
Economic design
Reduced circuit complexity
Reduced operating costs (eg. Fuel savings)
Reduced product wearing; furnish more uniform operation; tighter control
enforce ment.
Improved responsiveness to changes in process: production rates, product
specifications, addition of new products.
Incorporate strategies to minimize production upsets; resulting from plant
equipment failures by anticipated process conditions and improved plant
safety.
de








D
ow
nl
oa
1.3


Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Fowler |
3
Instrumentation II




ed
u.
np
Improved timely information to plant operation and maintenance managers to
enable them to keep a plant running longer and more efficiently.
Improved integration and interaction of plant operation through coordinated
strategy.
Relational database management
Statistical process control capabilities
Information exchange with other plant system for process synchronization.

Microcomputer on Instrumentation Design
Process /
Plant /
System
Signal Conditioner
And
ADC
Print Out
Computer
Produces O/P
Data Logger
Digital
Computer
Software
fro
Operator Command
Through I/O
Device
d
Data
Communication
m
Data
Display
Monitor
Multiplexer
(to sequentially feeds
the outputs one at atime)
io
en
Magnetic Disk
Analog
Transducer
ot
es
.
1.4
Chapter 1: Microprocessor Based Instrumentation System
de
Remote Indicator
Fig: A typical digital computer based instrumentation system
D
ow
nl
oa
A process or plant or system may have to simultaneously measure multiple
variables like pressure, temperature, velocity, viscosity, flow rate etc. A computer
based measurement system has the capability of processing all inputs and present
the data in real time. A digital computer is fed with a sequential list of instructions
termed as computer program for suitable processing and manipulation of data.
Advantages:

Suitably programmed to automatically carry out the mundane tasks of drift
correction, noise reduction, gain adjustments, automatic calibration etc.

These instruments have signal conditioning and display which are
compact, rugged and reliable and are suited for performing in wide
conditions like industrial, consumer, military, automobile etc.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Fowler |
4
Instrumentation II



Chapter 1: Microprocessor Based Instrumentation System
Built in diagnostic subroutines to detect only or detent and correct.
Real time measurement, processing and display.
Lower cost, higher accuracy, and more flexibility.
Interfacing With Microprocessor
The primary function of microprocessor is to accept data from input devices such
as keyboard and A/D converters, read instructions from memory, process data
accordingly to the instructions, and send the results to output devices such as
LEDs, printers and video monitors. These input and output devices are called
peripherals or I/Os. Designing the logic circuits (hardware) and writing
instructions (software) to enable the microprocessor to communicate with these
peripherals is called interfacing, and the logic circuits are called I/O ports of
interfacing devices.
PC Interfacing Techniques
PC provides several interfaces for attaching peripherals to it. PC compatible
devices are interfaced to a PC through an internal expansion slot, a parallel
port or a serial port. Latest PCs have USB for connecting the peripherals.
1)
I/O Buses
PC brings out the system bus signals through expansion slots
known as I/O buses on the motherboard that is an I/O bus
interfaces an external device directly to the system bus. Video
card, sound card, network card etc. are inserted into the slots for
various applications.
Parallel and Serial Ports
Basic PC configuration includes one parallel port (LPT1) and two
serial ports (COM1 and COM2). However, additional ports can be
created by adding expansion cards. For industrial measurement and
control operations, remote data acquisition system compatible for
serial port are used.
D
ow
nl
oa
de
2)
d
fro
m
1.5.1
io
en
ot
es
.
1.5
ed
u.
np
Disadvantages:

They cannot replace the program themselves.

Software update

Prone to virus problem, so may become in-operational.
3)
USB ports
Universal serial bus used for connecting number of peripheral
devices such as printer, scanner, digital cameras, and pen drives
etc. It is faster compared to traditional parallel and serial ports.
1.5.2 Review of Address Decoding
The R/W memory is made of registers and each register has a group of flip flops or fieldeffect transistors that store bits of information; these flip flops are called memory cells.
The number of bits stored in a register is called a memory word. In a memory chip, all
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Fowler |
5
Instrumentation II
Chapter 1: Microprocessor Based Instrumentation System
ed
u.
np
registers are arranged in a sequence and identified by binary numbers called memory
address.
To communicate with memory, the MPU should be able to:
- Select the chip
- Identify the register
- Read from or write into the register
The address decoding circuit enables MPU to select an address within memory chip or
I/O chip and then read or write into it through the available data bus and thus avoid
contention or data collision within the data bus.
ot
es
.
Microprocessor is connected with memory and I/O devices via common address and data
bus. Only one device can send data at a time and other devices can only receive that data.
If more than one device sends data at the same time, the data gets garbled. In order to
avoid this situation, ensuring that the proper device gets addressed at proper time, the
technique called address decoding is used.
io
en
In address decoding method, all devices like memory blocks, I/O units etc. are assigned
with a specific address. The address of the device is determined from the way in which
the address lines are used to derive a special device selection signal known as chip select
( ). If the microprocessor has to write or to read from a device, the
signal to that
block should be enabled and the address decoding circuit must ensure that
other devices are not activated.
signal to
fro
m
Depending upon the no. of address lines used to generate chip select signal for the device,
the address decoding is classified as:
de
d
a) I/O mapped I/O
In this method, a device is identified with an 8 bit address and operated by I/O related
functions IN and OUT for that IO/M’ = 1. Since only 8bit address is used, at most
256 bytes can be identified uniquely. Generally low order address bits A0-A7 are used
and upper bits A8-A15 are considered don’t care. Usually I/O mapped I/O is used to
map devices like 8255A, 8251A etc.
Depending on the address that are allocated to the device the address decoding are
categorized in the following two groups.
D
ow
nl
oa
b) Memory mapped I/O
In this method, a device is identified with 16 bit address and enabled memory related
functions such as STA, LDA for which IO/M’ = 0, here chip select signal of each
device is derived from 16 bit address lines thus total addressing capability is 64K
bytes . Usually memory mapped I/O is used to map memories like RAM, ROM etc.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Fowler |
6
Instrumentation II
Chapter 1: Microprocessor Based Instrumentation System
io
en
ot
es
.
ed
u.
np
a) Unique Address Decoding:
If all the address lines on that mapping mode are used for address decoding then that
decoding is called unique address decoding. It means all 8-lines in I/O mapped I/O and
all 16 lines in memory mapped I/O are used to derive
signal. It is expensive and
complicated but fault proof in all cases.
m
 If A0 is high and A1- A7 are low and if
becomes low, the latch gets enabled.
 The data to the LED can be transferred in only one case and hence the device has unique
address of 01H.
D
ow
nl
oa
de
d
fro
Eight I/P switch interfacing at 53H. (01010011)
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Fowler |
7
Instrumentation II
Chapter 1: Microprocessor Based Instrumentation System
If A0 is low and
is low. Then latch gets enabled.
Here A1-A7 is neglected that is any even address can enable the latch.
Memory Interfacing
 A memory chip requires address lines to identify a memory register. The
number of address lines required is determined by the number of registers
in a chip (2n = number of registers where n is the number of address lines).
 A memory chip requires a chip select ( ) signal to enable the chip. The
remaining address lines (from above step) of the microprocessor can be
connected to the CS signal through an interfacing logic.
 Thus, all address lines are responsible to select a specific register within a
memory chip.
de
d
fro
m
1.5.3
io
en
-
ot
es
.
ed
u.
np
b) Non Unique Address decoding:
If all the address lines available on that mode are not used in address decoding then that
decoding is called non unique address decoding. Though it is cheaper there may be a
chance of address conflict.
Example: Design an address decoding circuit for two RAM chips each of 4K X 8 at address
2050H.
oa
Step 1: Calculate the number of address pins
nl
Here both memory devices are of 4K X 8 memory which is 4KB. That means 2 n = 4KB (4X1KB
= 22X210 = 212). Therefore, 4KB memory requires 12 address lines.
ow
n = log (memory capacity in bytes) / log (2)
D
n = log (4X1024) / log (2) = 12
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Fowler |
8
Instrumentation II
Chapter 1: Microprocessor Based Instrumentation System
Step 2: Memory Mapping
A
1
5
A
1
4
A
1
3
A
1
2
A
1
1
A
1
0
A
9
A
8
A
7
A
6
A
5
A
4
RAM
Start:2050H
0
0
1
0
0
0
0
0
0
1
0
1
End:304FH
0
0
1
1
0
0
0
0
0
1
0
0
Start:3050H
0
0
1
1
0
0
0
0
0
1
0
1
End:404FH
0
1
0
0
0
0
0
0
0
1
0
0
ROM
A
3
A
2
A
1
A
0
ed
u.
np
Address
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
ot
es
.
Memory
Block
io
en
Here RAM1 requires 12 address lines that is 111111111111 (FFFH). The starting address of
RAM1 is 2050H; we can calculate the end address of RAM1 by adding RAM1 addresses with its
base address that is 2050H + FFFH = 304FH.
Similarly RAM2 requires 12 address lines that is 111111111111 (FFFH). The next address of the
RAM1’s end address is the starting address of RAM2 that is 304FH + 01H = 3050H. Now we
can calculate the end address of RAM2 by adding RAM2 addresses with its starting address that
is 3050H + FFFH = 404FH.
m
Step 3: Decide decoder pins
D
ow
nl
oa
de
d
fro
Here, bit A12 in address lines for RAM1 and RAM2 referring to start address are different, so
we require a 1X2 decoder. If we refer the end address, bits A12, A13 and A14 are different; in
this case we should use 3X8 decoder. Address lines A0 through A11 are used by RAM1 and
RAM2 as both having 12 address pins. Rest of the address lines (A15 if 3X8 decoder and A13,
A14 and A15 if 1X2 decoder) will be decoded to generate chip enable signals for decoder.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Fowler |
9
Instrumentation II
Chapter 1: Microprocessor Based Instrumentation System
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
Step 4: Draw a decoding circuit
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Fowler |
10
Chapter 1: Microprocessor Based Instrumentation System
Programmed I/O, Interrupt Driven I/O and Direct Memory Access
(DMA)
Programmed I/O or Polling:
The microprocessor is kept in a loop (programmed) to check whether data are
available. For example to read a data from an input keyboard in a single board
microcomputer, the microprocessor can keep polling the port until a key is
pressed.
Interrupt Driven I/O:
When a peripheral is ready to transfer data, it sends an interrupt signal to the
microprocessor. The microprocessor stops the execution of the current
program, accepts the data from the peripheral and then returns to the program.
The processor is free to perform other tasks rather than being hold in a polling
loop.
D
ow
nl
oa
de
d
1.5.4
fro
m
io
en
ot
es
.
ed
u.
np
Instrumentation II
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Fowler |
11
Instrumentation II
Chapter 1: Microprocessor Based Instrumentation System
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
Direct Memory Access (DMA):
This type of data transfer is employed when the peripheral is much faster than
the microprocessor. The DMA controller sends a HOLD signal to the
microprocessor, the microprocessor releases its data bus and the address bus
to the DMA controller, and data are transferred at high speed without the
intervention of the microprocessor.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Fowler |
12
Instrumentation II
Chapter 2 : Parallel Interfacing With Microprocessor Based System
Chapter – 2
Parallel Interfacing with Microprocessor Based System
2.1
ed
u.
np
The device which can handle data at higher speed cannot support with serial interface. N bits of
data are handled simultaneously by the bus and the links to the device directly. Achieves faster
communication but becomes expensive due to need of multiple wires.
Methods of Parallel Data Transfer: Simple Input and Output, Strobe I/O, Single
Handshake I/O, & Double Handshake I/O
ot
es
.
Parallel transmission of data is used for short distance where the speed of information transfer is
critical. This form of data communication is found in newer type of computer peripheral
equipment with transfer speed of to one million characters per second. The equipment includes
printers, disk drives and various other forms of peripheral components.
m
io
en
The information exchanged between a microprocessor and an I/O interface circuit consists of
input or output data and control information. The status information enable the microprocessor
monitor the device and when it is ready then send or receive data. Control information is the
command by microprocessor to cause I/O device to take some action. If the device operates at
different speeds, then microprocessor can be used to select a particular speed of operation of the
device. The techniques used to transfer data between different speed devices and computer is
called synchronizing. There are various ways of synchronization techniques which are involved
in parallel data transfer such as simple input and output, simple strobe I/O, single handshaking
and double handshaking.
fro
Simple I/O
oa
de
d
To get digital data from a simple switch into a microprocessor; switch is connected on input port
line from which port can be read. The data is always present and ready so that it can be read at
any time. Similarly to output data to a simple display device like LED, the input of LED buffer
is connected on an output port pin. And output the logic level required turning on the light. The
LED is always there and ready so that data can be sent at any time.
ow
nl
This timing waveform illustrates the simple I/O where cross lines represent the time at which a
new data byte becomes valid on the output lines of the port. Absences of other waveforms
indicate that this output operation is not directly dependent on any other signals.
D
Simple Strobe I/O
In many applications, valid data is present on an external device only at a certain time and must
be read in at that time. Here a strobe pulse is supplied to indicate the time at which data is being
transmitted. For an example, we can discuss the ASCII encoded keyboard. When a key is
pressed, circuitry on keyboard sends out ASCII code for pressed key on eight parallel data lines
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
1
Instrumentation II
Chapter 2 : Parallel Interfacing With Microprocessor Based System
ed
u.
np
and then sends out a strobe signal on another line to indicate that valid data is present on eight
data lines
ot
es
.
The sending device outputs parallel data on the data lines, and then outputs STB’ signal to
represent the valid data is present.
io
en
In this technique, microprocessors need to wait until the device is ready for the operation and
also known as simple wait I/O. Consider a simple keyboard consisting of 8 switches connected to
a microprocessor through a parallel interface circuit (Tri-state buffer). The switch is of dip
switches. In order to use this keyboard as an input device the microprocessor should be able to
detect that a key has been activated. This can be done by observing that all the bits are in
required order. The processor should repeatedly read the state of input port until it finds the right
order of bits i.e. at least 1 bit of 8 bits should be 0.
Used to convert analog to digital data which can be read by I/O unit of microprocessor.
When SOC appears 1, I/O unit should ready for reading binary data/digital data.
When EOC’s status is 1, then I/O unit should stop to read data.
Strobe signal indicates the time at which data is being activated to transmit.
ow
nl




oa
de
d
fro
m
Consider the tri-state A/D converter:
D
Single Handshaking
Handshaking is the method of synchronizing the actions of slow peripheral devices with that of
high speed microprocessor. It can have two transfer schemes.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
2
Instrumentation II
Chapter 2 : Parallel Interfacing With Microprocessor Based System

m

The peripheral outputs some data and send
signal to microprocessor to tell “Here is
the data for you”.
Microprocessor detects asserted
signal, reads the data and sends an acknowledge
signal (ACK) to indicate data has been read and peripheral can send next data, “I got that
one, send me another”.
Microprocessor sends or receives data when peripheral is ready.
io
en

ot
es
.
ed
u.
np
Input Handshake (Peripheral to Microprocessor):
The peripheral outputs some data and sends some strobe signal to microprocessor.
Microprocessor detects asserted strobe signal (STB’) and reads the byte of the data. Processor
then sends acknowledgement signal (ACK) to peripheral to indicate that the data has been read
and can send next byte of data.
Output Handshake (Peripheral from Microprocessor):
fro
Microprocessor outputs data to peripheral and asserts a strobe (STB’) signal. If peripheral is
ready it answers back with acknowledgement (ACK) signal to microprocessor.
d
Double Handshaking
de
For data transfers where even more coordination is required between the sending system and the
receiving system, a double handshake is used. It can have two transfer schemes.
oa
Input Handshake (Peripheral to Microprocessor):
D
ow
nl
Peripheral asserts strobe (STB’) line low to ask receiving device whether it is ready or not for
data reception. Receiving system raises its acknowledgement (ACK) line high to indicate it is
ready. Peripheral device then sends the byte of data and raises its strobe (STB’) line high. When
microprocessor reads data, it drops its acknowledgement (ACK) line low and request sending
system to send net byte of data.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
3
Chapter 2 : Parallel Interfacing With Microprocessor Based System

The peripheral asserts its
line low to ask microprocessor “Are you ready?”


The microprocessor raises its ACK line high to say “I am ready”.
Peripheral then sends data and raises its
line low to say “Here is some valid data for
you.”
Microprocessor then reads the data and drops its ACK line to say, “I have the data, thank
you, and I await your request to send the next byte of data.”
ot
es
.
ed
u.
np
Instrumentation II
io
en

Output Handshake (Peripheral from Microprocessor):
Microprocessor sends a strobe (STB’) signal and data and peripheral sends acknowledgement
(ACK) signal.
8255 as General Purpose Programmable I/O Device and its interfacing examples
m
2.2
de
d
fro
The Intel 8255 A is a general purpose programmable I/O device designed for use with Intel
microprocessors. It has 24 I/O pins that can be grouped primarily in two 8-bit parallel ports: A
and B, with the remaining bits as port C. The 8-bits of port C can be used as individual bits or be
grouped in two 4-bits ports: C upper (Cu) and C lower (Cl). The functions of these ports are
defined by writing a control word in the control register.
Bit Set/Reset mode: The BSR mode is used to set or reset the bits in port C.
I/O mode: The I/O mode is further divided into three modes: mode 0, mode 1 and mode
2. In mode 0, all ports function as simple I/O ports. Mode 1 is a handshake mode
whereby ports A and/or B use bits from port C as handshake signals. In the handshake
mode, two types of I/O data transfer can be implemented: status check and interrupt. In
mode 2, port A can be set up for bidirectional data transfer using handshake signals from
port C and port B can be set up either in mode 0 or mode 1.
D
ow
nl


oa
8255 functions in two modes:
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
4
Instrumentation II
Chapter 2 : Parallel Interfacing With Microprocessor Based System
fro
m
io
en
ot
es
.
ed
u.
np
Block diagram of 8255:
Fig2: Internal Block Diagram of 8255
d
The pin diagram and block diagram of 8255 is given above. It has the following main blocks.
de
a. Data Bus Buffer
nl
oa
The 3-state bidirectional 8-bit buffer is used to interface the 8255A to the system data bus.
Data is transmitted or received by the buffer upon execution of input or output instructions
by the CPU. Control words and status information are also transferred through the data bus
buffer.
D
ow
b. Read/Write Control Logic
The function of the block is to manage all of the internal and external transfers of both data
and control or status words. It accepts inputs from the CPU address and control buses and in
turn, issues commands to both of the control groups.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
5
Instrumentation II




Chip Select (CS’): A “low” on this pin enables the communications between the
8255A and the CPU.
Read (RD’): A “low” on this input enables the 8255A to send the data or status
information to the CPU on the data bus. In essence, it allows the CPU to read from
the 8255A.
Write (WR’): A “low” on this input pin enables the CPU to write data or control
words into the 8255A.
Reset (RESET): A “high” to this pin clears the control register and sets all ports (A, B
and C) in the input mode.
A0 and A1: These input signals controls the selection of one of the three ports or the
control word register. They are connected to the least significant bits of the address
bus.
ed
u.
np

Chapter 2 : Parallel Interfacing With Microprocessor Based System
CS’
0
0
0
0
1
A0
0
1
0
1
X
m
io
en
A1
0
0
1
1
X
ot
es
.
The CS’ signal is the master chip select, and A0 and A1 specify one of the I/O ports or the
control register as given below.
Selected
Port A
Port B
Port C
Control Register
8255A is not
selected
fro
c. Group A and Group B controls
oa
de
d
Functional configuration of each port is programmed by the system software. In essence, the
CPU outputs a control word to the 8255A. The control word contains information such as
“mode”, “bit set’, “bit reset”, etc. that initialize the functional configuration of the 8255A.
Each of the control blocks (Group A and Group B) accepts “commands” from the
Read/Write control logic, receives control word from the internal data bus and issues the
proper commands to its associated ports.
Control Group A – Port A and Port C Upper (C7 – C4)
Control Group B – Port B and Port C Lower (C3 – C0)
nl


D
ow
Control Word
When A0 and A1 pins have value 1, the mapped address addresses the control register which is
the 8-bit register to write the specific content according to the port conditions although it cannot
be read. The content of this register is called control word which specifies an I/O function for
each port.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
6
Instrumentation II
Chapter 2 : Parallel Interfacing With Microprocessor Based System
ed
u.
np
The MSB (D7) of the control word tells which control word we are sending it that is it specifies
either the I/O function or the Bit Set/Reset function. If bit D7=1, bits D6-D0 determine I/O
functions in various modes as shown in figure. If bit D7=0, port C operates in the Bit Set/Reset
(BSR) mode. The BSR control word does not affect the functions of ports A and B.
To communicate with peripherals through 8255, following are the steps are necessary.

D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.


Determine the Port addresses of Ports A, B and C and of the control register according to
Chip Select logic and address lines A1 and A0.
Write a control word in control register.
Write I/O instructions to communicate with peripherals through Ports A, B and C.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
7
Instrumentation II
Chapter 2 : Parallel Interfacing With Microprocessor Based System
I/O Control Word Examples
Q.
Determine the Control word for the following configuration of ports of Intel 8255A
PPI chip.
D7
1
D4
0
D3
0
D2
0
D1
0
D0
0
= A0H
Port A output, mode 0, port B output, mode 0, port C lower output and port C upper input.
D7
1
c.
D5
1
D6
0
D5
0
D4
0
D3
1
D2
0
D1
0
D0
0
= 88H
ot
es
.
b.
D6
0
ed
u.
np
Port A output, mode of port A mode 1, port B output, mode of port B mode 0, port C lower
pins as output and remaining pins of port C upper as output.
io
en
a.
Port A input, mode 1, port B output, mode 1, and remaining pins of port C upper input.
D6
0
D5
1
D4
1
D3
1
D2
1
D1
0
D0
X
= BCH [Normally don’t care (X) = 0]
Port A input mode 1, port B output mode 0, port C lower input and port C upper output.
e.
D5
1
D4
1
D3
0
D2
0
d
D6
0
D1
0
D0
1
= B1H
de
D7
1
Port A bidirectional (Mode 2), port B input mode 0, port C lower output.
D6
1
D5
X
D4
X
D3
X
D2
0
D1
1
D0
0
= C2H [Normally don’t care (X) = 0]
ow
nl
D7
1
oa
d.
fro
m
D7
1
D
Operating Modes
Mode 0 (Basic Input/output)
This functional configuration provides simple input and output operation for each of the three
ports. No ‘handshaking” is required; data is simply written to or read from a specified port.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
8
Instrumentation II
Chapter 2 : Parallel Interfacing With Microprocessor Based System
Mode 0 basic functional definitions:
Two 8-bit ports and two 4-bit ports
Any port can be input or output
Outputs are latched
Inputs are not latched
16 different input/output configurations are possible in this mode.
ed
u.
np





BSR Mode (Bit Set/Reset)
ot
es
.
BSR mode is concerned only with eight bits of port C, which can be set or reset by writing an
appropriate control word in the control register. A control word with bit D7=0 is recognized as a
control word and it does not alter any previously transmitted control word with bit D7=1; thus the
I/O operations of ports A and B are not affected by a BSR control word. In the BSR mode
individual bits of port C can be used for applications such as On/Off switch.
D
ow
nl
oa
de
d
fro
m
io
en
BSR Control Word: This control word, when written in control register, sets or resets one
bit at a time, as specified in figure.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
9
Instrumentation II
Chapter 2 : Parallel Interfacing With Microprocessor Based System
BSR Control Word Examples
Q.
Set PC7
ed
u.
np
a.
Determine the BSR Control word for the following Port C configurations.
To set PC7
D5
X
D4
X
D3
1
D2
1
D1
1
D0
1
= 0FH [Normally don’t care (X) = 0]
D4
X
D3
0
D2
1
D1
1
D0
0
= 06H [Normally don’t care (X) = 0]
Reset PC3
D7
0
D6
X
D5
X
io
en
b.
D6
X
ot
es
.
D7
0
Mode 1 (Strobe Input/output)
m
The functional configuration provides a means for transferring I/O data to or from a specified
port in conjunction with strobes or handshaking signals. In mode 1, port A and port B use the
lines of port C to generate or accept these handshaking signals.
d
Two groups (Group A and Group B)
Each group contains one 8-bit data port and one 4-bit control/data port
The 8-bit data port can be either input or output. Both inputs and outputs are latched.
The 4-bit port is used for control and status of the 8-bit data port.
de




fro
Mode 1 basic functional definitions:
oa
Mode 2 (Strobe Bidirectional Bus I/O)
ow
nl
The functional configuration provides a means for communicating with a peripheral device or a
structure on a single 8-bit bus for both transmitting and receiving data (bidirectional bus I/O).
“Handshaking Signals” are provided to maintain proper bus flow discipline in a similar manner
to Mode 1. Interrupt generation and enable/disable functions are also available.
D
Mode 2 basic functional definitions:



Used in Group A only
One 8-bit bidirectional bus port (Port A) and a 5-bit control port (Port C)
Both inputs and outputs are latched
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
10
Instrumentation II

Chapter 2 : Parallel Interfacing With Microprocessor Based System
The 5-bit control port (Port C) is used for control and status for the 8-bit,
bidirectional bus port (Port A)
ed
u.
np
8255 Programming and Operation
ot
es
.
A high on the RESET pin causes all 24 lines of the three 8-bit ports to be in the input mode. All
flip-flops are cleared and the interrupts are reset. This condition is maintained even after the
RESET goes low. The ports of the 8255 can then be programmed for any other mode by sending
out a single output instruction to the control register. Also, the current mode of operation can be
changed by writing a single mode word onto the control register, when required.
io
en
Modes for Group A and Group B can be separately defined with Port C taking on responsibilities
as dictated by the mode definitions or Ports A and B. If Group A is programmed for Mode 0, and
Group B is programmed for Mode 1, Port A and PC4–PC7 can be programmed for either input or
output, while Port B can be programmed for input or output with PC0–PC2 used for handshaking.
d
fro
m
The mode definition format and bit set-reset format are discussed in above topics. The control
words for both mode definition and Bit Set-Reset are loaded into the same control register, with
bit D7 used for specifying whether the word loaded into the control register is a mode definition
word or Bit Set-Reset word. If D7 is high, the word is taken as a mode definition word, and if it is
low, it is taken as a Bit Set-Reset word. The appropriate bits are set of reset depending on the
type of operation desired, and loaded into the control register (which is accessed when A1 and A0
both are '1'; WR and CS both are '0'. It is to be noted that Group B does not have provision for
operation in Mode 2.
nl
oa
de
The eight possible combinations of the states of bits D1 -D3 (B2 B1 B0) in the Bit Set-Reset
format (henceforth referred to as BSR) determine the particular bit in PC0-PC7 being set or reset
as per the status of bit D0. A BSR word is to be written for each bit that is to be set or reset. For
example, if bit PC2 is to be set and bit PC7 is to be reset, the appropriate BSR words that will
have to be loaded into the control register will be, 0XXX001 and 0XXX1110, respectively,
where X can be either '0' or '1'.
D
ow
The BSR, word can also be used for enabling or disabling interrupt signals generated by Port C
when the 8255 is programmed for Mode 1 or Mode 2 operation. This is done by setting or
resetting the associated bits of the interrupts.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
11
Instrumentation II
Chapter 2 : Parallel Interfacing With Microprocessor Based System
ed
u.
np
Programming in Mode 0 (Basic I/O Mode)
The ports A, B and C can be configured as simple input or output ports by writing the
appropriate control word in the control word register. In the control word, D7 is set to '1' (to
define a mode set operation) and D6, D5, and D2 are all set to '0' configure all the ports in Mode 0
operation. The status of bits D4, D3, D1 and D0 then determine whether the corresponding ports
are to be configured as Input or Output.
fro
m
io
en
ot
es
.
Example 1
a) Identify the port addresses in given figure.
b) Identify the Mode 0 control word to configure port A as an input port and port B as an
output port.
c) Write a program to read the Dip switches and display the reading from port A at port B.
nl
oa
de
d
Solution
a) This is I/O mapped I/O; when A15 A14 A13 is 011, then chip select of 8255 is enabled. We
also know that during the execution of IN and OUT instruction, A15-A8 and AD7-AD0 carry
the same signals. Keeping this in mind, port addresses will be derived. Firstly, port A’s port
address will be calculated as under:
A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
0 1 1 X X X X X = X X X X X X
0 0
D
ow
To have equality, 0’s and 1’s on one side of the equation must appear on other sides. This means
that AD7 AD6 AD5 must equal 011 and A9 and A8 must equal 00 (port A) to get
0 1 1 X X X 00 = 0 1 1 X X X 00
Since the remaining don’t cares can be 0’s and 1’s, there are many solutions. For instance, if all
the don’t cares are equal to zero; address of port A becomes 1110 0000 (60H). The port
addresses of the given figure are determined as under:
Port A = 60H
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
12
Instrumentation II
Chapter 2 : Parallel Interfacing With Microprocessor Based System
D7
1
D6
0
D5
0
D4
1
D3
X
D2
0
D1
0
D0
X
ed
u.
np
Port B = 61H
Port C = 62H
Control Register = 63H
b) The Mode 0 control word to configure port A input and port B output is calculated as under:
= 90H
ot
es
.
c) Program subroutine to read DIP switches and display the reading from port A at port B is as
under:
MVI A, 90H;
Load ACC with the control word
OUT 63H;
Write the control word in control register and initialize the ports
IN 60H;
Reads switches at port A
OUT 61H;
Display the reading at port B
RET
fro
m
io
en
Programming on BSR Mode
Any of the eight bits of port C can be ser or reset using a single output instruction. This feature
reduces software requirements in control-based applications. When Port C is being used as Status
/ Control for Port A or B, these bits can be set or reset by using Bit Set/Reset. Word in the
control register when D7 = 0 is recognized as BSR control word and does not affect the I/O
operations of Port A and B.
D
ow
nl
oa
de
d
Example 2
Write a BSR control word to set PC7, PC6, PC5, PC4, PC3, PC2, PC1, and PC0 and reset each after
1 second.
Fig: Example of BSR Mode
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
13
Instrumentation II
Chapter 2 : Parallel Interfacing With Microprocessor Based System
D7
D6 D5
D4
D3
D2
D1
D0
Set PC7
0
0
0
0
1
1
1
1
BSR
Word
0FH
Reset PC7
0
0
0
0
1
1
1
0
0EH
Set PC6
0
0
0
0
1
1
0
1
0DH
Reset PC6
0
0
0
0
1
1
0
0
0CH
Set PC5
0
0
0
0
1
0
1
1
0BH
Reset PC5
0
0
0
0
1
0
1
0
0AH
Set PC4
0
0
0
0
1
0
0
1
09H
Reset PC4
0
0
0
0
1
0
0
0
08H
Set PC3
0
0
0
0
0
1
1
1
07H
Reset PC3
0
0
0
0
0
1
1
0
06H
Set PC2
0
0
0
0
0
1
0
1
05H
Reset PC2
0
0
0
0
0
1
0
0
04H
Set PC1
0
0
0
0
0
0
1
1
03H
Reset PC1
0
0
0
0
0
Set PC0
0
0
0
0
0
Reset PC0
0
0
0
0
io
en
m
0
1
0
02H
0
0
1
01H
0
0
0
00H
fro
0
Control
ot
es
.
Case
ed
u.
np
Solution
Let us assume Port addresses same as example 1. The control word is calculated with Port C
output in this case so it is 10000 0000 (80H). BSR control word for each case is given as under:
D
ow
nl
oa
de
d
Program Subroutine
MVI A, 80H
LOOP: OUT 63H
MVI A, 0FH
OUT 63H
CALL DELAY
DCR A
ANI 0FH
JMP LOOP
DELAY: MVI C, 0AH
LOOP: MVI D, 64H
LOOP1: MVI E, DEH
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
14
Instrumentation II
Chapter 2 : Parallel Interfacing With Microprocessor Based System
ed
u.
np
LOOP2: DCR E
JNZ LOOP2
DCR D
JNZ LOOP1
DCR C
JNZ LOOP
RET
io
en
ot
es
.
Programming in Mode 1 (Strobe I/O Mode)
In Mode 1, handshake signals are exchanged between the MPU and peripherals prior to data
transfer. Two ports (A and B) function as 8-bit I/O ports. They can be configured either as input
or output ports. Each port uses three lines from port C as handshake signals. The remaining two
lines of port C can be used for simple I/O functions.
When Port A is to be programmed as an input port, PC3, PC4, and PC5 are used for control, PC6
and PC7 can be Input or Output, as programmed by bit D3 (Cupper) of the control word. When Port
A is programmed as an output port, PC3, PC6, PC7 are used for control and PC4 and PC5 can be
Input or Output, as programmed by bit D3 (Cupper) of the control word. When Port B is to be
programmed as an input or output port, PC0, PC1 and PC2 are all used for control.
de
d
fro
m
Mode 1 Input
Below figure shows Port A as input port (when it operates in Mode 1) along with the control
word and control signals (for handshaking with a peripheral). When the control word is loaded
into control register, Group A is configured in Mode 1 with Port A as an input port, Port A can
accept parallel data from a peripheral (like a keyboard) and this data can be read by the CPU.
The peripheral first loads data into Port A by making the STBA input low. This latches the data
placed by the peripheral on the common data bus into Port A. Port A acknowledges reception of
data by making IBFA (Input Buffer Full) high. IBFA is set when the STBA input is made low.
D
ow
nl
oa
INTRA is an active output signal which can be used to interrupt the CPU so that the CPU can
suspend its current operation and read the data written into Port A by the peripheral. INTR A can
be enabled or disabled by the INTEA flip-flop which is controlled by BIT Set-Reset operation of
PC4. INTRA is set (if enabled by setting the INTEA flip-flop) after the STBA has gone high again,
and if IBFA is high.
On receipt of the interrupt, the CPU can be made to read Port A. The falling edge of the RD input
resets IBFA and it goes low. This can be used to indicate to the peripheral that the input buffer is
empty and that data can again be loaded into it.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
15
Chapter 2 : Parallel Interfacing With Microprocessor Based System
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
Instrumentation II
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
16
Chapter 2 : Parallel Interfacing With Microprocessor Based System
ot
es
.
ed
u.
np
Instrumentation II
Fig: Timing Waveforms for Strobed Input (With Handshake) – 8255 Mode 1
io
en
Above figure shows Port B as an input port (when in Mode 1). The timing diagram and operation
of Port B is similar to that of Port A except that it uses different bits of Port C for control. INTEB
is controlled by Bit Set/Reset of PC2.
d
fro
m
If the CPU is busy with other system operations, it can read data from the input port when it is
interrupted. This is often called Interrupt Controlled I/O. However, if the CPU is otherwise not
busy with other jobs, it can continuously poll (read) the status word to check for an IBF A. This is
often called Program Controlled I/O. The status word is accessed by reading Port C (A1 A0 must
be 10, RD and CS must be low). The status word format as assumed by the bits of Port C when
Ports A and B are input ports in Mode 1, is shown in above figure.
de
Mode 1 Input Control Signals
oa
STB’ (Strobe Input): A low on this input loads data into the input latch. The 8255A, in
response to STB’, generates IBF and INTR.
nl
IBF (Input Buffer Full): A high on this output indicates that the data bus has been loaded into
the input latch; in essence, an acknowledgement, IBF is set by STB input being low and is reset
by the rising edge of the RD’ input.
D
ow
INTR (Interrupt Request): This is an output signal that may be used to interrupt the CPU. This
signal is generated if STB’, IBF and INTE (Internal Flip Flop) are all at logic 1. This is reset by
the falling edge of the RD’ (Read) signal.
INTE: This is an internal flip-flop used to enable or disable the generation of the INTR signal.
The two flip-flops INTEA and INTEB are set/reset using the BSR mode through PC4 and PC2.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
17
Instrumentation II
Chapter 2 : Parallel Interfacing With Microprocessor Based System
io
en
ot
es
.
ed
u.
np
Mode 1 Output
Figure below shows Port A configured as an output port (when in Mode 1) along with the control
word and control signals (for handshaking with a peripheral). When the control word is loaded
into the control register, Group A is configured in Mode 1 with Port A as an output port. The
CPU can send out data to a peripheral (like a display device) through Port A of the 8255.
The OBFA output (Output Buffer Full) goes low on the rising edge of the WR signal (when the
CPU writes data into the 8255). The OBFA output from 8255 can be used as a strobe input to the
peripheral to latch the contents of Port A. The peripheral responds to the receipt of data by
making the ACKA input of the 8255 low, thus acknowledging that it has received the data sent out
by the CPU through Port A. The ACKA low resets the OBFA signal, which can be polled by the
CPU through OBFA of the status word to load the next data when it is high again.
INTRA is an active high output of the 8255 which is made high (if the associated INTE flip-flop
is set) when ACKA is made high again by the peripheral, and when OBFA goes high again (see
timing diagram in Figure below). It can be used to interrupt the CPU whenever the output buffer
is empty. It is reset by the falling edge of WR when the CPU writes data onto Port A. It can be
enabled or disabled by writing a '1' or a '0' respectively to PC6 in the BSR mode.
D
ow
nl
oa
de
d
fro
m
Figure below shows Port B as an output port when in Mode 1. The operation of Port B is similar
to that of Port A. INTEB is controlled by writing a '1' or '0' to PC2 in the BSR mode.
The status word is accessed by issuing a Read to Port C. The format of the status word as
assumed by the bits of Port C when Ports A and B are Output ports in Mode 1 is shown in Figure
below.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
18
Chapter 2 : Parallel Interfacing With Microprocessor Based System
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
Instrumentation II
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
19
Chapter 2 : Parallel Interfacing With Microprocessor Based System
ed
u.
np
Instrumentation II
ot
es
.
Fig: Timing Waveform for Strobed (With Handshake) Output - 8255 Mode 1
Mode 1 Output Control Signals
io
en
OBF’ (Output Buffer Full): The OBF’ will go low to indicate that the CPU has written data out
to the specified port. The OBF’ will be set with the rising edge of the WR’ input and reset by
ACK’ input being low.
m
ACK’ (Acknowledgement Input): A low on this input informs the 8255A that the data from
port A or port B has been accepted. In essence, a response from the peripheral device indicating
that it has received the data output by the CPU.
fro
INTR (Interrupt Request): A high on this output can be used to interrupt the CPU when an
output device has accepted data transmitted by the CPU. INTR is set when OBF’, ACK’ and
INTE are all 1 and reset by falling edge of WR’.
de
d
INTE: This is an internal flip-flop to a port and needs to be set to generate the INTR signal. The
two flip-flops INTEA and INTEB are set/reset using the BSR mode through PC6 and PC2.
D
ow
nl
oa
Example 3
Below mentioned figure shows an interfacing circuit using the 8255A in Mode 1. Port A is
designated as the input port for a keyboard with interrupt I/O and port B is designated as the
output port for a printer with status check I/O.
a) Find port addresses by analyzing the decode logic.
b) Determine the control word to set up port A as input and port B as output in Mode 1.
c) Determine the BSR word to enable INTEA.
d) Determine the masking byte to verify the OBF’ line in status check I/O.
e) Write subroutine to accept character from keyboard and send character to printer.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
20
Chapter 2 : Parallel Interfacing With Microprocessor Based System
io
en
ot
es
.
ed
u.
np
Instrumentation II
de
d
fro
m
Solution
a) The 8255A is connected as I/O mapped I/O. When the address lines A7-A2 are all 1, the
output of NAND gate goes low and selects 8255A. The port addresses are calculated as
1111 11XX:
Port A
= 1111 1100 (FCH)
Port B
= 1111 1101 (FDH)
Port C
= 1111 1110 (FEH)
Control Register = 1111 1111 (FFH)
b) Control word to set up port A as input and port B as output Mode 1 is:
D2
1
D1
0
D0
X
= B4H
D7 D6 D5 D4 D3 D2
0
0
0
0
1
0
d) Status word to check OBFB’
D1
0
D0
1
= 09H
D
ow
nl
oa
D7 D6 D5 D4 D3
1
0
1
1
X
c) BSR word to set INTEA
D7
X
D6
X
D5
X
D4
X
D3
X
D2
X
D1
D0
OBFB’ X
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Masking Byte = 02H
References: Gaonkar, Hall & Brey |
21
Instrumentation II
Chapter 2 : Parallel Interfacing With Microprocessor Based System
io
en
ot
es
.
READ:
MVI A, B4H ; Initialize control word
OUT FFH
; Using I/O Mode
MVI A, 09H ; Set INTEA (PC4)
OUT FFH
; Using BSR Mode
EI
; Enable Interrupt
CALL READ ; Read Character
CALL PRINT ; Display Character
HLT
; Terminate Program
; Keyboard Read Subroutine
IN FEH
; Read Port C
ANI 20H
; Check IBFA (PC5)
JZ READ
IN FCH
; Read ASCII code of character
MOV C, A
; Save Character
RET
ed
u.
np
e) Subroutines to accept character from keyboard and send to printer:
PRINT:
m
; Read port C
; Check OBFB’ (D1)
fro
; Get Character
; Send Character to port B
d
IN FEH
ANI 02H
JZ PRINT
MOV A, C
OUT FDH
RET
D
ow
nl
oa
de
Programming in Mode 2 (Strobe Bidirectional Bus I/O)
When the 8255 is operated in Mode 2 (by loading the appropriate control word); Port A can be
used as a bidirectional 8-bit I/O bus using PC3–PC7 for handshaking and Port B can be
programmed only in Mode 0 (PC0–PC2 as Input or Output), or in Mode 1 (with PC0–PC2 for
handshaking).
Figure below shows the control word that would have to be loaded into the control port to
configure 8255 in Mode 2. Figure below shows Port A and associated control signals when 8255
is in Mode 2. Interrupts are generated for both output and input operations on the same INTRA
(PC3) line.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
22
Chapter 2 : Parallel Interfacing With Microprocessor Based System
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
Instrumentation II
Fig: Timing Waveform for Mode 2 Configuration
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
23
Instrumentation II
Chapter 2 : Parallel Interfacing With Microprocessor Based System
The control signal definitions for Mode 2 are:
Output Control Signals
OBF (Output Buffer Full)
This is an active low output which indicates that the CPU has written data into Port A.
ed
u.
np
ACK (Acknowledge)
ot
es
.
This is an active low input signal (generated by the peripheral) which enables the tri-state output
buffer or Port A and makes Port A data available to the peripheral. In Mode 2, Port A outputs are
in tri-state until enabled.
INTE 1
This is the flip-flop associated with Output Buffer Full. INTE 1 can be used to enable to disable
the interrupt by setting or resetting PC6 in the BSR Mode.
Input Control Signals
Input)
This is an active low input signal which enables Port A to latch the data available as its input.
IBF (Input Buffer Full Flip-Flop)
This is an active high output which indicates that data has been loaded into the input latch of Port
A.
INTE 2
This is an Interrupt enable flip-flop associated with Input Buffer Full. It can be controlled by
setting or resetting PC4 in the BSR Mode.
fro
m
io
en
STB (Strobe
Status Word in Mode 2
The status word for Mode 2 (accessed by reading Port C) is shown in above figure. D 7–D3 of the
d
status word carry information about OBFA , INTE1, IBFA, INTE2, and INTRA. The status of the
oa
de
bits D2 – D0 depend on the mode setting of Group B. If B is programmed in Mode 0, D2–D0 carry
information about the control signals for B, depending upon whether B is an Input port or Output
port respectively.
D
ow
nl
Assignment 1:
 Interfacing keyboard and seven segment display
 Interfacing a microprocessor to a tape reader and lathe
 Interfacing to parallel printer
2.3
Parallel Interfacing with ISA and PCI bus
I/O buses are used to connect the system bus (address, data, and control buses) for example ISA
(8 or 16 bit), EISA (Extended ISA - 32 bit), VESA (Video Electronics Standards Association)
local bus (VL Bus), PCI (32 or 64 bit), Accelerated graphics port (AGP), PCI-X (64 bit,
133MHZ), PCI-Express etc.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
24
Instrumentation II
Chapter 2 : Parallel Interfacing With Microprocessor Based System
ed
u.
np
ISA Bus (Industry Standard Architecture)
 First introduced in 1982 with the first PC (IBM/PC) – [Intel 8088 8 bit microprocessor].
 Originally ISA bus was with 8-bit bus which runs at 4.77 MHz.
 16 bit version of ISA was introduced in 1984 used with Intl 80286 (16-bit
microprocessor).
 Peripheral devices such as sound cards, disk drives, network cards etc. are connected via
ISA slots.
 ISA bus is mostly obsolete for PC nowadays, but is still used in many industrial
applications due to their low costs and existing cards.
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
8-bit ISA bus Architecture
 Has data bus width of 8 bits and address bus width of 20 bits.
 Number of pins in ISA slots/cards are 62.
 Clock frequency of 4.77 MHz.
 ISA bus connector contains:
o 20 bit address bus (A19-A0)
o 8 bit data bus
o MEMR’, MEMW’. IOR’, IOW’ control signal for controlling I/O or memory on
the ISA card.
o Interrupt request lines IRQ2-IRQ7
o DMA request inputs DRQ1-DRQ3
o DMA acknowledgement O/Ps DACK0’-DACK3’
o Clock signals
o Power lines and Reset
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
25
Chapter 2 : Parallel Interfacing With Microprocessor Based System
fro
m
io
en
ot
es
.
ed
u.
np
Instrumentation II
Fig: 8-bit ISA Bus
D
ow
nl
oa
de
d
16-bit ISA bus Architecture
 Data bus width of 16 bit and address bus width of 24 bits.
 Number of pins in ISA card/slot are 98
 Clock frequency of 8.33 MHz
 Consists of an extra connector with 36 pins behind the 8-bit connector.
 Compatible with both 8-bit and 16-bit ISA cards.
 16-bit card consists of two edge connectors
o One plugs into the original 8-bit connector
o Other plugs into the new 16-bit connector
 Extra connector consists of
o 4 additional address lines – 24 lines in total
o 8 additional data lines – 16 lines in total
o 4-bit DMA channel request and acknowledgement lines
o Additional Interrupt lines
o Control lines to select 8 or 16 bit transfer
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
26
Chapter 2 : Parallel Interfacing With Microprocessor Based System
io
en
ot
es
.
ed
u.
np
Instrumentation II
Fig: The 16-bit ISA bus. (a) Both 8- and 16-bit connectors and (b) the pinout of the 16-bit
connector.
nl
oa
de
d
fro
m
Reasons for elimination of ISA Bus
 ISA bus is slow, hard to use and bulky.
 Once each ISA slot/card uses dedicated interrupt lines, only limited number of cards can
be used.
 Since address lines of 24 bits, a maximum of 224=16 MB of RAM can only be accessed
for DMA.
 Since data bus size is 16 bits only, higher bits data (32-bits) communication would reduce
system performance.
 ISA cards do not have plug and play (PnP) technology i.e. they can’t be configures
automatically by BIOS or operating system.
 ISA cards must be controlled manually by setting the I/O addresses, interrupts and clock
speed using jumpers and switches on the card itself.
D
ow
Improvements in ISA bus
 EISA (Extended ISA) of 32-bits, 8 MHz; now obsolete
 ISA PnP for plug and play; now obsolete
 VL-Bus of 32-bits operated at the speed of local bus (CPU)
o Used only for graphics cards
o Possibility of interference with the performance of the CPU
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
27
Instrumentation II
Chapter 2 : Parallel Interfacing With Microprocessor Based System
ot
es
.
ed
u.
np
PCI Bus (Peripheral Component Interconnect)
 Introduced in 1990 by Intel
 Provides direct access to the CPU and system memory but uses a bridge to connect to the
system bus to eliminate the potential for interference with CPU.
 PCI bus is independent of processor type or speed
 Originally operated at 33 MHz using 32-bit data lines
 Revised standard at 66 MHz using 64-bit data lines
 The 32-bit PCI connector has 124 pins and 64-bit PCI connector has 188 pins
 The PCI bus is able to work with so few pins because of hardware multiplexing i.e. the
device sends more than one signal over a single pin
 Also, PCI supports devices that use 5v signalling voltage levels
 PCI card support plug and play (PnP) feature i.e. PCI devices are automatically
recognized and configured to work in system.
D
ow
nl
oa
de
d
fro
m
io
en
Advancement in PCI bus
 PCI-X (PCI extended): runs at 133 MHz, 32-bit and 1.06 GBps data rate
 PCI-E (PCI express): replaced PCI, PCI-X & AGP standards
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
28
Chapter 2 : Parallel Interfacing With Microprocessor Based System
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
Instrumentation II
Fig: The pin out of the PCI bus
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
29
Instrumentation II
Chapter 2 : Parallel Interfacing With Microprocessor Based System
ot
es
.
ed
u.
np
Tutorials:
1. Assume that your group has decided to make a PC based control system for a wine company.
After studying the system, your group found out that the following to be implemented for
controlling purpose:
 Pressure measurement (6 points)
 Temperature measurement (5 points)
 Weight measurement (1 point)
 Volume measurement for filling (5 points)
Your group also decided to use 8255A PPI card at base address 0550H.
a) List out collected documents and components
b) List out different signals you need to derive and or can be directly connected to your
interfacing circuit.
c) Draw minimum mapping circuit for above system
d) What are the address captured by card
e) Generate necessary control word
f) Write a program module for measuring the pressure of all the points and control if the
pressure is not in a range, Assume suitable data if necessary.
fro
m
io
en
Solution:
a) Components: 8255A card, ADC, MUX, Memory, Processor, connecting wires, power
supplies (+5V, GND), gates etc.
Documents: Data sheets and technical documentation of above components
b) Signals needed to be derived on directly connected to circuit
 A1, A2, Chip Select ( CS ) for Port selection of of 8255A, RESET signal
 Read ( RD ) and Write ( WR ) signals
 Start Conversion (SC) and End of Conversion (EOC)
c) The minimum mapping circuit is as given below:
D7
D
ow
nl
oa
.
.
.
A2
de
A15
d
To 8085
PA7
PA0
D7
D0
D0
8 Bit
ADC
EOC
SC
PC7
CS
A1
A0
Vin
PC0
8255A
PPI
RD
WR
PB4
PB0
Select Line
32X1
MUX
……
RESET OUT
Analog
Input
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
30
Instrumentation II
Chapter 2 : Parallel Interfacing With Microprocessor Based System
A
2
A
1
A
0
0
0
0
0
0
0
1
1
0
1
0
1
ed
u.
np
d) The base address of card is 0550H, following are address captured by card.
Port
Address
A A A A A A A A A A A A A
1 1 1 1 1 1 9 8 7 6 5 4 3
5 4 3 2 1 0
0550H
0 0 0 0 0 1 0 1 0 1 0 1 0
A
0551H
0 0 0 0 0 1 0 1 0 1 0 1 0
B
0552H
0 0 0 0 0 1 0 1 0 1 0 1 0
C
0553H
0 0 0 0 0 1 0 1 0 1 0 1 0
CR
ot
es
.
The total numbers of monitoring points are 17. If we use 1 ADC for all of them, we need
to select any one at given time. So, we can use 32X1 MUX which would then have 25=32
i.e. 5 selection lines (B0 to B4). These lines can have defined for any of the 17 lines.
In the above circuit,
Port A  Input port to read data from ADC in mode 0
Port B  Output port to select any one of 17 lines from MUX in mode 0
Port C  Output port (PC0 as SC) and Input port (PC7 as EOC)
D7
1
D6
0
D5
0
D4
1
D3
1
D2
0
D3
0
D2
0
D3
0
D2
0
D0
0
= 98H
D1
0
D0
1
= 01H
D1
0
D0
0
= 00H
D1
0
D5
0
D4
0
BSR word to reset PC0
D5
0
D4
0
d
D6
0
de
D7
0
fro
D6
0
m
BSR word to set PC0
D7
0
io
en
e) Control word and BSR words:
Control word to set up port ports in above configuration:
oa
Assuming that ADC starts the conversion process only when it receives SC signal and
after conversion indicates via EOC line i.e. it has finished conversion and so ADC port
data in its data lines which can be now be read through port A.
D
ow
nl
f) Program Module:
LXI H, MEMORY
MVI A, 98H
STA 0553H; write control word in CR
MVI C, 06H; set counter to read 6 pressure points
MVI B, 00H; selection of points for MUX
NEXT: MOV A, B
STA 0551H; select first pressure point
MVI A, 01H; load A with BSR word to set PC0
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
31
Chapter 2 : Parallel Interfacing With Microprocessor Based System
ot
es
.
STA 0553H; set SC line
CALL DELAY
MVI A, 00H; load A with BSR word to reset PC0
STA 0553H; reset SC line
READ: LDA 0552H; read port C
RAL
JNC READ; check for PC7
LDA 0550H; read data from port A
MOV M, A; store value in memory
CPI MAX_VALUE; compare with maximum value
JNC CONTROL;
control value
CPI MIN_VALUE; compare with minimum value
JC CONTROL;
control value
INR B
INX H
DCR C
JNZ NEXT
ed
u.
np
Instrumentation II
fro
m
io
en
2. Interfacing keyboard and seven-segment display.
(Refer Gaonkar  15.2  pages 480-487)
3. Interfacing Lathe machine and tape reader.
(Refer Hall)
4. Interfacing parallel printer.
(Refer Hall)
5. Interface a temperature sensor using an A/D converter and port A of the 8255. Interface a fan
and a heater using optocouplers and triacs to drive the I/O devices. Write instructions to read
the temperature; if the temperature is less than 10oC, turn on the heater; and if the
temperature is higher than 35oC, turn on the fan.
de
d
Load temperature from temperature sensor LM135 and control fan and heater.
If temperature > 35o  Fan ON
If temperature < 10o  Heater ON
(Refer Gaonkar  15.1.4  pages 468-472)
D
ow
nl
oa
6. You are required to monitor the operation of pump as well as status of upper and lower tank
in the household. Apart from that you need to control 3 lights that are to turn ON in the
evening and turn OFF in the morning time. Additionally, you also need to check the status of
smoke sensors in Room1, Room2 & Room3, and heat sensor in kitchen and ring alarm when
necessary.
Your group also decided to use 8255 PPI card at base address 3000H in memory mapped I/O
for controlling purpose. Make complete circuitry including relays and relay driving
transistor.
Write a program module to read status of heat sensor and generate alarm when the limit
exceeds.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Brey |
32
Instrumentation II
Chapter 3: Serial Interfacing With Microprocessor Based System
Chapter -3
Advantages of Serial Data Transfer Over Parallel
Synchronous and Asynchronous Data Transfer
Errors in Serial Data Transfer
Simplex, Half Duplex and Full Duplex Data Communication
Parity and Baud Rates
Introduction Serial Standards RS232, RS423, RS422
Universal Serial Bus
3.7.1 The Standards:- USB 1.1 and USB 2.0
3.7.2 Signals, Throughput & Protocol
3.7.3 Devices, Hosts and On-The-Go
3.7.4 Interface Chips: USB Device and USB Host
ot
es
.
3.1
3.2
3.3
3.4
3.5
3.6
3.7
ed
u.
np
Serial Interfacing with Microprocessor Based System
io
en
Within a microcomputer data is transferred in parallel, because that is the fastest way to do it.
For transferring data over long distances, however, parallel data transmission requires too many
wires. Therefore, data to be sent long distances is usually converted from parallel form to serial
form so that it can be sent on a single wire or pair of wires. Serial data received from a distant
source is converted to parallel form so that it can easily be transferred on the microcomputer
buses.
ow
nl
oa
de
d
fro
m
Advantages of Serial Data Transfer Over Parallel
 Longer data transmission in serial mode
o Serial; 1  -3V to -25V
0  +3V to +25V
o Parallel; 1  +5V
0  0V
o Voltage loss is not much a problem in serial communication.
 Serial transmission requires less number of wires than parallel and so cheaper to transmit
data.
 Crosstalk is less of an issue because there are fewer conductors’ compared to that of
parallel cables.
 Many IC and peripherals have serial interface
 Clock skew between different cables is not an issue
 Serials can be clocked at higher data rate
 Serial cable can be longer than parallel
 Cheaper to implement
D

But in serial mode of transfer, only one bit of a word is transferred at a time so that data
transfer rate is very slow; it is the one of the demerit over parallel data transfer.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
1
Instrumentation II
Chapter 3: Serial Interfacing With Microprocessor Based System
ed
u.
np
Serial Data Transmission
In a serial data transmission, the data are sent one bit at a time over the transmission channel.
However, since most processors process data in parallel, the transmitter needs to transform
incoming parallel data into serial data and the receiver needs to do the opposite.
ot
es
.
In case of serial transmission data is sent in a serial form i.e. bit by bit on a single line. Also, the
cost of communication hardware is considerable reduced since only a single wire or channel is
require for the serial bit transmission. Serial data transmission is slow as compared to parallel
transmission. Serial data can be sent synchronously or asynchronously.
D
ow
nl
oa
de
d
fro
m
io
en
Serial Synchronous Data Transmission
In serial synchronous data transmission, data is transmitted or received based on a clock signal.
At a specific rate of data transmission, the transmitting device sends a data bit at each clock
pulse. In order to interpret the data correctly, the receiving device must know the start and end of
each data unit. The transmitter must know the number of data units to be transferred and the
receiver must be synchronized with the data boundaries.
Therefore, there must be
synchronization between the transmitter and receiver. Usually one or more SYNC characters are
used to indicate the start of each synchronous data stream or frame of data.
Transmitter sends a large block of data characters one after the other with no time between
characters. Transmitting device sends data continuously to the receiving device. If the data is not
ready to be transmitted, the line is held in marking condition. To indicate the start of
transmission, the transmitter sends out one or more SYNC characters or a unique bit pattern
called a flag, depending on the system being used. The receiving device waits for data, when it
finds the SYNC characters or the flag then starts interpreting the data which shifts the data
following the SYNC characters and converts them to parallel form so they can be read in by a
computer.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
2
Instrumentation II
Chapter 3: Serial Interfacing With Microprocessor Based System
ed
u.
np
Synchronous transmission has the advantage that the timing information is accurately aligned to
the received data, allowing operation at much higher data rates. It also has the advantage that the
receiver tracks any clock drift which may arise (for instance due to temperature variation). The
penalty is however a more complex interfaces design, and potentially a more difficult interface to
configure (since there are many more interface options).
Data transmission takes place without any gap between two adjacent characters. However data is
send block by block. A block is a continuous steam of characters or data bit pattern coming at a
fixed speed. You will find a SYNC bit pattern between any two blocks of data and hence the data
transmission is synchronized. Synchronous communication is used generally when two
computers are communicating to each other at a high speed or a buffered terminal is
communicating to the computer.
io
en
ot
es
.
Advantages and Disadvantages of Synchronous Communication
Main advantage of Synchronous data communication is the high speed. The synchronous
communications require high-speed peripherals/devices and a good-quality, high bandwidth
communication channel.
The disadvantage includes the possible in accuracy. Because when a receiver goes out of
Synchronization, loosing tracks of where individual characters begin and end. Correction of
errors takes additional time.
D
ow
nl
oa
de
d
fro
m
Serial Asynchronous Data Transmission
The receiving device does not need to be synchronized with the transmitting device. The
transmitting device can send one or more data units when it is ready to send data. Each data unit
must be formatted i.e. must contain start and stop bits for indicating beginning and the end of
data unit. It also includes one parity bit to identify odd or even parity of data. To send ASCII
character, the framing of data should contain:
 1 start bit: Beginning of data
 8 bit character: Actual data transferred
 1 or 2 stop bits: End of data
When no data is being sent, the signal line is in a constant high or marking state. The beginning
of the data character is indicated by the line going low for 1 bit time and this bit is called a start
bit. The data bits are then sent out on the line one after the other where the least significant bit is
sent out first. Parity bit should contain to check for errors in received data. After the data bit and
a parity bit, the signal line is returned high for at least 1 bit time to identify the end of the
character, this always high bit is referred to as a stop bit. Some older systems use 2 stop bits.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
3
Chapter 3: Serial Interfacing With Microprocessor Based System
ot
es
.
ed
u.
np
Instrumentation II
fro
m
io
en
In asynchronous transmission each character is transmitted separately, that is one character at a
time. The character (8-bits) is preceded by a start bit (1-bit), which tells the receiving end where
the character coding begins, and is followed by a stop bit (1 or 2-bits), which tells the receiver
where the character coding ends. There will be intervals of ideal time on the channel shown as
gaps. Thus there can be gaps between two adjacent characters in the asynchronous
communication scheme. In this scheme, the bits within the character frame (including start,
parity and stop bits) are sent at the baud rate.
The START bit and STOP bit including gaps allow the receiving and sending computers to
synchronize the data transmission. Asynchronous communication is used when slow speed
peripherals communicate with the computer. The main disadvantage of asynchronous
communication is slow speed transmission. Asynchronous communication however, does not
require the complex and costly hardware equipments as is required for synchronous
transmission.
nl
oa
de
d
Synchronous versus Asynchronous serial data transmission
S.N. Parameter
Asynchronous
Synchronous
1.
Fundamental
Transmission does not Transmission based on clock
based on clock signal
signal
2.
Data Format
One character at a time
Group of characters i.e. a
block of characters
3.
Speed
Low (< 20 kbps)
High (> 20 kbps)
4.
Framing
Start and stop bits are sent SYNC characters are sent
Information
with each character.
with each character.
5.
Implementation Hardware / Software
Hardware
D
ow
Serial Data Unit (SDU) & Serialization
 SDU is a unit with 1 start bit, 8 data bits, 1 parity bit and 1 or 2 stop bits.
 Start bit always has a value of 0 & stop bits always have a value of 1.
 Following figure shows a SDU format; for asynchronous data transmission, sender and
receiver must be set up to the same format.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
4
Instrumentation II
Chapter 3: Serial Interfacing With Microprocessor Based System
ed
u.
np
Fig: SDU or frame format
ot
es
.
Transmitting SDU
 The interface chip has a transmitter hold register for transmitting data which first fetches
the data bytes from CPU.
 According to the selected data format, the SDU logic puts the start bit in front of data
bits; it then calculates the parity bit and appends it together with the stop bits to the data
bits.
 Thus formed SDU is transferred into the transmitter shift register, which is operated by a
clock source determined by baud rate and thus provides the individual bits at the serial
output (LSB first). If no data, then the chip possesses a logical high level.
Bus
Interfac e
Transmitter
Hold
Register
SDU
Logic
Transmitter
Shift
Register
io
en
Interface Control & Baud
rate Generator
D7
m
Stop
D6
D5
Parity
D4
D3
D2
D1
D0
Data Bits
Start
Fig: SDU at transmitter side
D
ow
nl
oa
de
d
fro
Receiving SDU
 Inverse reception process
 Start bit acts as trigger pulse & starts the receiver in the serial input chip.
 The SDU bits are loaded into the receiver shift register according to the phase of the
setup baud rate.
 The receiver SDU logic then separates the start, parity, stop bits from the received SDU
bits, calculates the parity of the data bits & compares it with the setup parity.
 Afterwards, the extracted data bits are transferred into the receiver buffer register from
which they may be read out as the received data byte by the CPU.
Bus
Interfac e
Interface Control & Baud
rate Generator
Receiver
Buffer
Register
SDU
Logic
Receiver
Shift
Register
D0
D1
Start
D2
D3
D4
Data Bits
D5
D6
D7
Parity
Stop
Fig: SDU at receiver Side
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
5
Instrumentation II
Chapter 3: Serial Interfacing With Microprocessor Based System
m
io
en
ot
es
.
ed
u.
np
Errors in Serial Data Transfer
From the description of the transmission and reception process, it can be readily seen that
transmitter and receiver must be set to the same baud rate. Additionally, the set data formats (i.e.
number of data bits, parity, start and stop bits) must also coincide; otherwise the receiver may
resemble possibly a different byte from that which the transmitter was passed for transmitting.
Upon reception of an SDU, various errors may occur.
1. Framing Error
Data does not fit in frame that data format and baud rate defined i.e. non-synchronized
start / stop bit. Eg:- Change in no. of bits in receiving and transmitting end.
2. Break Error
If the reception line is at logic low level for longer time than the SDU usually lasts, then
the receiver assumes that the connection to the transmitter has broken. Unless the
transmitter drives the line to a logical high level, no data is transferred.
3. Overrun Error
If data arriving at the receiver is much faster than it can be read from the receiver buffer;
the latter received byte overwrites the older data in the buffer.
4. Parity Error
The calculated parity does not coincide with the set one. It may be due to the noise or a
different set for parity at transmitter and receiver sides.
 No parity
 Even parity
 Odd parity
 Mark parity
 Space parity
de
d
fro
Error Checks in Data Communication
During transmission, various types of errors can occur such as data bits may change because of
noise or can be misunderstood by the receiver due to different clocks between transmitter and
receiver. These errors need to be checked; therefore, additional information for error checking is
sent during the transmission. The receiver can check the received data against the error check
information, and if an error is detected, the receiver can request the retransmission of that data
segment or it can correct by proper coding techniques. Three methods are generally in common
practice; they are parity check, checksum and cyclic redundancy check.
D
ow
nl
oa
Parity Check
This is the simplest method of error checking which checks the characters by counting the
number of 1s. In this method, D7 of each ASCII code is used to transmit parity check
information. Parity may be the even parity (having even number of 1s in a character) or the odd
parity (having odd number of 1s in a character).
In an even parity system, when a character has an odd number of 1s, the bit D7 is set to 1 and an
even number of 1s is transmitted. On the other hand, in an odd parity system, when a character
has an even number of 1s, the bit D7 is set to 1 and an odd number of 1s is transmitted.
For an example, character to be sent is ‘A’ whose ASCII code is 41H (0100 0001) with two 1s. If
the character is transmitted in an odd parity system, the bit D7 is set to 1 and if it is transmitted in
an even parity system, the bit D7 is set to 0. Most of microprocessors are designed to detect
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
6
Instrumentation II
Chapter 3: Serial Interfacing With Microprocessor Based System
parity using the parity flag. However, the parity check cannot detect multiple errors in any given
character.
ed
u.
np
Checksum
The checksum technique is used when blocks of data are transmitted. It involves adding all the
bytes in a block without carriers. Then, the 2’s complement of the sum (negative of the sum) is
transmitted as the last byte. The receiver adds all the bytes, including the 2’s complement of the
sum; thus, the result should be zero if there is no error in the block.
ot
es
.
Cyclic Redundancy Check (CRC)
This technique is based on mathematical relationships of polynomials. A stream of data can be
represented as a polynomial that is divided by a constant polynomial, and the remainder, unique
to that set of bits, is generated. The remainder is sent out as a check for errors. The receiver
checks the remainder to detect an error in the transmission. This is a somewhat complex
technique for error checking.
fro
m
io
en
Baud Rate / Bit Rate
The difference between Bit and Baud rate is complicated and intertwining. Both are dependent
and inter-related.
Bit Rate is how many data bits are transmitted per second.
A baud Rate is the number of times per second a signal in a communications channel changes.
Bit rates measure the number of data bits (that is 0′s and 1′s) transmitted in one second in a
communication channel. A figure of 2400 bits per second means 2400 zeros or ones can be
transmitted in one second, hence the abbreviation “bps.” Individual characters (for example
letters or numbers) that are also referred to as bytes are composed of several bits.
oa
de
d
A baud rate is the number of times a signal in a communications channel changes state or varies.
For example, a 2400 baud rate means that the channel can change states up to 2400 times per
second. The term “change state” means that it can change from 0 to 1 or from 1 to 0 up to X (in
this case, 2400) times per second. It also refers to the actual state of the connection, such as
voltage, frequency, or phase level).
The main difference between the two is that one change of state can transmit one bit, or slightly
more or less than one bit, that depends on the modulation technique used. So the bit rate (bps)
and baud rate (baud per second) have this connection:
D
ow
nl
If signal is changing every 10/3 ns then,
Baud rate = 1/10/3ns
= 3/10*109
= 3*108
= 300 mbd
Note:
If 1 frame of data is coded with 1 bit then band rate and bit rate are same. Sometimes frame of
data are coded with two or more bits then baud rate and bit rate are not same.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
7
Instrumentation II
Chapter 3: Serial Interfacing With Microprocessor Based System
Fig: Simplex mode
ot
es
.
Receiver
Transmitter
ed
u.
np
Simplex, Half Duplex and Full Duplex Data Communication
Simplex Mode
Simplex transmission allows data to travel only in a single, pre specified direction. An example
from everyday life is doorbell the signal can go only from the button to the chime. Two other
examples are television and radio broadcasting. The simplex standard is relatively uncommon for
most types of computer-based telecommunications applications; even devices that are designed
primarily to receive information, such as printers must be able to communicate
acknowledgement signals back to the sender devices.
System A
System B
Unidirectional
io
en
Half Duplex Mode
It is a two way communication between two ports provided that only party can communicate at a
time. In half duplex transmission messages can move in either direction, but only one way at a
time. The press to talk radio phones used in police cars employs the half-duplex standard; only
one person can talk at a time. Often the line between a desktop workstation and a remote CPU
conforms to the half duplex patterns as well. If another computer is transmitting to a workstation,
the operator cannot send new messages until the other computer finishes its message to
acknowledge an interruption.
OR
fro
Transmitter/Rec
eiver
m
System A
System B
Transmitter/Rec
eiver
Fig:Half Duplex mode
Transmitter/Rec
eiver
OR/AND
Transmitter/Rec
eiver
Fig: Full Duplex mode
D
ow
nl
oa
de
d
Full Duplex Mode
It provides simultaneous two way transmission without the intervening stop-and-wait aspect of
half duplex. Full duplex is widely used in applications requiring continuous channels usage. Full
duplex transmission works like traffic on a busy two way street the flow moves in two directions
at the same time. Full-duplexing is ideal for hardware units that need to pass large amounts of
data between each other as in mainframe-to-mainframe communications.
System A
System B
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
8
Instrumentation II
Chapter 3: Serial Interfacing With Microprocessor Based System
ot
es
.
ed
u.
np
Standards in Serial I/O
The serial I/O technique is commonly used to interface different peripheral terminals such as
printers, modems with microcomputers which are designed and manufactured by various
manufacturers. Therefore, a common understanding must exist, among various manufacturing
and user groups that can ensure compatibility among different equipment. The standard is
defined as the understanding which is accepted in industry and by users. A standard is normally
defined by a professional organizations such as IEEE (Institute of Electrical and Electronics
Engineers), EIA (Electronic Industries Association) as a de jure standard. However, a
widespread practice can become a de facto standard.
In serial I/O, data can be transmitted as either current or voltage. When data are transmitted with
current signal such for teletype equipment, 20 mA (or 60 mA) current loops are used. When a
teletype is marking or at logic 1, current flows; when it is at logic 0 (space), the current flow is
interrupted. The advantage of the current loop method is that signals are relatively noise-free and
are suitable for transmission over a distance.
When data are transmitted with voltage signal, there are various standards which are explained in
this section.
m
io
en
RS-232C
Serial transmission of data is used as an efficient means for transmitting digital information
across long distances, the existing communication lines usually the telephone lines can be used
to transfer information which saves a lot of hardware. RS-232C is an interface developed to
standardize the interface between data terminal equipment (DTE) and data communication
equipment (DCE) employing serial binary data exchange. Modem and other devices used to send
serial data are called data communication equipment (DCE). The computers or terminals that are
sending or receiving the data are called data terminal equipment (DTE).
fro
RS- 232C is the interface standard developed by electronic industries Association (EIA) in
response to the need for the signal and handshake standards between the DTE and DCE. RS232C has following standardize features.
It uses 25 pins (DB – 25P) or 9 Pins (DE – 9P) standard where 9 pins standard does not
use all signals i.e. data, control, timing and ground.
- It describes the voltage levels, impendence levels, rise and fall times, maximum bit rate
and maximum capacitance for all signal lines.
- It specifies that DTE connector should be male and DCE connector should be female.
- It can send 20kBd for a distance of 50 ft.
- The voltage level for RS-232 are:
o A logic high or 1 or mark, -3V to -15V
o A logic low or 0 or space,
+3v to +15v
- Normally ±12V voltage levels are used
D
ow
nl
oa
de
d
-
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
9
RS- 232 signals used in handshaking:
m
Signal
Protective Ground
TxD
RxD
fro
DB-25P
2
3
4
5
6
7
8
20
22
23
GND
RI
DSRD
Description
Transmitted Data
Received Data
Request To Send
Clear To Send
Data Set Ready
Signal Ground
Data Carrier Detect
Data Terminal Ready
Ring Indicator
Data Signal Rate Detector
oa
de
d
Signal Flow DE-9P
1
DTE to DCE
3
DCE to DTE
2
DTE to DCE
7
DCE to DTE
8
DCE to DTE
6
Common Ref
5
DCE to DTE
1
DTE to DCE
4
DCE to DTE
9
DCE to DTE
-
ot
es
.
-
Mc1488 line driver converts logic 1 to -9V
Logic 0 to +9v
Mc1489 line receiver converts RS – 232 to TTL
Signal levels of RS-232 are not compatible with that of the DTE and DCE which are TTL
signals for that line driver such as M 1488 and line receiver MC1489 are used.
io
en
-
Chapter 3: Serial Interfacing With Microprocessor Based System
ed
u.
np
Instrumentation II
Data Set Ready (DSR):
When the MODEM is powered up and ready to transmit or receive data, it will assert data
set ready (DSR’) to the terminal. Under manual control or terminal control, modem then
dials up the computer. If the computer is available, it will send back a specified tone.
D
ow
nl
Data Terminal Ready (DTR):
After the terminal power is turned on and terminal runs any self checks, it asserts data
terminal ready (DTR’) signal to tell the modem that it is ready.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
10
Instrumentation II
Chapter 3: Serial Interfacing With Microprocessor Based System
Request to send (RTS):
When a terminal has a character ready to send, it will assert a request-to-send (RTS’)
signal to the modem.
ed
u.
np
Data Carrier Detect (DCD):
The modem will then assert its data-carrier-detect (DCD’) signal to the terminal to
indicate that it has established connection with the computer.
Clear to send (CTS):
When the modem is fully ready to receive data, it asserts the clear-to-send (CTS’) signal
back to the terminal.
ot
es
.
Ring indicator (RI):
It indicates that a ring has occurred at modem. Deactivating DTR or DSR breaks the
connection but RI works independently of DTR i.e. a modem may activate RI signal even
if DTR is not active.
io
en
Transmitted Data (TxD):
The terminal then sends serial data characters to the modem.
Received Data (RxD):
Modem will receive data from terminal through this line.
m
Data Signal Rate Detect (DSRD):
It is used for switching different baud rate.
D
ow
nl
oa
de
d
fro
Digital Data Transmission Using Modem and standard Phone Lines
Standard telephone system can be used for sending serial data over long distances. However,
telephone lines are designed to handle voice, bandwidth of telephone lines ranges from 300 HZ
to 3400 HZ. Digital signal requires a bandwidth of several megahertz. Therefore, data bits should
be converted into audio tones, this is accomplished through modems.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
11
Instrumentation II
-
DTE asserts
to tell the modem it is ready.
Then DCE asserts
signal to the terminal and dials up.
DTE asserts
signal to the modem.
Modem then asserts
signal to indicate that it has established connection with the
computer.
DCE asserts
signals, then DTE sends serial data.
When sending completed, DTE asserts
high, this causes modem to un assert its
signal and stop transmitting similar handshake taken between DCE and DTE other side.
To communicate from serial port of a computer to serial port of another computer without
modem, null-modem is used.
ot
es
.
Simplex, Half Duplex and Full Duplex Operation Using RS-232 port
ed
u.
np
-
Chapter 3: Serial Interfacing With Microprocessor Based System
Simplex Connection for RS-232C
There are two possibilities; data transfer from DTE to DCE or vice versa.
io
en
From DTE to DCE
The DTE transfers data to the DCE via the TxD line. The RxD line is not connected. The DCE
does not use RTS or DTE holds RTS signal active all the time. The DCE always outputs an
inactive DCD signal as it can receive data from DTE and transfer it to destination. By means of
DTR signal, DTE can indicate DCE that it is ready for operation as usual and may activate or
disable DCE. RI signal has no meaning because normally transmitter calls receiver.
de
d
fro
m
Form DCE to DTE
In this case, only the DCE transfers data to the DTE via RxD line. The TxD line is not
connected. The DCE does not either use RTS or CTS signal or holds them constantly at an active
level. The DCE may output an active DCD signal as it can detect a carrier signal from an
external device and transfer data to DTE. By means of DTR, the DTE can indicate that it is ready
for operation and it can activate or disable the DCE as usual. The RI signal has a meaning as
external device may call DTE via DCE.
D
ow
nl
oa
Half Duplex Connection for RS-232C
On a half duplex connection, both the DTE and DCE can operate as receiver and transmitter, but
only one data line is available which is alternatively used by the DTE and DCE. The TxD and
RxD lines output and receive data respectively in a strictly ordered manner for assigning the
roles as receiver and transmitter between DTE and DCE; the handshake control signals RTS and
CTS are used. If a DTE device wants to act as a transmitter, then it activates the RTS signal and
waits for an acknowledgement of other DCE device by means of CTS signal. Now, data can be
exchanged while DTE acting as transmitter and DCE as receiver otherwise DCE may operate as
transmitter and DTE as receiver.
Full Duplex Connection for RS-232C
Most microcomputer modems are full duplex, and transfer data in both directions
simultaneously; thus DTE and DCE act simultaneously as receiver and transmitter. The RTS and
CTS signals are meaningless and are usually not used or are always active. Further, the DSR
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
12
Instrumentation II
Chapter 3: Serial Interfacing With Microprocessor Based System
ed
u.
np
signal is also enabled all the time on most modems but on some DCEs, DSR may be active only
if preparations for calling destination device are completed. The signal is normally activated by
DCE only if it has detected a carrier signal from the destination device. Also, in this connection,
DTR signal acts as a main switch and RI indicates that an external device wants to establish a
connection with DTE via DCE.
A full duplex connection is very comfortable, as we need not pay attention to the roles of
receiver and transmitter i.e. we may keep RTS signal active all time ignoring CTS and DSR
signals.
Null (Zero) Modem Connection
ot
es
.
A zero modem serves for data exchange between DTEs. Since both the computers are
configured as DTEs, directly connecting them by means of the conventional serial interface cable
is impossible; not even the plug fits into the jack of the second terminal. Also the TxD meets
TxD and RxD meets RxD, DTR meets DTR and DSR meets DSR etc. This means that outputs
are connected to outputs and inputs are connected to inputs. With this convention, no data
transfer is possible.
D
ow
nl
oa
de
d
fro
m
io
en
For the transmission of data, it is required to twist the TxD and RxD lines. In this way, the
transmitted data of one terminal (PC) becomes received data of other and vice versa. As shown
in figure, activation of RTS to begin a data transfer gives rise to an activation of CTS on same
DTE and to an activation of DCD on other DTE. Further, an activation of DTR leads to rise of
DSR and RI on other DTE. Hence for every DTE, it is simulated that a DCE is on the end of line,
although a connection between two DTEs is actually present. Zero modem can be operated with
standard BIOS and DOS functions.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
13
Instrumentation II
Chapter 3: Serial Interfacing With Microprocessor Based System
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
Connection to Printers
As a printer is not DCE, various control and status lines have to be connected or interchanged to
emulate behavior of a DCE. TxD data of PC becomes received data of printer. DCD and RI
signals on PC are meaningless. On PC, RTS and CTS are connected to each other so that a
transmission request from PC immediately enables the transmission. Since, printer as DTE refers
to print anything as long as no active signal is present at inputs CTS, DSR and DCD. This
problem is solved by connecting RTS with CTS and DTR with DCD and DSR. Thus, activating
RTS gives rise to an activation of CTS and that of DTR to an activation of DCD and DSD.
Overrun error arises in serial interface as PC can transmit data much faster than printer can print
it so internal printer buffer gets full. On parallel interface, this problem is solved as printer
activates BUSY signal informing PC that it cannot accept data temporarily. In serial interface,
pin 19 of printer is used to output a <<Buffer Full Signal>>. On DTE, DSR provide an input for
this signal. If printer buffer is full, printer simply disables handshake signal at pin 19 and DTE
knows that temporarily no additional data can be transferred. If enough room is available in
buffer again, printer enables signal once more; PC may transfer data to printer. Not all printers
with serial interface provide such a buffer full signal at pin 19.
D
ow
nl
RS-423A
A major problem with RS-232C is that it can only transmit data reliably for about 50 ft at its
maximum rate of 20Kbd. If longer lines are used the transmission rate has to be drastically
reduced due to open signal lines with a common signal ground. Another EIA standard which is
improvement over RS-232C is RS-423A. The standardize features of RS-423 are:
- This standard specifies a low impendence single ended signal which can be sent over 50
coaxial cable and partially terminated at the receiving end to prevent reflection.
- Voltage levels
o Logic High 4V - 6V negative
o Logic Low
4V - 6V positive
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
14
Instrumentation II
It allows a maximum data rate of 100 Kbd over 40 ft line or a maximum baud rate of 1
Kbd over 4000 ft line.
ot
es
.
ed
u.
np
-
Chapter 3: Serial Interfacing With Microprocessor Based System
oa
de
d
fro
m
io
en
RS-422A
It is a newer standard for serial data transfer. It specifies that each signal will be sent
differentially over two adjacent wires in a ribbon cable or a twisted pair of wires uses differential
amplifier to reject noise. The term differential in this standard means that the signal voltage is
developed between two signal lines rather than between signal line and ground as in RS-232C
and RS-423A. Any electrical noise induced in one signal line will be induced equally in the other
signal line. A differential line receiver MC3486 responds only to the voltage difference between
its two inputs so any noise voltage that is induced equally on two inputs will not have any effect
on the output of the differential receiver.
D
ow
nl
RS-422A has following standardized features:
- Logic high is transmitted by making ‘b’ line more positive than ‘a’ line.
- Logic low is transmitted by making ‘a’ line more positive than ‘b’ line.
- The voltage difference between the two lines must be greater than 0.4V but less than
12V.
- The MC3487 driver provides a differential voltage of about 2V.
- The center or common mode voltage on the lines must be between -7v and +7v
- Transmission rate is 10 MBd for 40 ft and 100 KBd for 4000 ft.
- The high data transfer is because of differential line functions as a fully terminated
transmission line.
- Mc 3486 receiver only responds to the differential voltage eliminating noise.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
15
Chapter 3: Serial Interfacing With Microprocessor Based System
Distance
Logic 0
Logic 1
Receiver Input
Voltage
Mode of
Operation
50 ft
+3 V to +25 V
-3 V to -25 V
±15V
7.
8.
Noise Immunity
Input Impedance
9.
Short circuit
current
2.0 V
3-7 KOhm and
2500 pf
500 mA
6.
Single ended
input and output
Universal Serial Bus (USB)
Differential
input and output
150 mA
150 mA
1.8 V
>4 KOhm
In the past, connecting multiple peripheral devices to computer has been a real problem.
There were too many different port types (serial port, parallel port, PS/2 etc.) and their
use imposes limitations such as no hot-plug ability and automatic configuration.
USB is designed to allow many peripherals to be connected using a single standardized
interface. It provides an expandable, fast, bi-directional, low-cost, hot-pluggable Plug and
Play serial hardware interface that makes the life of the computer users easier allowing
them to plug different peripheral devices into a USB port and have them automatically
configured and ready to use. Using a single connector type, USB allows the user to
connect a wide range of peripheral devices, such as keyboards, mice, printers, scanners,
mass storage devices, telephones, modems, digital still-image cameras, video cameras,
audio devices to a computer. USB devices do not directly consume system resources.
USB is an industry standard developed in the mid-1990s that defines the cables,
connectors and protocols used for connection, communication and power supply between
computers and electronic devices.
. It has become commonplace on other devices, such as smart phones, PDAs and video
game consoles. USB has effectively replaced a variety of earlier interfaces, such as serial
and parallel ports, as well as separate power chargers for portable devices.
ow
nl

oa

de
d
fro

Differential
input and single
ended output
3.4 V
>4 KOhm
m

RS-422A
10 Mbaud at 40
ft
100 kbaud at
4000 ft
4000 ft
B line > A line
A line > B line
±7V
io
en
2.
3.
4.
5.
RS-423A
100 Kbaud at 40
ft
1 kbaud at 4000
ft
4000 ft
+4 V to +6 V
-4 V to –6 V
±12V
ed
u.
np
Comparison of Serial I/O Standards
S.N. Specifications
RS-232C
1.
Speed
20 Kbaud
ot
es
.
Instrumentation II
Features of USB
Single connector type: USB replaces all the different legacy connectors with one welldefined, standardized USB connector for all USB peripheral devices, eliminating the need
for different cables and connectors and thus simplifying the design of the USB devices.
So all USB devices can be connected directly to a standard USB port on a computer.
D

Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
16
Instrumentation II




nl
oa
•
de
•
d
fro
m
•
ed
u.
np

ot
es
.

Hot-swappable: USB devices can be safely plugged and unplugged as needed while the
computer is running. So there is no need to reboot.
Plug and Play: Operating system software automatically identifies, configures, and loads
the appropriate device driver when a user connects a USB device.
High performance: USB offers low speed (1.5 Mbit/s), full speed (12 Mbit/s) and high
speed (up to 480 Mbit/s) transfer rates that can support a variety of USB peripherals.
USB 3.0 (SuperSpeed USB) achieves the throughput up to 5.0 Gbit/s.
Expandability: Up to 127 different peripheral devices may theoretically be connected to a
single bus at one time.
Power supplied from the bus: USB distributes the power to all connected devices
eliminating the need for external power source for low-power devices. High-power
devices can still require their own local power supply. USB also supports power saving
suspend/resume modes.
Easy to use for end user: A single standard connector type for all USB devices simplifies
the end user's task at figuring out which plugs go into which sockets. The operating
system automatically recognizes the USB device attachment and loads appropriate device
drivers.
Low-cost implementation: Most of the complexity of the USB protocol is handled by the
host, which along with low-cost connection for peripherals makes the design simple and
low cost.
Wide range of workloads and applications:
– Suitable for device bandwidths ranging from a few kb/s to several Mb/s
– Supports isochronous as well as asynchronous transfer types over the same set of
wires
– Supports concurrent operation of many devices (multiple connections)
– Supports up to 127 physical devices
– Supports transfer of multiple data and message streams between the host and
devices
– Allows compound devices (i.e., peripherals composed of many functions)
– Lower protocol overhead, resulting in high bus utilization
Isochronous bandwidth
– Guaranteed bandwidth and low latencies appropriate for telephony, audio, etc.
– Isochronous workload may use entire bus bandwidth
Robustness
– Error handling/fault recovery mechanism is built into the protocol
– Dynamic insertion and removal of devices is identified in user-perceived real-time
– Supports identification of faulty devices
io
en

Chapter 3: Serial Interfacing With Microprocessor Based System
D
ow
USB Standards
USB 1.0
 USB 1.0: Released in January 15, 1996.
Specified data rates of 1.5 Mbit/s (Low-Bandwidth) and 12 Mbit/s (Full-Bandwidth).
Does not allow for extension cables or pass-through monitors (due to timing and power
limitations). Few such devices actually made it to market.
 USB 1.1: Released in September 23, 1998.
Introduced the improved specification and was the first widely used version of USB.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
17
Instrumentation II
Chapter 3: Serial Interfacing With Microprocessor Based System
Fixed problems identified in 1.0, mostly relating to hubs. Earliest revision to be widely
adopted.
ed
u.
np
USB 2.0
 The USB 2.0 specification was released in April 27, 2000 and was ratified by the USB
Implementers Forum (USB-IF) at the end of 2001.
 The major feature of revision 2.0 was the addition of a high-speed transfer rate of 480
Mbit/s. USB 2.0 supports three speeds namely High Speed - 480Mbits/s, Full Speed 12Mbits/s and Low Speed - 1.5Mbits/s with one host per bus (at a time).
Wireless USB
de
d
fro
m
io
en
ot
es
.
USB 3.0
 The USB 3.0 specification was published on 12 November 2008.
 Brings significant performance enhancements to the USB standard while offering
backward compatibility with the peripheral devices currently in use. Legacy USB 1.1/2.0
devices continue to work while plugged into new USB 3.0 host and new USB 3.0 devices
work at USB 2.0 speed while plugged into USB 2.0 host.
 Delivering data transfer rates up to ten times faster (the raw throughput is up to 5.0
Gbit/s) than Hi-Speed USB (USB 2.0), SuperSpeed USB is the next step in the continued
evolution of USB technology.
 Its main goals were to increase the data transfer rate (up to 5 Gbit/s), to decrease power
consumption, to increase power output, and to be backwards-compatible with USB 2.0.
USB 3.0 includes a new, higher speed bus called SuperSpeed in parallel with the USB 2.0
bus. For The first USB 3.0 equipped devices were presented in January 2010
 Transfer of 25 GB file in approx 70 seconds
 Extensible – Designed to scale > 25Gbps
 Optimized power efficiency
o No device polling (asynchronous notifications)
o Lower active and idle power requirements
 Backward compatible with USB 2.0
o USB 2.0 device will work with USB 3.0 host
o USB 3.0 device will work with USB 2.0 host
Released in May 12, 2005 which uses UWB (Ultra Wide Band) as the radio technology.


480 M bits/sec up to 3m
110 m bits/sec up to 10m
nl
oa

D
ow
Signals, Throughput & Protocol
USB Interconnect
• Bus Topology: Connection model between USB devices and the host.
• Inter-layer Relationships: In terms of a capability stack, the USB tasks that are performed
at each layer in the system.
• Data Flow Models: The manner in which data moves in the system over the USB
between producers and consumers.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
18
Instrumentation II
USB Schedule: The USB provides a shared interconnect. Access to the interconnect is
scheduled in order to support isochronous data transfers and to eliminate arbitration
overhead.
ot
es
.
Fig: 'A' Plug, 'B' Plug and 'Mini-B' Plug
ed
u.
np
•
Chapter 3: Serial Interfacing With Microprocessor Based System
io
en
Signals
Color
Name
Description
1
Red
Vcc
+5V dc
2
White
D-
Data-
Green
D+
Data+
Black
GND
Ground
fro
m
Pin
3
d
4
D
ow
nl
oa
de
Fig: USB electrical signals
Fig: USB signals and states
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
19
Chapter 3: Serial Interfacing With Microprocessor Based System
Bus State
Levels
D+ high, D- low
D- high, D+ low
D+ and D- low
D+ and D- high
Differential '1'
Differential '0'
Single Ended Zero (SE0)
Single Ended One (SE1)
Data J State:
Low-speed
Full-speed
Data K State:
Low-speed
Full-speed
Idle State:
Low-speed
Full-speed
Resume State
Differential '0'
Differential '1'
ot
es
.
Differential '1'
Differential '0'
ed
u.
np
Instrumentation II
io
en
Start of Packet (SOP)
D- high, D+- low
D+ high, D- low
Data K state
Data lines switch from idle to K
state
SE0 for 2 bit times followed by J
state for 1 bit time
SE0 for >= 2us
Idle for 2.5us
SE0 for >= 2.5 us
End of Packet (EOP)
m
Disconnect
Connect
Reset
oa
de
d
fro
J, K and SEO States
To make it easier to talk about the states of the data lines, some special terminology is used. The
'J State' is the same polarity as the idle state (the line with the pull-up resistor is high, and the
other line is low), but is being driven to that state by either host or device.
The K state is just the opposite polarity to the J state.
The Single Ended Zero (SE0) is when both lines are being pulled low.
The J and K terms are used because for Full Speed and Low Speed links they are actually of
opposite polarity.
nl
Single Ended One (SE1)
This is the illegal condition where both lines are high. It should never occur on a properly
functioning link.
D
ow
Reset
When the host wants to start communicating with a device it will start by applying a 'Reset'
condition which sets the device to its default unconfigured state.
The Reset condition involves the host pulling down both data lines to low levels (SE0) for at
least 10 ms. The device may recognize the reset condition after 2.5 us.
This 'Reset' should not be confused with a micro-controller power-on type reset. It is a USB
protocol reset to ensure that the device USB signaling starts from a known state.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
20
Instrumentation II
Chapter 3: Serial Interfacing With Microprocessor Based System
EOP signal
The End of Packet (EOP) is an SE0 state for 2 bit times, followed by a J state for 1 bit time.
ed
u.
np
Suspend
One of the features of USB which is an essential part of today's emphasis of 'green' products is
its ability to power down an unused device. It does this by suspending the device, which is
achieved by not sending anything to the device for 3 ms.
Normally a SOF packet (at full speed) or a Keep Alive signal (at low speed) is sent by the host
every 1 ms, and this is what keeps the device awake.
A suspended device may draw no more than 0.5 mA from Vbus.
A suspended device must recognise the resume signal, and also the reset signal.
io
en
ot
es
.
Resume
When the host wants to wake the device up after a suspend, it does so by reversing the polarity of
the signal on the data lines for at least 20ms. The signal is completed with a low speed end of
packet signal.
It is also possible for a device with its remote wakeup feature set, to initiate a resume itself. It
must have been in the idle state for at least 5ms, and must apply the wakeup K condition for
between 1 and 15 ms. The host takes over the driving of the resume signal within 1 ms.
m
Keep Alive Signal
This is represented by a Low speed EOP. It is sent at least once every millisecond on a low speed
link, in order to keep the device from suspending.
D
ow
nl
oa
de
d
fro
Throughput
• Throughput is the actual output of any device, USB’s actual throughput is a function of
many variables:
– Target device’s ability to source or sink data
– Bandwidth consumption by other devices in the bus
– Efficiency of host’s USB ports
– Types of data
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
21
Instrumentation II
Chapter 3: Serial Interfacing With Microprocessor Based System
m
io
en
ot
es
.
ed
u.
np
Speed
A USB device must indicate its speed by pulling either the D+ or D- line high to 3.3 volts. A full
speed device, pictured below will use a pull up resistor attached to D+ to specify itself as a full
speed device. These pull up resistors at the device end will also be used by the host or hub to
detect the presence of a device connected to its port. Without a pull up resistor, USB assumes
there is nothing connected to the bus.
D
ow
nl
oa
de
d
fro
Figure : Full Speed Device with pull up resistor connected to D+
Figure : Low Speed Device with pull up resistor connected to D-
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
22
Instrumentation II
Chapter 3: Serial Interfacing With Microprocessor Based System
ot
es
.
ed
u.
np
USB Protocols
Unlike RS-232 and similar serial interfaces where the format of data being sent is not defined,
USB is made up of several layers of protocols. While this sounds complicated, don’t give up
now. Once you understand what is going on, you really only have to worry about the higher level
layers. In fact most USB controller I.C.s will take care of the lower layer, thus making it almost
invisible to the end designer.
Each USB transaction consists of a
 Token Packet (Header defining what it expects to follow), an
 Optional Data Packet, (Containing the payload) and a
 Status Packet (Used to acknowledge transactions and to provide a means of error
correction)
As we have already discussed, USB is a host centric bus. The host initiates all transactions. The
first packet, also called a token is generated by the host to describe what is to follow and whether
the data transaction will be a read or write and what the device’s address and designated endpoint
is. The next packet is generally a data packet carrying the payload and is followed by an
handshaking packet, reporting if the data or token was received successfully, or if the endpoint is
stalled or not available to accept data.
PID0
nPID0
nPID1
nPID2
nPID3
d
ADDR: The address field specifies which device the packet is designated for. Being 7
bits in length allows for 127 devices to be supported. Address 0 is not valid, as any
device which is not yet assigned an address must respond to packets sent to address zero.
ENDP: The endpoint field is made up of 4 bits, allowing 16 possible endpoints. Low
speed devices, however can only have 2 additional endpoints on top of the default pipe.
(4 endpoints max)
CRC: Cyclic Redundancy Checks are performed on the data within the packet payload.
All token packets have a 5 bit CRC while data packets have a 16 bit CRC.
EOP: End of packet. Signalled by a Single Ended Zero (SE0) for approximately 2 bit
times followed by a J for 1 bit time.
nl
•
PID3
de
•
PID2
oa
•
PID1
fro
m
io
en
Common USB Packet Fields
Data on the USB bus is transmitted LSB first. USB packets consist of the following fields,
• Sync: All packets must start with a sync field. The sync field is 8 bits long at low and full
speed or 32 bits long for high speed and is used to synchronize the clock of the receiver
with that of the transmitter. The last two bits indicate where the PID fields starts.
• PID: PID stands for Packet ID. This field is used to identify the type of packet that is
being sent.
There are 4 bits to the PID, however to insure it is received correctly, the 4 bits are
complemented and repeated, making an 8 bit PID in total. The resulting format is shown below.
D
ow
•
USB Packet Types
USB has four different packet types. Token packets indicate the type of transaction to follow,
data packets contain the payload, handshake packets are used for acknowledging data or
reporting errors and start of frame packets indicate the start of a new frame.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
23
Instrumentation II
Sync
•
ADDR
ENDP
CRC5
EOP
Data Packets: There are two types of data packets each capable of transmitting up to
1024 bytes of data.
o Data0
o Data1
High Speed mode defines another two data PIDs, DATA2 and MDATA.
Data packets have the following format,
Sync
PID
Data
CRC16
EOP
Maximum data payload size for low-speed devices is 8 bytes.
Maximum data payload size for full-speed devices is 1023 bytes.
Maximum data payload size for high-speed devices is 1024 bytes.
Data must be sent in multiples of bytes.
io
en
o
o
o
o
Status / Handshake Packets: There are three type of handshake packets which consist
simply of the PID
o ACK - Acknowledgment that the packet has been successfully received.
o NAK - Reports that the device temporary cannot send or received data. Also used
during interrupt transactions to inform the host there is no data to send.
o STALL - The device finds its in a state that it requires intervention from the host.
Handshake Packets have the following format,
fro
m
•
PID
ed
u.
np
Token Packets: There are three types of token packets,
o In - Informs the USB device that the host wishes to read information.
o Out - Informs the USB device that the host wishes to send information.
o Setup - Used to begin control transfers.
Token Packets must conform to the following format,
ot
es
.
•
Chapter 3: Serial Interfacing With Microprocessor Based System
EOP
de
Start of Frame Packets
The SOF packet consisting of an 11-bit frame number is sent by the host every
1ms  500ns on a full speed bus or every 125 µs  0.0625 µs on a high speed bus.
Sync
PID
Frame Number
CRC5
EOP
nl
oa

PID
d
Sync
D
ow
Transfer Model
Endpoints
Endpoints can be described as sources or sinks of data. As the bus is host centric, endpoints
occur at the end of the communications channel at the USB function. At the software layer, your
device driver may send a packet to your devices EP1 for example. As the data is flowing out
from the host, it will end up in the EP1 OUT buffer. Your firmware will then at its leisure read
this data. If it wants to return data, the function cannot simply write to the bus as the bus is
controlled by the host. Therefore it writes data to EP1 IN which sits in the buffer until such time
when the host sends a IN packet to that endpoint requesting the data. Endpoints can also be seen
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
24
Instrumentation II
Chapter 3: Serial Interfacing With Microprocessor Based System
ed
u.
np
as the interface between the hardware of the function device and the firmware running on the
function device.
All devices must support endpoint zero. This is the endpoint which receives all of the devices
control and status requests during enumeration and throughout the duration while the device is
operational on the bus.
io
en

ot
es
.
Pipes
While the device sends and receives data on a series of endpoints, the client software transfers
data through pipes. A pipe is a logical connection between the host and endpoint(s). Pipes will
also have a set of parameters associated with them such as how much bandwidth is allocated to
it, what transfer type (Control, Bulk, Iso or Interrupt) it uses, a direction of data flow and
maximum packet/buffer sizes. For example the default pipe is a bi-directional pipe made up of
endpoint zero in and endpoint zero out with a control transfer type.
USB defines two types of pipes
 Stream Pipes have no defined USB format, that is you can send any type of data down a
stream pipe and can retrieve the data out the other end. Data flows sequentially and has a
pre-defined direction, either in or out. Stream pipes will support bulk, isochronous and
interrupt transfer types. Stream pipes can either be controlled by the host or device.
Message Pipes have a defined USB format. They are host controlled, which are initiated
by a request sent from the host. Data is then transferred in the desired direction, dictated
by the request. Therefore message pipes allow data to flow in both directions but will
only support control transfers.
D
ow
nl
oa
de
d
fro
m
Data Flow Types
• Control Transfers:
– typically used for short, simple commands to the device, and a status response,
used e.g. by the bus control pipe number 0
• Bulk Data Transfers:
– Large sporadic transfers using all remaining available bandwidth (but with no
guarantees on bandwidth or latency). A device like a printer, which receives data
in one big packet, uses the bulk transfer mode. A block of data is sent to the
printer (in 64-byte chunks) and verified to make sure it is correct.
• Interrupt Data Transfers:
– Devices that need guaranteed quick responses (bounded latency). A device like a
mouse or a keyboard, which will be sending very little data, would choose the
interrupt mode.
• Isochronous Data Transfers:
– At some guaranteed speed (often but not necessarily as fast as possible) but with
possible data loss A streaming device (such as speakers) uses the isochronous
mode. Data streams between the device and the host in real-time, and there is no
error correction.
Devices (Nodes), Hosts and On-The-Go
 The USB is based on a so-called 'tiered star topology' in which there is a single host
controller and up to 127 'slave' devices. The host controller is connected to a hub,
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
25
Instrumentation II


fro
m
io
en
ot
es
.

integrated within the PC, which allows a number of attachment points (often loosely
referred to as ports). A further hub may be plugged into each of these attachment points,
and so on. However there are limitations on this expansion.
A device can be plugged into a hub, and that hub can be plugged into another hub and so
on. However the maximum number of tiers permitted is six.
All devices have an upstream connection to the host and all hosts have a downstream
connection to the device.
The length of any cable is limited to 5 metres. This limitation is expressed in the
specification in terms of cable delays etc, but 5 metres can be taken as the practical
consequence of the specification. This means that a device cannot be further than 30
metres from the PC, and even to achieve that will involve 5 external hubs, of which at
least 2 will need to be self-powered.
So the USB is intended as a bus for devices near to the PC. For applications requiring
distance from the PC, another form of connection is needed, such as Ethernet.
ed
u.
np

Chapter 3: Serial Interfacing With Microprocessor Based System
de
Hub
•
•
•
d
Fig: USB network protocol architecture
D
ow
nl
oa
Hub has two major roles: power management and signal distribution.
Hubs can be linked, potentially giving you unlimited USB ports to your computer.
The biggest difference between types of hubs that is important to know when dealing
with USB devices is between un-powered and powered hubs.
Powered Hub
• Needed when connecting multiple unpowered devices such as mice or digital cameras.
• These low-powered devices derive their power source from the bus.
• If too many are connected through a hub, the computer may not be able to handle it.
Un-powered Hub
• Un-powered hubs can be used with any number of high-power devices such as printers
and scanners that have their own power supply, thus not requiring power from the bus.
• Safe to use with low-power devices (mice, cameras, joysticks, etc.) as long as too many
aren’t connected as once.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
26
Instrumentation II
Chapter 3: Serial Interfacing With Microprocessor Based System
D
ow
nl
oa
de
d
fro
m
Interface Chips: USB device and USB host
io
en
ot
es
.
ed
u.
np
USB On The Go (OTG)
USB OTG is a new supplement to the USB 2.0 specification that arguments the capability of
existing mobile devices and USB peripherals by adding host functionality for connection to USB
peripherals. Since USB has traditionally consisted of host-peripheral topology where the PC was
the host and the peripheral was the relatively dump device, following new features were needed
to upgrade USB technology:
• A new standard for small form factor USB connectors and cables
• The addition of host capability to products that have traditionally been peripherals only,
to enable point-to-point connection
• The ability to be either host or peripheral (dual role devices) and to dynamically switch
between the two.
• Lowest power requirements to facilitate USB on battery powered devices.
USB On-The-Go (OTG) allows two USB devices to talk to each other without requiring the
services of a personal computer (PC). Although OTG appears to add peer-to-peer connections to
the USB world, it does not. Instead, USB OTG retains the standard USB host/peripheral model,
in which a single host talks to USB peripherals. OTG does introduce, however, the dual-role
device, or simply stated a device capable of functioning as either host or peripheral. Part of the
magic of OTG is that a host and peripheral can exchange roles if necessary.
Fig: Logical view of device host interface
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
27
Instrumentation II
•
•
•
•
fro
m
io
en
ot
es
.
•
Endpoint is where data enters or leaves the USB system. An IN endpoint is data creator
and OUT endpoint is data consumer. For reliable data delivery scheme, need multiple IN
and OUT endpoints.
The collection of endpoints is called an interface and is directly related to the real world
connection.
An operating system will have a driver that corresponds to each interface.
Some devices may have multiple interfaces such as a telephone has a keypad interface
and audio interface. Operating system will manage two separate device drivers.
A collection of interface is called a configuration, and only one configuration can be
active at a time.
A configuration defines the attribute and features of a specific model.
ed
u.
np
•
Chapter 3: Serial Interfacing With Microprocessor Based System
D
ow
nl
oa
de
d
Fig: Interface between device and host
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: Gaonkar, Hall & Hyde |
28
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
4.1 Introduction
4.2 General terms involved in D/A and A/D converter
4.3 Examples of D/A and A/D Interfacing
4.4 Selection of A/D and D/A converter based on Design Requirements
ed
u.
np
CHAPTER 4
INTERFACING A/D AND D/A CONVERTERS
ot
es
.
4.1
Introduction
Even though an analog signal may represent a real physical parameter like temperature, pressure
etc, it is difficult to process or store the analog signal for later use without introducing a
considerable error. Therefore, in microprocessor based industrial products, it is necessary to
translate an analog signal into digital signal. The electronic circuit that translates an analog signal
into digital signal is called ADC (Analog to Digital Converter). Similarly a digital signal needs to
be translated into an analog signal to represent a physical quantity; this translator is called DAC
(Digital to Analog Converter).
fro
m
io
en
Analog to Digital Converter
The A/D converter is a quantizing process whereby an analog signal is represented by equivalent
binary states. ADC can be classified into two general groups based on conversion technique.
 One technique involves comparing a given analog signal with the internally generated
equivalent signal. This includes successive approximation, counter and flash type
converters.
 Second technique involves a changing an analog signal into time or frequency and
comparing these new parameters to known values. This group includes integrator
converters and voltage to frequency converters.
The successive approximation and the flash type are faster but generally less accurate than
integrator and voltage to frequency converters. The flash type is expensive and difficult to design
for high accuracy.
nl
oa
de
d
Fig. 4.1.a shows a block diagram of a 3-bit A/D converter, it has one input line for an analog
signal and three output lines for digital signals. Fig. 4.1.b shows the graph of the analog input
voltage (0-1 V) and the corresponding digital output signal. It shows 8 (23) discrete output states
from 000 to 111 each state being 1/8V apart. This is defined as the resolution of the converter.
D
ow
Analog
Input
D0
A/D
Converter
D1
D2
(a)
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
1
Chapter 4: Interfacing A/D and D/A Converters
io
en
ot
es
.
ed
u.
np
Instrumentation II
(b)
Fig. 4.1: a) A 3-bit ADC block diagram
b) Analog input versus digital output
D
ow
nl
oa
de
d
fro
m
Parameters (Characteristics) of ADC
 Resolution
In ADC, the original analog signal has essentially an infinite resolution as the signal is
continuous. The digital representation of this signal would of course reduce this
resolution as digital quantities are discrete and vary in equal steps. The resolution of an
ADC is smallest change that can be distinguished in the analog input.
Resolution = FSR (Full Scale Range) / 2n
 Conversion Time
The A/D conversion another critical parameter is conversion time. This is defined as the
total time required converting an analog signal into its digital output.
 Accuracy
It is the comparison of the actual output and the expected output.
 Linearity
The output should be the linear function of input.
 Full scale output value
The maximum bit output achieved from the respective input.
Types of ADC
1. Successive Approximation A/D Converter
It is one of the most used ADC.
Conversion time is faster than Dual slope but slower than Flash.
It has fixed conversion time for any value of analog input.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
2
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
Comparator
VIN
Analog Input
+
Control
_
ed
u.
np
Successive approximation register generates a series of bit and DAC convert it into analog value
which is compared with output. For 4-bit ADC, 1000 is generated and the analog value of 1000
is compared with the output. If it is greater, 1 is flipped to 0 otherwise retained. Then in next
clock cycle the second bit is changed to 1 and the whole cycle continues till every bit is flipped
and checked.
Start
Status
Data
Ready
CLK
Successive
Approximation
Register
4-Bit D/A
Converter
Output
Register
io
en
Analog
Reference
ot
es
.
VO
D3 D2 D1 D0
de
d
fro
m
Fig. 4.2: Block diagram of successive approximation A/D converter
It includes three major elements: the A/D converter, the successive approximation register (SAR)
and the comparator. The conversion technique involves comparing the output of the D/A
converter VO with the analog input signal Vin. When the DAC output matches the analog signal,
the input to the DAC is the equivalent digital signal. In the case of a 4-bit A/D converter, bit D3
is turned on first and the output of the DAC is compared with an analog signal. If the comparator
changes the state, indicating that the output generated by D3 is larger than the analog signal, bit
D3 is turned off in the SAR and bit D2 is turned on. The process continues until the input reaches
bit D0.
D
ow
nl
oa
2. The Counter type ADC
The analog input is the V+ input to the comparator. As long as it is greater than V- input, the
AND gate is enabled and clock pulses are passed to the counter. The digital output of the counter
is converted to an analog voltage by the DAC and that voltage is the other input to the
comparator. Thus the counter counts up until its output has a value equal to the analog input. At
that time, comparator switches low inhibiting the clock pulses and counting ceases. The count it
reached is the digital output proportionate to the analog input. Control circuitry shown in fig 4.3
is used to latch the output and reset the counter. This scheme uses long time for conversion.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
3
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
Comparator
V+
Analog Input
AND Gate
+
V-
8-Bit Counter
Q7Q6Q5Q4Q3Q2Q1Q0
ed
u.
np
_
Digital
Output
Clock
DAC Output
ot
es
.
D7D6D5D4D3D2D1D0
Fig. 4.3: Block diagram of an 8-bit counter type ADC
io
en
3. Parallel Comparator ADC (Flash Type ADC)
 The Flash Type ADC (Simultaneous ADC) is the fastest ADC that utilizes comparators
that compares reference voltage with input analog voltage.
 A priority encoder is used to convert the output of comparator into digital output.
 For n-bit ADC 2n-1 comparators are required, so this is very expensive.
 It’s conversion time is less and can even digitize video signal.
10 Ω
oa
de
2V
10 Ω
A2
D1
Priority Binary Code
Output
Encoder
D0
+
_
A1
nl
1V
10 Ω
A3
fro
+
_
d
Analog Input
VIN
3V
10 Ω
+
_
m
VRef = 4V
D
ow
Fig. 4.4: Parallel Comparator ADC
Advantages: Very Fast, Clocks not required. Disadvantages: Expensive, Consume high power,
Complexity doubles for each additional bit.
Fig. 4.4 shows a circuit for 2-bit ADC using parallel comparators. A voltage divider sets
reference voltage on the inverting input’s of each of the comparator. The voltage at the top of the
divider chain represents the full scale value for the converter. The voltage to be converted is
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
4
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
ot
es
.
ed
u.
np
applied to the non-inverting inputs of all the comparators in parallel. If the input voltage on a
comparator is greater than the reference voltage on the inverting input, the output of the
comparator will go high. The outputs of the comparators then give us a digital representation of
the voltage level of the input signal.
VIN
A3 A2 A1 D1 D2
0 ≤ VIN ≤ 1 0 0 0
0 0
1 ≤ VIN ≤ 2 0 0 1
0 1
2 ≤ VIN ≤ 3 0 1 1
1 0
3 ≤ VIN ≤ 4 1 1 1
1 1
For an example, with an input voltage of 2.6 V, the output of comparators A1 and A2 will be
high. A priority encoder produces a binary output corresponding to the input having the highest
priority. In this case, the one representing the largest voltage level equal to or less than analog
input. Thus, the binary output closely represents the analog input voltage. Although it is
expensive, the conversion time is fast.
D
ow
nl
oa
de
d
fro
m
io
en
4. Ramp ADC / Dual slope ramp ADC
Conversion from analog to digital form inherently involves comparator action where the value of
the analog voltage at some point in time is compared with some standard. A common way to do
that is to apply the analog voltage to one terminal of a comparator and trigger a binary
counter which drives a DAC. The output of the DAC is applied to the other terminal of the
comparator. Since the output of the DAC is increasing with the counter, it will trigger the
comparator at some point when its voltage exceeds the analog input. The transition of the
comparator stops the binary counter, which at that point holds the digital value corresponding to
the analog voltage. This has the advantage that a slow comparator cannot be disturbed by fast
input changes.
Fig. 4.5 (a): Ramp ADC
Dual Slope ADC is used in the Digital Voltmeter and other type of measuring instruments
because of its large resolution and low cost.
A ramp generator (integrator) is used to produce the dual slope characteristics.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
5
Chapter 4: Interfacing A/D and D/A Converters
ed
u.
np
Instrumentation II
de
d
fro
m
io
en
ot
es
.
Fig. 4.5 (b): Dual Slope Ramp ADC
Operation:
 First of all capacitor is reset (i.e. Vo is made zero)
 For positive Vin we need negative Vref.
 During time T1, the capacitor is charged by the Vin for fixed time interval which is
controlled by the control unit with a fixed current ( I = Va/R ).
 After time T1, the control unit switches the connection from Vin to –Vref through which
the capacitor is discharged. This discharge through the fixed slope until it
 becomes zero which is sensed by the comparator. The reading of the counter is the output
for the input.
D
ow
nl
oa
5. Integrator ADC
Fig. 4.6: Integrator ADC
The basic integrating ADC circuit consists of the op-amp integrator and a switch to select
between the voltage to be measured and the reference voltage. Depending on the
implementation, a switch may also be present in parallel with the integrator capacitor to allow
the integrator to be reset (by discharging the integrator capacitor). The switches will be
controlled electrically by means of the converter's controller (a microprocessor or dedicated
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
6
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
Calculate the maximum conversion time of a successive approximation ADC and an 8-bit
staircase ramp ADC, if the clock rate is 2MHz.
For a 8-bit successive approximation ADC, the conversion time is constant and equal to
n
8
Tc  
 4 106 s  4s
f 2 106
For a 8-bit staircase ramp ADC, the maximum number of count is
nc = 28 = 256
Therefore, the maximum conversion time is
n
256
Tc  c 
 128 106 s  128s
6
f 2 10
It can be noted that the conversion speed of successive approximation ADC is much
faster than the staircase ramp type.
io
en
ot
es
.
Q.
ed
u.
np
control logic). Inputs to the controller include a clock (used to measure time) and the output of a
comparator used to detect when the integrator's output reaches zero.
The conversion takes place in two phases: the run-up phase, where the input to the integrator is
the voltage to be measured, and the run-down phase, where the input to the integrator is a known
reference voltage. During the run-up phase, the switch selects the measured voltage as the input
to the integrator. The integrator is allowed to ramp for a fixed period of time to allow a charge to
build on the integrator capacitor. During the run-down phase, the switch selects the reference
voltage as the input to the integrator. The time that it takes for the integrator's output to return to
zero is measured during this phase.
D
ow
nl
oa
de
d
fro
m
Interfacing an 8-Bit ADC using Status Check
Fig: Interfacing an ADC using Status Check
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
7
Instrumentation II




ed
u.
np


Above figure shows a schematic of interfacing a typical ADC using status check.
ADC has one input line for analog signal and eight output lines for converted digital
signals.
Typically, analog signal can range from 0 to 10V or ±5V.
When an active low pulse is sent to the START pin, the DR goes high and the output
lines go into high impedance state.
The START pulse initiates conversion.
When the conversion is complete, the DR goes low and data are made available on the
output lines that can be read by the microprocessor.
To interface A/D converter, we need one output port to and a START pulse and two
input ports one to check the status of DR line and the other to read the output of the
converter.
The subroutine instructions to initiate the conversion and to read output data, and the
flowchart are shown below.
ot
es
.


Chapter 4: Interfacing A/D and D/A Converters
IN 80H; Read data ready status
RAR; Rotate D0 into carry
m
Test:
io
en
OUT 82H; Start conversion
fro
JC TEST; If D0=1, conversion is not yet complete,
; go back and check
de
d
IN 81 H; read output and save it in accumulator
RET
D
ow
nl
oa
Fig: Flowchart of ADC Process
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
8
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
io
en
ot
es
.
ed
u.
np
Interfacing an 8-Bit ADC using Interrupt
D
ow
nl
oa
de
d
fro
m
Fig: Interfacing ADC 0801 using Interrupt
 In ADC interfacing using status check, we need external ports to access data and monitor
the data ready signal. In this configuration using Interrupt, the necessary logic is built
inside the chip.
 The converter requires a clock at CLK IN; the frequency range can be from 100 KHZ to
800 KHZ.
 The user has two options; either to connect an external clock at CLK IN or to use the
built in internal clock by connecting a register and a capacitor externally at pins 19 & 4
respectively.
 The frequency is calculated by using the formula F = 1 / 1.1 RC.
 The ADC0801 is designed to be microprocessor compatible. It has three control
signals: CS , WR and RD that are used for interfacing. To start conversion, the CS and
WR signals are asserted low.
 When WR goes low, the internal SAR is reset and the output lines go into the high
impedance state. When WR makes transition from low to high, the conversion begins.
 When the conversion is completed, the INTR is asserted low and the data are placed on
the output lines. INTR signal can be used to interrupt the processor.
 When the processor reads the data by asserting RD , the INTR is set.
 When Vcc is +5V, the input voltage can range from 0V to 5V and the corresponding
output will be from 00H to FFH.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
9
Instrumentation II
However, the full-scale output can be restricted to the lower range of inputs by using pin
9 (Vref/2). For example, if we connect a 0.5V DC source at pin 9, we can obtain full
scale output FFH for a 1V input signal.
Fig: Timing diagram for Reading Data from ADC
fro
m
io
en
Service Routine:
LDA 8000H; Read data
MOV M, A ; store data in memory
INX H;
Next memory location
DCR B;
Next count
STA 8000H; start next conversion
EI;
Enable interrupt again
RNZ;
Go back to main if counter not equal to zero
HLT
ot
es
.
ed
u.
np

Chapter 4: Interfacing A/D and D/A Converters
D
ow
nl
oa
de
d
Sample and Hold Circuit:
A Sample and Hold circuit is used before analog signal is fed to ADC, so that the value of analog
input can be kept constant and conversion can be done with constant value. Start/ EOC signals
are used for interfacing.
The result of sampling process is identical to multiplying the analog signal by a train of pulses of
unit magnitude. Sample and hold circuit is used when it is necessary to hold the sampled value of
input signal for specified period of time. Sample and hold circuit is used in order to avoid the use
of very fast and expensive A/D converters.
Fig.: Sample and Hold Circuit
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
10
Instrumentation II



Chapter 4: Interfacing A/D and D/A Converters
When the conversion is needed the switch is opened, isolating the capacitor from the
input
The capacitor will hold the voltage when switch is opened
The capacitor will not discharge due to the high impedance of the voltage follower
ed
u.
np
Quantization
It is the process of converting an input function having continuous values to an output having
only discrete values.
fro
m
io
en
ot
es
.
Binary Coding
It is the method of assigning a binary equivalent number to each discrete level.
nl
oa
de
d
Sampling Rate:
The Analog Signal is continuous in time and it is necessary to convert this to a flow of digital
values. It is therefore required to define the rate at which new digital values are sampled from the
analog signal. The rate of new values is called the Sampling Rate or Sampling Frequency of the
converter. A continuously varying band limited signal can be sampled and then the original
signal can be exactly reproduced from the discrete-time values by an interpolation formula. The
accuracy is limited by quantization error. However, this faithful reproduction is only possible if
the sampling rate is higher than twice the highest frequency of the signal. This is essentially what
is embodied in the Shannon-Nyquist Sampling Theorem.
D
ow
Since a practical ADC cannot make an instantaneous conversion, the input value must
necessarily be held constant during the time that the converter performs a conversion (called the
Conversion Time). An input circuit called a Sample and Hold performs this task in most cases by
using a capacitor to store the analog voltage at the input, and using an electronic switch or gate to
disconnect the capacitor from the input. Many ADC integrated circuits include the sample and
hold subsystem internally.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
11
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
ed
u.
np
Aliasing:
If the digital values produced by the ADC are converted back to analog values by a DAC, it is
desirable that the output of the DAC be an exact replica of the original signal. If the input signal
is changing much faster than the sample rate, then this will not be the case, and spurious signals
(false) called aliases will be produced at the output of the DAC. For example, a 2 kHz sine wave
being sampled at 1.5 kHz would be reconstructed as a 500 Hz sine wave. This problem is called
aliasing. To avoid aliasing, the input to an ADC must be low-pass filtered to remove frequencies
above half the sampling rate. This filter is called an Anti-aliasing Filter, and is essential for a
practical ADC system that is applied to analog signals with higher frequency content.
io
en
ot
es
.
Dither:
In ADC, performance can usually be improved using dither. This is a very small amount of
random noise (white noise), which is added to the input before conversion. The result is an
accurate representation of the signal over time. A suitable filter at the output of the system can
thus recover this small signal variation. An audio signal of very low level (with respect to the bit
depth of the ADC) sampled without dither sounds extremely distorted and unpleasant. Without
dither the low level may cause the least significant bit to "stick" at 0 or 1. With dithering, the true
level of the audio may be calculated by averaging the actual quantized sample with a series of
other samples (the dither) that are recorded over time.
fro
m
Sampling Theorem (Nyquist sampling theorem)
The theorem is commonly called the Nyquist sampling theorem, is a fundamental result in the
field of information theory, in particular telecommunications and signal processing. Sampling is
the process of converting a signal (for example, a function of continuous time or space) into a
discrete sequence (a function of discrete time or space). Sampling theorem states: If a
function x(t) contains no frequencies higher than B hertz, it is completely determined by giving
its ordinates at a series of points spaced 1/(2B) seconds apart.
de
d
In other way; a continuous time signal may be completely represented in its samples and
recovered back if the sampling frequency fs ≥ 2fm. Here, fs is the sampling frequency and fm is
the maximum frequency present in the signal.
ow
nl
oa
A signal or function is band limited if it contains no energy at frequencies higher than some band
limit or bandwidth B. A signal that is band limited is constrained in how rapidly it changes in
time, and therefore how much detail it can convey in an interval of time. The sampling theorem
asserts that the uniformly spaced discrete samples are a complete representation of the signal if
this bandwidth is less than half the sampling rate. To formalize these concepts, let x(t) represent
a continuous-time signal and X(f) be the continuous Fourier transform of that signal:
D
The signal x(t) is said to be band limited to a one-sided baseband bandwidth, B, if:
for all
or, equivalently, supp(X)[2]
[−B, B]. Then the sufficient condition for exact
reconstructability from samples at a uniform sampling rate fs(in samples per unit time) is:
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
12
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
or equivalently:
ed
u.
np
2B is called the Nyquist rate and is a property of the band limited signal, while fs / 2 is
called the Nyquist frequency and is a property of this sampling system.
The time interval between successive samples is referred to as the sampling interval:
and the samples of x(t) are denoted by:
(integers).
ot
es
.
The sampling theorem leads to a procedure for reconstructing the original x(t) from the samples
and states sufficient conditions for such a reconstruction to be exact.
m
io
en
What happens if we sample the signal at a frequency that is lower that the Nyquist rate? When
the signal is converted back into a continuous time signal, it will exhibit a phenomenon
called aliasing. Aliasing is the presence of unwanted components in the reconstructed signal.
These components were not present when the original signal was sampled. In addition, some of
the frequencies in the original signal may be lost in the reconstructed signal. Aliasing occurs
because signal frequencies can overlap if the sampling frequency is too low. Frequencies "fold"
around half the sampling frequency - which is why this frequency is often referred to as the
folding frequency.
D
ow
nl
oa
de
d
fro
Sometimes the highest frequency components of a signal are simply noise, or do not contain
useful information. To prevent aliasing of these frequencies, we can filter out these components
before sampling the signal. Because we are filtering out high frequency components and letting
lower frequency components through, this is known as low-pass filtering.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
13
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
MSB
D/A
Converter
Analog
Output
LSB
ot
es
.
Digital D2
Input D1
D0
ed
u.
np
Digital-to-Analog Converter (DAC)
DAC converts straight binary to analog voltage or current proportional to the digital value. DAC
can be broadly classified in three categories: Current Output, Voltage Output and Multiplying
Type.
Voltage output DAC is comparatively slower than Current output DAC because of the delay in
converting the current signal into voltage signal.
(a)
m
fro
d
001
010
011
100
101
Digital Input
110
111
nl
oa
000
LSB
de
A 7/8
n
a 3/4
l
o 5/8
g
1/2
O
u 3/8
t
p 1/4
u
t 1/8
io
en
FS
D
ow



Fig. : A 3-bit D/A converter
The three input lines D2, D1 and D0 can assume 8 input combinations from 000 to 111.
If the full scale analog voltage is 1V, the smallest unit or the LSB (Least Significat Bit)
0012 is equivalent to 1/2n of 1V. This is defined as resolution. Here, LSB (001)2 = 1/8 V.
The MSB (Most Significat Bit) represents half of the full scale value. Here, MSB (100)2
= 1/2 V.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
14
Instrumentation II

Chapter 4: Interfacing A/D and D/A Converters
For the maximum input signal (111)2, the output signal is equal to the value of the full
scale input signal minus the value of 1 LSB input signal. Here, maximum input signal
(111)2 represents (1 – 1 / 8) = 7 / 8 V.
ed
u.
np
Parameters (Characteristics) of DAC
 Resolution
It is determined by the number of bits in the input binary word. A 12-bit converter has a
resolution of 1 part in 212.
Full scale output voltage
The maximum output voltage of a converter (when all input are 1) will always have a
value 1 LSB less than the named value.

Accuracy
The actual output voltage of a DAC is different from the ideal value; the factors that
contribute to the lack of linearity also contribute to the lack of accuracy. The accuracy of
a DAC is the measure of difference between actual output voltage and the expected
output voltage. For an example, a DAC with ±0.2% accuracy and full scale (maximum)
output voltage of 10V will produce a maximum error for an output voltage is of 20 mV.
[0.2/100 * 10V = 0.002*10 V = 20mV]

Linearity
An ideal DAC should be linear i.e. the output voltage should be a linear function of the
input code. All DAC depart somewhat from the ideal linearity. Typical factors
responsible for introducing non-linearity are non-exact value of resistors and non-ideal
electronic switches that introduce extra resistance to the circuit. The non-linearity
(linearity error) is the amount by which the actual output differs from the ideal straight
line output.

Settling time
When the output of DAC changes from one value to another, it typically overshoots the
new value and may oscillate briefly around that new value before it settles to a constant
value. It is the time interval between the instant when the analog input passes a specified
value and the time instant when the analog output enters for the last time a specified error
band about its final value.

Monotonicity
A converter is said to be monotonic if its output voltage value continuous to increase with
a continuously increasing input value.
ow
nl
oa
de
d
fro
m
io
en
ot
es
.

D

Temperature Coefficient
It is defined as the degree of inaccuracy that the temperature change can cause in any of
the parameter of the DAC.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
15
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
Types of DAC:
ot
es
.
ed
u.
np
1) DAC with Binary Weighted Resistor Network (WRN):
Fig: DAC with Binary Weighted Resistor Network
io
en
WRN DAC circuit consists of
 Reference voltage VRef
 N Binary weighted resistors R, 2R, 4R,…. 2N-1R
 Single Pole Double Throw (SPDT) Switches S0, S1, S2…. SN-1
 Op Amp with feedback resistance RF=R/2
oa
de
d
fro
m
Switches controlled N-bit digital input word
D
ow
nl
Accuracy of Binary Weighted DAC depends critically on
 Accuracy of VRef
 Precision of Binary weighted resistors
 Perfection of switches
Drawbacks of Binary Weighted DAC:
Large spread between smallest and largest resistance for higher no. of bits
Precise resistor values not available
Impractical for large number of bits.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
16
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
ot
es
.
ed
u.
np
2) R-2R Ladder Network
It uses only two resistor values R and 2R. Hence, its implementation in IC form is much easier
than the weighted resistor converted.
D
ow
nl
oa
de
d
fro
m
io
en
Fig: R-2R Ladder (Voltage Mode)
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
17
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
io
en
ot
es
.
ed
u.
np
Interfacing 8-Bit DAC with 8085
Q. Design an output port with address FFH to interface the 1408 DAC that is calibrated for 0 to
10 V range.
Fig: Interfacing 1408 DAC in Unipolar Range
de
d
fro
m
This includes an 8-input NAND gate and a NOR gate as the address decoding logic, the
74LS373 as a latch, and a 1408 DAC. Address lines (A7-A0) are decoded using the 8-input
NAND gate and its output is combined with the control signal IOW . When the microprocessor
sends the address FFH, the output of the negative AND gate enables the latch, and the data bits
are placed on the input lines of the converter for conversion.
The total reference current source is determined by the resistor R14 and the voltage VRef. The
resistor R15 is generally equal to R14 to match the input impedance of the reference source. The
output IO is calculated as:
IO = VRef/R14 (A1/2 + A2/4 + A3/8 + A4/16 + A5/32 + A6/64 + A7/128 + A8/256)
nl
oa
For full scale input,
IO = 5V/2.5K (1/2 + ¼ + 1/8 + 1/16 + 1/32 + 1/64 + 1/128 + 1/256)
= 2mA (255/256)
= 1.992mA
D
ow
Output voltage,
VO = IO * RF
= 2mA (255/256) * 5K
= 9.961V
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
18
Chapter 4: Interfacing A/D and D/A Converters
ed
u.
np
Instrumentation II
ot
es
.
This program outputs 00 to FF continuously to the DAC. Analog output of DAC starts at 0 and
increases approximately up to 10V as ramp. Slope of the ramp can be varied by changing the
delay.
oa
de
d
fro
m
io
en
Q. Explain the operation of the 1408 which is calibrated for a bipolar range ±5V. Calculate
output voltage VO if the input is 100000002.
Fig: Interfacing 1408 DAC in Bipolar Range
D
ow
nl
The 1408 is calibrated for the bipolar range from -5V to +5V by adding the resistor RB (5.0K)
between the reference voltage VRef and the output pin 4. RB supplies 1mA (VRef/RB) current to
the output in the opposite direction of the current generated by input signal.
Here, IO’ = IO – VRef/RB
When input signal is zero,
VO = IO’ RF
= (IO – VRef/RB) RF
= (0 – 5V/5K) 5K
= -5V
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
19
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
fro
m
io
en
ot
es
.
ed
u.
np
When the input = 1000 0000, output VO is
VO = IO’ RF
= (IO – VRef/RB) RF
= (VRef/R14 * A1/2 - VRef/RB) RF
[A8-A2 = 0]
= (5V/2.5K * 1/2 – 5V/5K) 5K
= (1mA-1mA) 5K
= 0V
Microprocessor Compatible DAC
In response to the growing need for interfacing DAC with the microprocessor, specially designed
microprocessor-compatible DAC are available. These DAC generally include a latch on the chip,
thus eliminating the need for an external latch.
D
ow
nl
oa
de
d
Fig: Block Diagram of Analog Device along with latch and output Op-Amp internal to the Chip
To interface a device with the microprocessor, two signals are required: Chip Select ( CS ) and
Chip Enable ( CE ). In the figure shown above, the address line A7 through inverter is used for
Chip Select, which assigns port address 80H (assuming all other address lines 0) to the DAC
port.
Fig: Timing Diagram: Control Signals and Data Transfer
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
20
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
Figure above shows the timing of latching data in relation to the control signals. When both
signals CS and CE are at logic 0, the latch is transparent, meaning the input is transferred to the
DAC. When either CS or CE goes logic 1, input is latched in the register and held until both
control signals go to logic 0.
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
Interfacing 10-Bit DAC with 8085
In many DAC applications, 10 or 12-bit resolution is required. But microprocessor has only 8-bit
data lines. One method is to use two output ports on time shared basis; one for first eight bits and
second for the remaining bits. A disadvantage of this method is that the DAC input assumes on
intermediate value between two input operations. The solution to this difficulty can be using a
double buffer DAC.
D
ow
nl
Fig: Interfacing 10-Bit DAC with 8085
 AD7522 is a CMOS 10-bit DAC consists of an input buffer and a holding register. 10 bits
are loaded into the input register in two steps using two output ports.
 The low-order 8-bits are loaded with the control line LBS and remaining 2-bits are loaded
with the control line HBS. Then all 10-bits are switched into a holding register for
conversion by enabling LDAC line.
 When a data byte is sent to the port address 8000H in a memory map I/O, the WR and
IO/ M signals go low along with A0 and the line LBS is enabled. Similarly, the address
8001H enables lines HBS and LDAC.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
21
Chapter 4: Interfacing A/D and D/A Converters
ed
u.
np
Instrumentation II
D
ow
nl
oa
de
d
fro
m
Interfacing 12-bit DAC to 8-bit Data Bus
io
en
ot
es
.
Fig: Timing Diagram
 The following instructions illustrate how to load the maximum input of 10-bits all 1’s
into the DAC.
LXI B, 03FFH; Load 10-bit at logic 1 in BC register
LXI H, 8000H; Load HL with port address for lower 8-bits
MOV M, C;
Load 8-bits D7-D0 in the DAC
INX H;
Point to port address 8001H
MOV M, B;
Load two bits D9 and D8 and switch all ten bits for conversion
HLT
Fig: Interfacing 12-bit DAC to 8-bit Data Bus
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
22
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
ed
u.
np
Selection of DAC or ADC (Design Requirements)
• Resolution
• Linearity
• DAC: Settling Time
• ADC: Conversion Time
• Accuracy
• Codes Used
• Cost
ot
es
.
Errors in ADC and DAC
1. Dynamic Errors
A. Conversion Time
It is the elapsed time between the command to perform a conversion and the appearance at
the converter output of the complete digital representation of the analog input value.
io
en
B. Delay Time
It is the time interval between the instant when the digital input changes and the instant when
the analog output passes a specified value that is close to its initial value.
fro
m
C. Settling Time
When the output of DAC changes from one value to another, it typically overshoots the new
value and may oscillate briefly around that new value before it settles to a constant value. It
is the time interval between the instant when the analog output passes a specified value and
the instant when the analog output enters for a last time a specified error band about its final
value.
d
A
n
a
l
o
g
de
Error band (± ½ LSB)
D
ow
nl
oa
O
u
t
p
u
t
Digital Input
Time that digital
input changes
Settling Time (TS)
Time of last entry
into error band
Fig: Settling Time
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
23
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
Actual Output
Ideal Output
FS
000
001
010
011
100
101
Digital Input
110
111
m
Fig: Differential Linearity Error
io
en
ot
es
.
A 7/8
n
a 3/4
l
o 5/8
g
1/2
O
u 3/8
t
p 1/4
u
t 1/8
ed
u.
np
2. Static Errors
A. Differential Linearity
It is a measure of the separation between adjacent levels. Differential linearity measures the
bit-to-bit deviations from ideal output steps rather than entire output range. If VS is the ideal
change and VCX is the actual change, then the differential linearity can be expressed as:
[(VCX-VS)/VS]*100%
fro
B. Monotonicity
In a D/A converter; means that as the digital input to the converter increases over its full scale
range, the analog output never exhibit a decrease between one conversion step and next.
Ideal Output
oa
de
Actual Output
ow
nl
5/8
O
u 1/2
t
p 3/8
u
t
1/4
d
A FS
n
a 7/8
l
o
3/4
g
D
1/8
000
001
010
011
100
101
110 111
Digital Input
Point of Non-Monotonic Output
Fig: Non-Monotonic transfer function
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
24
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
C. Integral Linearity
It is the maximum deviation of the output of a D/A for any given input code from a straight line
drawn from its ideal minimum to its ideal maximum.
A FS
n
a 7/8
l
o
3/4
g
ed
u.
np
Actual Output
Expected Output
Integral
Linearity Error
ot
es
.
5/8
O
u 1/2
t
p 3/8
u
t
1/4
001
010
011
100
101
Digital Input
110
111
m
000
io
en
1/8
fro
Fig: Integral Linearity error
D
ow
nl
oa
de
d
I. Absolute Linearity
It is measured by assuming that the output of a D/A will begin at zero and end at full scale.
The actual outputs are compared with a line drawn through these two points.
a. Zero Error
It is the difference between the actual output and zero when the digital word for a zero
output is applied.
b. Full Scale Error
It is the difference between the actual and the ideal voltage when the digital word for a
full scale output is applied.
i. Gain Error (Scale Factor Non-Linearity)
It is the difference between the gains of the actual static and ideal input output
characteristics.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
25
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
A FS
n
a 7/8
l
o
3/4
g
Expected Output
ed
u.
np
Actual Output
5/8
O
u 1/2
t
p 3/8
u
t
1/4
000
001
010
011
100
101
Digital Input
110
ot
es
.
1/8
111
io
en
Fig: Gain error
ii. Offset Error
Offset error adds a constant value to output.
fro
d
de
oa
5/8
O
u 1/2
t
p 3/8
u
t
1/4
Actual Output
Ideal Output
m
A FS
n
a 7/8
l
o
3/4
g
nl
1/8
D
ow
Offset Error
000
001
010
011
100
101
Digital Input
110
111
Fig: Offset error
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
26
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
ju
Ad
ste
u
utp
O
d
} Gain Error
t
O
u
t
p
u
t
a
ut
io
en
Ide
utp
lO
ot
es
.
A
n
a
l
o
g
ed
u.
np
II.
Best Straight Line Linearity
It depicts the accuracy of a D/A in terms of the deviation from the ideal output range without
regard to zero or full scale errors.
Offset Error
Digital Input
d
de
utp
lO
Ac
tua
ut
oa
A
n
a
l
o
g
fro
m
Fig: Best straight line error
III.
End Point Linearity
It uses a straight line through the actual end points instead of the ideal points.
D
ow
nl
O
u
t
p
u
t
Digital Input
Fig.: End Point Linearity Error
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
27
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
Errors in D/A and A/D Converters
Differential Linearity: is
a measure of the
separation between
adjacent levels.
Differential linearity
measures the bit-to-bit
deviations from ideal
output steps rather than
entire output range. If VS
is the ideal change and
VCX is the actual change,
then the differential
linearity can be expressed
as: [(VCX-VS)/VS]*100%
io
en
m
End Point
Linearity: uses a
straight line
through the actual
end points instead
of the ideal points.
de
d
Zero Error: is the
difference between
the actual output
and zero when the
digital word for a
zero output is
applied.
D
ow
nl
oa
Absolute
Linearity: is
measured by
assuming that
the output of a
D/A will begin
at zero and end
at full scale.
The actual
outputs are
compared with
a line drawn
through these
two points.
Conversion Time: is
the elapsed time
between the command
to perform a
conversion and the
appearance at the
converter output of the
complete digital
representation of the
analog input value.
ot
es
.
Best Straight
Line Linearity:
depicts the
accuracy of a D/A
in terms of the
deviation from the
ideal output range
without regard to
zero or full scale
errors.
Monotonicity: in a D/A
converter; means that as
the digital input to the
converter increases over
its full scale range, the
analog output never
exhibit a decrease
between one conversion
step and next.
fro
Integral
Linearity: is
the maximum
deviation of
the output of a
D/A for any
given input
code from a
straight line
drawn from its
ideal minimum
to its ideal
maximum.
Dynamic
ed
u.
np
Static
Full Scale Error:
is the difference
between the actual
and the ideal
voltage when the
digital word for a
full scale output is
applied.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Gain Error: is the
difference between the
gains of the actual static
and ideal input output
characteristics.
Offset Error: it adds a
constant value to output.
Delay Time: is the
time interval between
the instant when the
digital input changes
and the instant when
the analog output
passes a specified
value that is close to
its initial value.
Settling Time: it is
the time interval
between the instant
when the analog
output passes a
specified value and
the time instant when
the analog output
enters for the last time
a specified error band
about its final value.
References: R. Gaonkar & D.V. Hall |
28
Instrumentation II
Chapter 4: Interfacing A/D and D/A Converters
Designing the embedded system with ADC, MUX, S/H circuit for transmitting data in long
distance.
Gain Adjustment
EOC
MUX
Input Data
OP
Amp
S/H Circuit
Micro
Processor
ADC
SOC
Select
Parallel
to Serial
Converter
Selectors
Serial to
Parallel
Converter
8255
PPI
Recorder
Display 1
Display 2
Recorder
A typical system that converts signals from analog to digital and back to analog includes:
 A transducer that converts non-electrical signals into electrical signals
 An A/D converter that converts analog signals into digital signals
 A digital processor that processes digital data (signals)
 A D/A converter that converts digital signals into equivalent analog signals
 A transducer that converts electrical signals into real life non-electrical signals
(sound, pressure, and video)
D
ow
nl
oa
de
d
fro
m
io
en

8255
PPI
ot
es
.
RS232/RS422/RS423 or
Radio link or Optical Fibre
Display
ed
u.
np
…………..
Temperature
Humidity
Pressure
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
29
Instrumentation II
Chapter 5: Data Acquisition and Transmission
Chapter – 5
Data Acquisition and Transmission
ot
es
.
io
en
Digital Transmission
• Concerned with content
• Integrity endangered by noise, attenuation etc.
• Repeaters used
• Repeater receives signal
• Extracts bit pattern
• Retransmits
• Attenuation is overcome
• Noise is not amplified
ed
u.
np
5.1 Analog and Digital Transmission
Analog Transmission
• Analog signal transmitted without regard to content
• May be analog or digital data
• Attenuated over distance
• Use amplifiers to boost signal
• Also amplifies noise
de
d
fro
m
Advantages of Digital Transmission
• Increased immunity to channel noise and external interference
• Flexible operation
• Low cost LSI/VLSI technology
• Easy to use
• Common Format
o Data, audio, video can be transmitted through same channel
• Security & Privacy
o Encryption and coding
• Integration
o Can treat analog and digital data similarly
nl
oa
Disadvantages of Digital Transmission
• High bandwidth requires
• Complex circuitry than analog
D
ow
Analog Communication System
In case of analog communication, the message signal to be transmitted is analog. This analog
message can be obtained from sources such as speech, video shooting etc. The analog signal
varies smoothly and continuously with time. The message signal is then modulated on some
carrier frequency by the modulator. The amplifier then gives this signal to the transmitting
antenna. Figure below shows the basic, block diagram of analog communication system.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
1
Chapter 5: Data Acquisition and Transmission
Fig: Analog communication system
ed
u.
np
Instrumentation II
ot
es
.
Presently, all the AM, FM radio transmission and TV transmission is analog communication.
The analog communication needs lower bandwidth compared to digital communication. But the
effect of noise interference is more in case of analog communication.
•
d
nl
•
•
de
•
Fig: Digital communication system
Source are converted into a sequence of binary digits which is called information
sequence Represent the source by an efficient number of binary digits
Efficiently converting the source into a sequence of binary digits is a process, which is
called source encoding of data compression
Channel encoder adds some redundancy into binary information sequence that can be
used for handle noise and interference effects at the receiver.
Digital modulator maps the binary information sequence into signal waveforms.
Communication channel is used to send the signal from the transmitter to the receiver.
Physical channels: the atmosphere, wireless, optical, compact disk,….
Digital demodulator receives transmitted signal contains the information which is
corrupted by noise
Cannel decoder attempts the reconstruct the original information sequence from
knowledge of the code used by channel encoder.
Source decoder attempts the reconstruct the original signal from the binary information
sequence using the knowledge of the source encoding methods.
The difference between the original signal and the reconstructed signal is measured of the
distortion introduced by the digital communication system
oa
•
fro
m
io
en
Digital Communication System
ow
•
D
•
•
•
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
2
Instrumentation II
•
Chapter 5: Data Acquisition and Transmission
Estimate what was send, aiming at the minimum possible probability of making mistakes
ed
u.
np
5.2 Transmission Schemes
• Guided transmission media – wire (twisted pair, cable, fibre)
• Unguided – wireless (radio wave, microwave, satellite, Bluetooth)
• Characteristics and quality determined by medium and signal
• For guided, the medium is more important
• For unguided, the bandwidth produced by the antenna is more important
• Key concerns are data rate and distance
io
en
ot
es
.
Design Factors
• Bandwidth
o Higher bandwidth gives higher data rate
• Transmission impairments
o Attenuation
• Interference
• Number of receivers
o In guided media
o More receivers (multi-point) introduce more attenuation (need more amplifies or
repeaters)
5.2.1 Fiber Optics
m
D
ow
nl
oa
de
d
•
•
Optical Fiber is a cylindrical waveguide system through which the optical wave can
propagate.
An Optical Fiber consists of three main parts: Core, Cladding and Jacket (See Figure )
An optical fiber is a dielectric (nonconductor of electricity) waveguide made of glass or
plastic. As shown in Figure below, it consists of three distinct regions: a core, the
cladding, and a sheath or jacket. The sheath or jacket protects the fiber but does not
govern the transmission capability of the fiber.
fro
•
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
3
Chapter 5: Data Acquisition and Transmission
Fig: Optical Fiber transmission block diagram
ed
u.
np
Instrumentation II
ot
es
.
Optical fibers come in two types:
1. Single-mode fibers:
It is used to transmit one signal per fiber (used in telephone and cable TV). They have small
cores (9 microns in diameter) and transmit infra-red light from laser.
A Fiber having very narrow core (core diameter of the order of wavelength of light injected)
is called Single mode fiber. The light travels only along the cores without reflection and with
no model dispersion.
Because of it high performance it is used for long distance, very high speed, large bandwidth
applications.
m
io
en
2. Multi-mode fibers:
It is used to transmit many signals per fiber (used in computer networks). They have larger
cores (62.5 microns in diameter) and transmit infra-red light from LED.
The multimode fiber has larger core diameter than single mode fiber. The core diameter is
about 40 um and that of cladding is 70 um. The relative refractive difference is also larger
than single mode fiber. They are not suitable for long distance communication due to large
dispersion and attenuation of the signal. The fabrication of multi fiber is less difficult and so
the fiber is not costly.
nl
oa
de
d
fro
There are two types of optical fibers based on refractive index
1. Step-index Optical Fiber
• In step index optical fiber, the core and cladding has their uniform refractive index, say
μ1 and μ2 respectively.
• These fibers have greatest range of core sizes (50-200 um).
• The light rays propagate through it are in the form of meridional rays which cross the
fiber axis during every reflection at the core-cladding boundary.
• Advantages - relatively easy to manufacture, cheaper than other types, larger layer NA,
they have longer life times than laser diodes
• Disadvantages – lower bandwidth, high dispersion and smearing of signal pulse.
D
ow
2. Graded-index optical fiber
• In Graded-index Optical Fibers the refractive index of core gradually decreases from the
centre towards the core-cladding interface. The cladding has a uniform refractive index
profile.
• The light lays propagate through it in the form of skew rays or helical rays. They do not
cross the fiber axis at any time and are propagating around the fiber axis in helical or
spiral manner.
• There is a periodic self focusing of the rays. Due to this self focusing the signal distortion
is very low.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
4
Instrumentation II
•
Advantages – Dispersion is low, bandwidth is greater than step-index multimode fiber
and easy to couple with optical source.
Disadvantages – Expansive and very difficult to manufacture.
de
d
fro
m
io
en
Advantages of Optical Fiber
• Thinner
• Less Expensive
• Higher Carrying Capacity
• Less Signal Degradation& Digital Signals
• Light Signals
• Non-Flammable
• Light Weight
• Enormous capacity
• Low transmission loss
• Cables and equipment have small size and weight
• Immunity to interference
• Electrical isolation
• Signal security
• Silica fibers have abundant raw material
ot
es
.
ed
u.
np
•
Chapter 5: Data Acquisition and Transmission
nl
oa
Disadvantages of Optical Fiber
• Requires skilled manpower for installation
• Difficult to repair and maintenance
• High equipment and manufacturing cost
• Splicing (joining two optical fibers) is difficult
D
ow
Applications of Optical Fiber
• In communication – Compared to a conventional system they offer better reliability, large
information transmission capacity, cost effective etc.
• Fiber Optic Sensors – They are used to convert various input variable into light signals
• In Medical Science – With the advent of fiber optics the otherwise inaccessible parts of
the body are now visible to the surgeon without actually cutting through the body. Ex.
Endoscopy.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
5
Instrumentation II
•
•
Chapter 5: Data Acquisition and Transmission
Military Applications – Optical Fiber are lighter in transportation and more reliable in
terms of secrecy as compared to conventional systems.
Entertainment – A coherent Optical Fiber bundle offers better enlargement of the image
displayed on a TV or screen.
nl
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
5.2.2 Satellite
• A Satellite communication system consists of ground stations for transmitting and
receiving signals and a communication satellite in the space.
• A satellite is simply a repeater
• It consists of several transponders each of which listens to some portion of the spectrum,
amplifies the incoming signal and then rebroadcasts it at another frequency to avoid
interference with the incoming signal.
• The range of frequencies used for transmission of signals from ground station to the
satellite is uplink frequency and those used for transmission of signals from satellites to
ground station is downlink frequency. Uplink and downlink frequencies are different to
avoid interference.
• The downlink beam can be broad, covering a substantial fraction of the earth’s surface
(used in broadcasting) or narrow beam covering only a hundreds of km in diameter.
D
ow
Two major elements of Satellite Communications Systems are
1. Space Segment
2. Ground Segment
The Space Segment includes
• Satellite
• Means for launching satellite
• Satellite control centre for station keeping of the satellite
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
6
Instrumentation II
Chapter 5: Data Acquisition and Transmission
fro
m
io
en
ot
es
.
ed
u.
np
The ground segment of satellite communications system establishes the communications
links with the satellite and the user. The functions of the ground segment are to transmit the
signal to the satellite and receive the signal from the satellite.
The ground segment consists:
• Earth Stations: It consists of transmitting equipment, receiving equipments and antenna
system.
• Rear Ward Communication links
• User terminal and interface network
oa
de
d
Types of Satellite
1. Low Earth Orbit (LEO)
• LEO satellites are much closer to the earth than GEO satellites, ranging from 500 to
1,500 km above the surface.
• LEO satellites don’t stay in fixed position relative to the surface, and are only visible for
15 to 20 minutes each pass.
• A network of LEO satellites is necessary for LEO satellites to be useful.
D
ow
nl
Advantages
o A LEO satellite’s proximity to earth compared to a GEO satellite gives it a better
signal strength and less of a time delay, which makes it better for point to point
communication.
o A LEO satellite’s smaller area of coverage is less of a waste of bandwidth.
Disadvantages
o A network of LEO satellites is needed, which can be costly
o LEO satellites have to compensate for Doppler shifts cause by their relative
movement.
o Atmospheric drag affects LEO satellites, causing gradual orbital deterioration.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
7
Instrumentation II
Chapter 5: Data Acquisition and Transmission
ot
es
.
ed
u.
np
2. Medium Earth Orbit (MEO)
• A MEO satellite is in orbit somewhere between 8,000 km and 18,000 km above the
earth’s surface.
• MEO satellites are similar to LEO satellites in functionality.
• MEO satellites are visible for much longer periods of time than LEO satellites, usually
between 2 to 8 hours.
• MEO satellites have a larger coverage area than LEO satellites.
Advantage
o A MEO satellite’s longer duration of visibility and wider footprint means fewer
satellites are needed in a MEO network than a LEO network.
Disadvantage
o A MEO satellite’s distance gives it a longer time delay and weaker signal than a LEO
satellite, though not as bad as a GEO satellite.
d
fro
m
io
en
3. Geostationary Earth Orbit (GEO)
• These satellites are in orbit 35,863 km above the earth’s surface along the equator.
• Objects in Geostationary orbit revolve around the earth at the same speed as the earth
rotates. This means GEO satellites remain in the same position relative to the surface of
earth.
Advantages
o A GEO satellite’s distance from earth gives it a large coverage area, almost a
fourth of the earth’s surface.
o GEO satellites have a 24 hour view of a particular area.
o These factors make it ideal for satellite broadcast and other multipoint
applications.
Disadvantages
o A GEO satellite’s distance also cause it to have both a comparatively weak signal
and a time delay in the signal, which is bad for point to point communication.
o GEO satellites, centered above the equator, have difficulty broadcasting signals to
near Polar Regions.
D
ow
nl
oa
de
Advantages of Satellites
• The coverage area of a satellite greatly exceeds that of a terrestrial system.
• Multiple signals can be superimposed at a time so capacity increased
• Transmission cost of a satellite is independent of the distance from the center of the
coverage area.
• Satellite to Satellite communication is very precise.
• Higher Bandwidths are available for use.
Disadvantages of satellite
• Bandwidth is decreased due to gradually becoming used up
• Launching satellites into orbit is costly.
• There is a larger propagation delay in satellite communication than in terrestrial
communication.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
8
Chapter 5: Data Acquisition and Transmission
Service Types (Application Area) of Satellite
• Fixed Service Satellites (FSS)
o Example: Point to Point Communication
• Broadcast Service Satellites (BSS)
o Example: Satellite Television/Radio
o Also called Direct Broadcast Service (DBS).
• Mobile Service Satellites (MSS)
o Example: Satellite Phones
ot
es
.
Different kinds of satellites use different frequency bands.
• L–Band: 1 to 2 GHz, used by MSS
• S-Band: 2 to 4 GHz, used by MSS, NASA, deep space research
• C-Band: 4 to 8 GHz, used by FSS
• X-Band: 8 to 12.5 GHz, used by FSS and in terrestrial imaging
• Ku-Band: 12.5 to 18 GHz: used by FSS and BSS (DBS)
• K-Band: 18 to 26.5 GHz: used by FSS and BSS
• Ka-Band: 26.5 to 40 GHz: used by FSS
ed
u.
np
Instrumentation II
D
ow
nl
oa
de
d
fro
m
io
en
5.2.3 Bluetooth Devices
Bluetooth
• Bluetooth is a global standard Radio Frequency (RF) specification for short-range, pointto-multipoint voice and data transfer. Bluetooth can transmit through solid, non-metal
objects. Its nominal link range is from 10 cm to 10 m, but can be extended to 100 m by
increasing the transmit power. It is based on a low-cost, short-range radio link, and
facilitates ad hoc connections for stationary and mobile communication environments.
• A standard for wireless electronics communication “Open Wireless”.
• It provides agreement at the physical level -- Bluetooth is a radio-frequency standard.
• It also provides agreement at the next level up, where products have to agree on when
bits are sent, how many will be sent at a time and how the parties in a conversation can be
sure that the message received is the same as the message sent.
• Bluetooth communicates on a frequency of 2.45 gigahertz, which has been set aside by
international agreement for the use of industrial, scientific and medical devices (ISM).
• Bluetooth devices avoid interfering with other systems:
• Very weak signals of 1 mill watt. (Average cell phones can transmit a signal of 3 watts.)
• Range of a Bluetooth device to about 10 meters.
• Bluetooth uses a technique called spread-spectrum frequency hopping.
• In this technique, a device will use 79 individual, randomly chosen frequencies within a
designated range, changing from one to another on a regular basis. In the case of
Bluetooth, the transmitters change frequencies 1,600 times every second
• Bluetooth systems create a personal-area network (PAN), or piconet,
• There is frequency hopping with once the piconet is established.
• Many piconets are possible in the same room.
• Half-duplex communication or full-duplex communication.
• Bluetooth can send data at more than 64 kilobits per second (Kbps) in a full-duplex link - a rate high enough to support several human voice conversations.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
9
Instrumentation II
•
Chapter 5: Data Acquisition and Transmission
Half-duplex link -- connecting to a computer printer, for example -- Bluetooth can
transmit up to 721 kilobits per second (Kbps) in one direction, with 57.6 Kbps in the
other. If the use calls for the same speed in both directions, a link with 432.6-Kbps
capacity in each direction can be made.
io
en
ot
es
.
ed
u.
np
Bluetooth Connection
de
d
fro
m
Bluetooth uses the concept of Master/Slave mode of data communication which is packet based.
1. Passive State
2. Inquiry; Search of devices
3. Paging; Synchronization
4. Access Point Service Discovery; Wireless link
5. Channel Creation
6. Pairing; Optional (require pin code)
D
ow
nl
oa
Bluetooth Characteristics
Bluetooth characteristics:

Operates in the 2.4 GHz Industrial-Scientific-Medical (ISM) band.

Uses Frequency Hop (FH) spread spectrum, which divides the frequency band into a
number of hop channels. During a connection, radio transceivers hop from one channel
to another in a pseudo-random fashion.

Supports up to 8 devices in a piconet (two or more Bluetooth units sharing a channel).

Built-in security.

Non line-of-sight transmission through walls and briefcases.

Omni-directional.

Supports both isochronous and asynchronous services; easy integration of TCP/IP for
networking.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
10
Instrumentation II

Chapter 5: Data Acquisition and Transmission
Regulated by governments worldwide.
io
en
ot
es
.
ed
u.
np
Bluetooth Network Topology
1. Piconet
• A maximum of 8 devices (7 active slaves plus 1 master) form a Piconet
• A piconet is characterized by the master: frequency hopping scheme, access code,
timing synchronization, bit rate allocated to each slave
• Only one master: dynamically selected, roles can be switched
• Up to 7 active slaves; up to 255 parked slaves
• No central network structure: “Ad-hoc” network
D
ow
nl
oa
de
d
fro
m
2. Scatternet
• Interconnected piconets, one master per piconet
• A few devices shared between piconets
• No central network structure: “Ad-hoc” network
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
11
Instrumentation II
Chapter 5: Data Acquisition and Transmission
•
•
fro
nl
•
d
•
de
•
Radio layer: defines the requirements for a Bluetooth transceiver operating in the 2.4
GHz ISM band
Baseband layer: describes the specification of the Bluetooth Link Controller (LC) which
carries out the baseband protocols and other low-level link routines
Link Manager Protocol (LMP): is used by the Link Managers (on either side) for link setup and control
Host Controller Interface (HCI): provides a command interface to the Baseband Link
Controller and Link Manager, and access to hardware status and control registers
Logical Link Control and Adaptation Protocol (L2CAP): supports higher level protocol
multiplexing, packet segmentation and reassembly, and the conveying of quality of
service information
RFCOMM protocol: provides emulation of serial ports over the L2CAP protocol. The
protocol is based on the ETSI standard TS 07.10
Service Discovery Protocol (SDP): provides a means for applications to discover which
services are provided or available.
oa
•
m
io
en
ot
es
.
ed
u.
np
Bluetooth Protocol Stack
D
ow
•
How will Bluetooth communicate with other hardware?
• USB
o USB 2.0 compliant. The module is a USB full-speed class device (12 Mbps) and
has the full functionality of a USB slave.
• UART
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
12
Instrumentation II
o Signals supported are Rx, Tx, RTS and CTS. The module is DCE, Data Circuitterminal Equipment. The maximum UART speed is 460.8 kbps
PCM
o The PCM data can be: Linear PCM 13-16 bit, μ-law 8 bit, A-law 8 bit. The PCM
sync is 8 kHz and the PCM clock 200 kHz – 2 MHz.
ed
u.
np
•
Chapter 5: Data Acquisition and Transmission
What could be done with Bluetooth?
• Wireless package handling
• Secure and instant credit transactions
• Phones headsets computers networks
• Security-selective access
• Anywhere a wire is currently run
de
d
fro
m
io
en
ot
es
.
Bluetooth Applications
• Bluetooth profiles were written to make sure that the application level works the same
way across different manufacturers' products
• Bluetooth applications:
 Wireless control of and communication between a cell phone and a hands free
headset or car kit.
 Wireless networking between PCs in a confined space and where little bandwidth
is required
 Wireless communications with PC input devices such as mice and keyboards
 Wireless communications to PC output devices such as printers
 Built-in in modern laptops or dongles
 Wireless communications with PC input devices such as mice and keyboards
 Wireless communications to PC output devices such as printers
 Transfer of files between devices via OBEX
 Replacement of traditional wired serial communications in test equipment, GPS
receivers and medical equipment
 Thus often a serial interface is emulated over the BT link as shown on the
following slides ...
 Remote controls where infrared was traditionally used
D
ow
nl
oa
Advantages
 Uses low power
 Can connect various type of devices
 Free of cost
 Ad Hoc hardware can be established by Bluetooth connection
 Simple, Secure and Global data transfer
 Less time consumption
Disadvantages
 Large data transmission is difficult
 Bluejack is not possible (Bluejacking problem)
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
13
Instrumentation II
Chapter 5: Data Acquisition and Transmission
io
en
ot
es
.
ed
u.
np
5.3 Data Acquisition System
A data acquisition system consists of many components that are integrated to:
• Sense physical variables (use of transducers)
• Condition the electrical signal to make it readable by an A/D board
• Convert the signal into a digital format acceptable by a computer
• Process, analyse, store, and display the acquired data with the help of software
Description
Data acquisition
hardware
At the heart of any data acquisition system lies the data acquisition
hardware. The main function of this hardware is to convert analog signals to
digital signals, and to convert digital signals to analog signals.
Sensors and
actuators
(transducers)
Sensors and actuators can both be transducers. A transducer is a device that
converts input energy of one form into output energy of another form. For
example, a microphone is a sensor that converts sound energy (in the form
of pressure) into electrical energy, while a loudspeaker is an actuator that
converts electrical energy into sound energy.
fro
d
de
Sensor signals are often incompatible with data acquisition hardware. To
overcome this incompatibility, the signal must be conditioned. For example,
you might need to condition an input signal by amplifying it or by removing
unwanted frequency components. Output signals might need conditioning as
well. However, only input signals conditioning is discussed in this chapter.
nl
oa
Signal
conditioning
hardware
m
Components
The computer provides a processor, a system clock, a bus to transfer data,
and memory and disk space to store data.
Software
Data acquisition software allows you to exchange information between the
computer and the hardware. For example, typical software allows you to
configure the sampling rate of your board, and acquire a predefined amount
of data.
D
ow
Computer
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
14
Instrumentation II
Chapter 5: Data Acquisition and Transmission
ed
u.
np
5.3.1 Data Loggers
• Data logger automatically makes a record of the readings of instruments located at
different parts of plant.
• Data logger measures and record data effortlessly as quickly, as often, and as accurately
as desired.
• These devices measure electrical output from transducer, give plant performance
computation, logic analysis of alarm conditions, passes information (reading) to computer
for further processing etc.
• So they are used in power generation plant, petro-chemical installations, real time
processing plants etc.
ot
es
.
Characteristics of Data Logger
a) Modularity
b) Reliability and Raggedness
c) Accuracy
d) Management Tool
e) Easy to Use
D
ow
nl
oa
de
d
fro
Basic Operation of Data Logger
m
io
en
Application of Data Logger
a) Weather station recording e.g. wind speed, wind direction, temperature, relative humidity
b) Hydrographic recording e.g. water level, depth, water flow PH, conductivity
c) Soil moisture level
d) Gas pressure
e) Environmental Monitoring
1) Input Signals
• May be
o Pressure, transducers
o Thermocouple
o AC signal
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
15
Instrumentation II
D
ow
ed
u.
np
nl
5)
oa
de
4)
d
fro
m
io
en
3)
o Signals from relay, switch
o Tachometer pulses etc.
Input Scanner
• It is an automatic sequence switch which selects each signal in turn. Modern
scanner have input scanner which can scan at a rate of 150 inputs per second.
Characteristics of input scanner may be:
o Low closed resistance
o High open circuit resistance
o Low contact potential
o Negligible interaction between switch, enter going signal and input signal
o Short operating time
o Negligible contact bounce
o Long operation life
Signal Amplifier & Conditioner
• Amplifier for gain adjustment i.e. low level signal amplified up to 5v output.
Characteristics are:
o Precise and stable DC gain
o High SNR
o High CMMR
o Low DC drift
o Low output impedance
o High input impedance
o Good linearity
o Wide bandwidth
• Conditioner for scaling linear transducer or correcting curvature of non linear
transducer i.e. signal is changed to more linear from and suitable for digital
analysis. Characteristics are:
o Linear scale
o Correcting the curvature of non linear transducer
o It may include sample and hold circuit
A/D Converter
• Converts analog sample into digital data. Characteristics are:
o Resolution
o Accuracy
o Conversion time
o Full scale output voltage
o Linearity
Recorder
• Output from data logger may be recorded in any of following:
o Typewriter, strip printer, digital tape recorder, punched tape, computer
(hard drive), magnetic tape etc.
• Characteristics are:
o Speed
o Memory
o Writing technique (Serial / Parallel)
ot
es
.
2)
Chapter 5: Data Acquisition and Transmission
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
16
Instrumentation II
Chapter 5: Data Acquisition and Transmission
ot
es
.
ed
u.
np
6) Programmer
• Control all units of data conversion and operation
• Microcontroller or microprocessor based system
• Basic units: main frames, front panel assembly, power supply unit, scanner
controller, input interface etc.
• Operation performed by programmer:
o Set amplifier
o Set linearity factor
o Set high and low alarm value
o Start A/D conversion
o Record reading channel
o Identify channel and time of recording
o Display recording
o Reset logger
D
ow
nl
oa
de
d
fro
m
io
en
Compact Data Logger
• A typical data logger unit provides 60 channels of data in a 20x40x60 cm box weighing
about 20 Kg. Most manufacturers offer local or remote add-on scanners to expand about
100 channels.
• Scan rates are modest (1-20) channels per second
• The signal processing capability is limited to simple functions such as (mx+b) scaling
time averaging of single channels, group averaging of several channels and alarm
signalling when preset limits are exceeded.
• Most units do allow interfacing to computers where versatile processing is possible
• This class of data logger utilise a built in microprocessor to control the interval of
operation and carryout calculations through a single amplifier – A/D converter, which is
automatically ranged in gain switched under program control.
• Multiplexers are available in both general purpose (two wire) and low level (two original
wire plus shield) versions.
• Millivolt level signals, such as from thermocouples, generally use a shielded, twisted pair
of conductors.
• Electro-mechanical read switches are used frequently in such scanners since speed
requirements are modest but low noise is important.
• Since thermocouples are very common in data logger applications, reference function
compensation and linearization options are always available.
• The microprocessor also stores the equation which curve-fit the thermocouple table for
each.
• The system amplifier and A/D converter is the crucial element for several system
accuracy.
• The microprocessor sets the amplifier gains at a proper value as each channel is sampled.
• The A/D converter are often of dual slope type or voltage to frequency converter type as
the speed is modest with noise rejections
• Readout obtained by means of a built in digital indicator and two colour printers whose
format is selected by front panel programming..
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
17
Chapter 5: Data Acquisition and Transmission
io
en
ot
es
.
ed
u.
np
Instrumentation II
oa
de
d
fro
m
5.3.2 Data Archiving and Storage
Data Archiving
• Data archiving is the process of moving data that is no longer actively used to a separate
data storage device for long-term retention, but can be readily accessed if required. Data
archives consist of older data that is still important and necessary for future reference, as
well as data that must be retained for regulatory compliance. Referential integrity should
be maintained.
• Data archives are indexed and have search capabilities so that files and parts of files can
be easily located and retrieved.
• Data archives are often confused with data backups, which are copies of data. Data
backups are used to restore data in case it is corrupted or destroyed. In contrast, data
archives protect older information that is not needed for everyday operations but may
occasionally need to be accessed.
D
ow
nl
Data Storage
Storage Factors:
• Speed with which data can be accessed
• Cost per unit of data
• Reliability
o data loss on power failure or system crash
o physical failure of the storage device
Can differentiate storage into:
o volatile storage: loses contents when power is switched off
o non-volatile storage:
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
18
Instrumentation II
Chapter 5: Data Acquisition and Transmission


ot
es
.
ed
u.
np
Contents persist even when power is switched off.
Includes secondary and tertiary storage, as well as batter-backed up mainmemory.
Physical Storage Types:
• Primary storage: Fastest media but volatile (cache, main memory – RAM and ROM).
• Secondary storage: Non-volatile, moderately fast access time
o also called on-line storage
o E.g. flash memory, magnetic disks
• Tertiary storage: Non-volatile, slow access time which involves a robotic mechanism
that will mount and dismount removable mass storage media into a storage device
according to the system demands.
o also called off-line storage
o E.g. Tape libraries, optical jukebox etc.
fro
m
io
en
Data Compression
• Process of encoding information using fewer bits than an un-encoded representation
would use, through specific encoding schemes.
• Reduce consumption of expensive resources such as hard drive and transmission
bandwidth.
• Trade-off between compression speed, compressed data size and quality (loss)
Types:
Lossy
Lossless
For the case if loss of fidelity is acceptable
Exploit statistical redundancy in such a
e.g. 6.666666 = 7
way to represent data without error
e.g. 6.666666 = 6[6]6
Examples: Pictures (JPEG), Video (MPEG),
Examples: zip, rar, Picture (PNG, TIFF),
Audio (MP3) etc.
Video (Huff, YUV, AVI) etc.
D
ow
nl
oa
de
d
RAID: Redundant Arrays of Independent Disks
It is the way of storing the data in disk organization techniques that manage a large numbers of
disks, providing a view of a single disk of
o high capacity and high speed by using multiple disks in parallel, and
o high reliability by storing data redundantly, so that data can be recovered even if
a disk fails
• RAID Level 0: Block striping; non-redundant.
• RAID Level 1: Mirrored disks with block striping
• RAID Level 2: Stripes data at the bit level, and uses code for error correction.
• RAID Level 3: Bit-Interleaved Parity
o a single parity bit is enough for error correction, not just detection, since we
know which disk has failed
• RAID Level 4: Block-Interleaved Parity; uses block-level striping, and keeps a parity
block on a separate disk for corresponding blocks from N other disks.
• RAID Level 5: Block-Interleaved Distributed Parity; partitions data and parity among
all N + 1 disks, rather than storing data in N disks and parity in 1 disk.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
References: R. Gaonkar & D.V. Hall |
19
Instrumentation II
Chapter 6: Grounding and Shielding
Chapter – 6
Grounding and Shielding



Outline for Grounding and Shielding Design
Step 1: Understand the safety and noise issues for a product.
Step 2: Know the possible mechanisms of energy coupling.
Step 3: Define the necessary grounds and shields.
ot
es
.
6.1
ed
u.
np
Grounding and Shielding
 Grounds & Shields improve safety and reduce interference from noise.
 Properly connected grounds reduce dangerous voltage differentials between instruments.
 Shields minimize interference from noise by reducing noise emission and noise
susceptibility.
io
en
Safety
 Reduce the voltage differentials between external conductor surfaces.
 Usually the design is – conducted energy, low frequency (less than 1 MHz) and
associated with power lines.
 Microwave energy is not a shock hazard but it does pose danger and demands especial
attention to shielding.
de
d
fro
m
Safety Ground
 Provides a path for the dangerous leakage currents and short circuits.
 Properly connected safety ground reduces voltage differential between external surfaces.
 Safety ground must be a permanent, continuous, low impedance conductor with adequate
capacity that runs from the power source to load.
 Don’t rely on a metallic conduct to form the conductive path for the safety ground,
corrosion and breaks can open the circuit.
 Don’t rely on building steel either because circulating currents can generate large and
noisy ground potentials.
 A separate dedicated conductor will avoid these problems.
nl
oa
Three things to remember when to develop wiring for powering instruments:
 Consider the instrument and power mains as an integrated system.
 Always draw your ground scheme to understand the possible circuit paths.
 Don’t blindly rely on building steel for a ground conductor.
6.2
D
ow
•
Noise, Noise (Energy) Coupling Mechanism and Prevention
Noise is unwanted electrical activity coupled from one circuit into another.
– 3 components: A source, A coupling mechanism, and A receiver
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
1
Chapter 6: Grounding and Shielding
Fig: Block diagram of noise disrupting a circuit
ed
u.
np
Instrumentation II
ot
es
.
Noise Sources
 Noise sources generate either a periodic signal or transient pulse that disrupts other
circuits.
 There are many types of sources: Power lines, Motors, High voltage equipment (e.g.
spark plug, igniter), Dischargers and sparks (e.g. lightning, static electricity), High
current equipment (e.g. arc welder)
io
en
Energy Coupling Mechanism
 Four mechanisms: Conductive, inductive, capacitive & electromagnetic
Frequency Range
Comment
Conductive
DC to 10 MHz
Requires a complete circuit loop (really no upper
limit to frequency)
Inductive
Usually > 3KHz
Capacitive
Usually > 1 KHz
de
d
fro
m
Coupling
Mechanism
Greater spacing between conductors reduces
coupling associated with high voltage (can get
significant coupling from 50 Hz-60 Hz power).
Needs antenna s greater than 1/20 of wave length
in both the source and susceptible circuit.
Conductive coupling  low frequencies, caused by incorrect grounding.
Capacitive & inductive coupling  dominate at high frequencies
o Changing magnetic flux can couple circuits.
o The loop area of the circuit is the primary factor that determines the inductance
and coupling.
o Changing electric potentials can drive charge through stray capacitances.
o Appropriate grounding, shielding and signal separation control the amount of
capacitive coupling.
D
ow
nl


Usually > 15 MHz
oa
Electromagnetic
Larger loop area in circuit means greater self
inductance and mutual inductance associated with
heavy current (can get significant coupling from
50 Hz-60 Hz power).
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
2
Chapter 6: Grounding and Shielding
fro
Electromagnetic coupling is a high frequency phenomenon.
It requires a transmitting antenna in the source and a receiving antenna in the susceptible
circuit. These antennas must be in appropriate fraction of the signal wavelength to couple
effectively.
nl
oa
de
d


m
io
en
ot
es
.
ed
u.
np
Instrumentation II
D
ow
Susceptible Circuit
• Third component of noise is susceptible circuit.
• E.g. susceptibility includes cross talk on inputs that leads to bit flips in digital logic, radio
interference and static discharge that destroy components.
• Susceptibility usually can be traced by proper grounding (or return paths) or long signal
lines that are not properly shielded.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
3
Instrumentation II
Chapter 6: Grounding and Shielding
Principle of Energy Coupling
• Current will flow in the path with low impedance, not necessarily lowest resistance.
• Consequently, charge follows the path of minimum inductive and maximum capacitive
reactance for the lowest impedance.
io
en
•
•
ed
u.
np
•
ot
es
.
•
Z  ( R 2  [WL  (1 / WC )]2 )
Where, Z = Impedance, R = Resistance, WL = Inductive reactance & 1/WC = Capacitive
reactance
For frequencies above 3 KHz, a useful diagnostic for determining the mechanism is the
ratio of rate of change in voltage to the rate of change in current.
For the special cases of sinusoidal signals or resistive loads, the ratio is impedance;
otherwise, it is a pseudo impedance value.
A Diagnostic ratio called Pseudo Impedance.
Pseudo Impedance is defined as: γ = (dv/dt)/(di/dt)
o If γ = 377, @ high frequencies (> 20MHz)  Electromagnetic coupling.
o If γ < 377, the value of di/dt > dv/dt i.e. large change in current  inductive
coupling.
o If γ > 377, the value of dv/dt > di/dt i.e. large change in voltage  capacitive
coupling.
oa
de
d
fro
m
Conductive Coupling
• Requires a connection between source and receiver that completes a continuous circuit.
• Conductive coupling usually occurs at lower frequencies and is often caused by incorrect
grounding.
nl
Fig: Conductive coupling. If either connection A or B is removed, the conductive noise is
eliminated.
D
ow
•
•
•
Such connections are inadvertent and difficult to find; such connections are called Sneak
circuits.
A ground loop is a complete circuit that allows unwanted current to flow into the ground.
Substantial current in a ground path (as opposed to a return path) can produce voltage
differences across the ground resistance and raise the ground potential at the loads.
Conversely, significant potentials in the ground can force unwanted current to flow
between circuits.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
4
Instrumentation II
The use of high frequency and reduction of ground loop can reduce conductive coupling
or conductive noise.
io
en
ot
es
.
ed
u.
np
•
Chapter 6: Grounding and Shielding
fro
m
Inductive Coupling
• An Inductive coupling mechanism requires a current loop that generates changing
magnetic flux.
• Generally, a current transient creates the changing magnetic flux, as follows:
 = BA =  0 nIA
Then,
d
d
dB
di
 A( )  A 0 n( )
dt
dt
dt
Where,  = Magnetic Flux
de
v
ow
nl
oa
B = Magnetic field
A = Loop area
 0 = Permeability of free space
n = Number of turns in the loop
i = Current
v = Voltage
D
•
•
•
•
The induced voltage in a magnetically coupled circuit is proportional to the time rate of
change of current and loop area.
Reducing the loop area will reduce the inductive reactance of a circuit.
For frequencies above 3 MHz, (dv/dt) / (di/dt) << 377Ω
Generally, the load impedance is large, while the source impedance is small.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
5
Chapter 6: Grounding and Shielding
Current follows the path of lowest impedance, not necessarily lowest resistance.
Therefore, current will follow the path of minimum inductive reactance; this means the
current will minimize loop area in a circuit.
A slot in the ground plane of a circuit board will increase the loop area of a circuit; below
figure shows this; so avoid such slots.
D
ow
nl
oa
•
de
d
•
fro
m
io
en
ot
es
.
ed
u.
np
Instrumentation II
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
6
Chapter 6: Grounding and Shielding
The long, straight wires encompass significant loop area that provides an inductive
reactance. Twisting the pairs of signal and return lines together eliminates the loop area
and the mutual inductive coupling between circuits.
D
ow
nl
oa
de
d
fro
m
io
en
•
ot
es
.
ed
u.
np
Instrumentation II
Capacitive Coupling
• Capacitive coupling mechanism requires both proximity between circuits and a changing
voltage.
• It occurs when two conductors are placed at some distance apart and voltage level and
frequency are changed.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
7
Instrumentation II
•
•
Capacitive coupling of noise becomes a factor for frequency above 1 KHz
Generally, the total circuit impedance is high; i.e. both the source and load impedance are
large.
(dv/dt) / (di/dt) >> 377Ω
Capacitive coupling can be reduced by separation of conductors and appropriate
shielding.
de
d
fro
m
io
en
ot
es
.
ed
u.
np
•
•
Chapter 6: Grounding and Shielding
D
ow
nl
oa
Electromagnetic Coupling
• Electromagnetic coupling or radiative coupling becomes a factor only when the
frequency of operation exceeds 20 MHz.
• f < 200 MHz, cables are primary sources and receivers for electromagnetic coupling.
• f > 200 MHz, PCB traces begin to radiate & couple energy.
• Generally, the length of conductor must be longer than 5% of the bandwidth i.e. l > ʎ/20.
• Pseudo impedance factor between 100Ω and 500Ω.
(dv/dt) / (di/dt) = 377Ω
• The frequency of signal must be reduced.
• Use magnetic plate shielding.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
8
Instrumentation II
Chapter 6: Grounding and Shielding
Often designers use the return conductors as a signal reference.
D
ow
nl
oa
•
de
d
fro
m
io
en
ot
es
.
ed
u.
np
6.3 Single Point Grounding and Ground Loop
Grounding
• Grounding provides safety and signal reference
• General principle is to minimize the voltage differential between your instrument and a
reference point i.e. ∆V = 0 between instruments.
• Use the return conductors as a signal reference.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
9
Chapter 6: Grounding and Shielding
d
fro
m
io
en
ot
es
.
ed
u.
np
Instrumentation II
oa
de
Safety Grounding
• Seeks to reduce the voltage differentials between exposed conducting surfaces.
• Should have many connections between the exposed conducting surfaces.
D
ow
nl
Signal Referencing
• Seeks to reduce the voltage differentials between reference points.
• Should have one connection between reference points at low frequency.
• In either case, ground is not the return path for a signal. Both safety and signal grounds
nominally conducts current.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
10
Chapter 6: Grounding and Shielding
ed
u.
np
Instrumentation II
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
Single Point Grounding
• The separate ground conductors isolate the noise in the return paths of the separate
circuits because the single point reference connection does not complete any ground
loops between circuits.
• Most appropriate low-current, low-frequency (< 1 MHz) applications.
• The ground conductor should be a short strap to reduce high-frequency noise and unsafe
voltages.
Disadvantages
• Conductors longer than 5m (16 ft) are susceptible to high-frequency ground noise. (A
braided cable may reduce impedance at high frequencies by increasing the skin effect;
that is, current tends to flow along the surface, and braided cable has a large surface
area).
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
11
Instrumentation II
•
Conductors longer than 30m (100 ft) or those conducting high fault currents are
unsafe. The inherent impedance of the conductor will cause large potential
differences exist between the instrument and ground.
ADC is one application that needs a single point ground for signal referencing
separate references can generate noisy ground loops.
de
d
fro
m
io
en
ot
es
.
ed
u.
np
•
Chapter 6: Grounding and Shielding
D
ow
nl
oa
Ground Plane or Grid
• A ground plane within a circuit board is better for high frequency (> 100 KHz) operation.
• Likewise, a ground grid is better for high frequency or high fault currents, because it has
lower impedance than a single cable.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
12
Chapter 6: Grounding and Shielding
ot
es
.
ed
u.
np
Instrumentation II
nl
oa
de
d
fro
m
io
en
Ground Loop
• A ground loop is a complete circuit that comprises a signal path and part of the ground
structure.
• It arises whenever multiple connections to ground are physically separated.
• External currents in the ground structure generate potential differences between the
ground connections and introduce noise in the signal circuit.
ow
•
D
•
•
Generally, the problem arises at low frequencies (< 10 MHz); high frequencies follow the
path of minimum impedance that can avoid higher impedance ground loops.
Ground loops are a particular problem in systems that have low level signal circuits and
multipoint grounds separated by large distances.
Either circuit balance or signal isolation can eliminate noise from ground loops.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
13
Chapter 6: Grounding and Shielding
For safety, coordinate the routing of power and signal to reduce noise introduces by the
ground structure.
D
ow
nl
oa
de
•
d
fro
m
io
en
ot
es
.
ed
u.
np
Instrumentation II
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
14
Chapter 6: Grounding and Shielding
io
en
ot
es
.
ed
u.
np
Instrumentation II
D
ow
nl
oa
de
d
fro
m
6.4 Filtering and Smoothing
Filtering
• Only filtering reduces conductive noise coupling.
• A filter can either block or pass energy by three criteria.
a) Frequency
 LPF passes low frequency energy and rejects high frequency energy
 HPF passes high frequency energy and rejects low frequency energy
b) Mode (Common or Differential)
 Common-mode noise injects current in the same direction in both the
signal and return lines. Filter diverts common mode noise current to
ground.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
15
Differential-mode noise injects current in opposite directions in the signal
and return lines. Filter blocks common mode currents while passing
differential mode current.
de
d
fro
m
io
en
ot
es
.

Chapter 6: Grounding and Shielding
ed
u.
np
Instrumentation II
D
ow
nl
•
oa
•
c) Amplitude (Surge suppression)
 Amplitude selective filters reduce large transients or spikes e.g. surge
suppressors.
Time-average filter  Implemented in software, reduce the effect of noise on data within
a signal.
Time-synchronous filter  Stop running at periodic disturbance e.g. periodic switching
in power supply.
Minimize Bandwidth
• A low-pass filter reduces high frequency emissions and susceptibility for signal
applications.
• Filtering input signals may improve the noise immunity of the circuit.
• Sharp edges on pulses will have large Fourier coefficient. Slowing the rise and fall times
of pulse edge will reduce the bandwidth of signals.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
16
Chapter 6: Grounding and Shielding
Filtering clock signal to reduce the high-frequency harmonics is one area where we may
significantly reduce noise interference. But be careful not to violate the minimum skew
rate required by the logic circuits.
D
ow
nl
oa
de
d
fro
m
io
en
•
ot
es
.
ed
u.
np
Instrumentation II
6.5 Decoupling Capacitors and Ferrite Beads
Ferrite Beads
• Ferrite beads provide one form of filtering based on frequency.
• A ferrite bead is a magnetically permeable sleeve that fits around a wire. It presents
inductive impedance to signals that attenuates high frequencies.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
17
Instrumentation II
•
•
io
en
ot
es
.
•
•
Ferrite beads are best suited to filter low level signals and low current power feeds to
circuit board.
A ferrite bead is a passive electric component used to suppress high frequency noise in
electronic circuits.
It is a specific type of electronic choke. Ferrite beads employ the mechanism of high
dissipation of high frequency currents in a ferrite to build high frequency noise
suppression devices.
The ferrite bead is effectively an inductor with a very small Q factor.
For a simple ferrite ring, the wire is simply wrapped around the core through the center
typically 5 or 7 times. Clamp-on cores are also available, which can be attached without
wrapping the wire at all.
ed
u.
np
•
Chapter 6: Grounding and Shielding
oa
de
d
fro
m
Decoupling and Bypass Capacitors
• They provide Filtering based on frequency
• They filter and smooth out the spikes in DC power of ICs
• During a logic transition, a momentary short circuit from power to return in a digital
device demands a large current transient. A decoupling capacitor can supply the
momentary pulse of current and effectively decouple the switching spike from the power
supply.
• They reduce the impedance of power supply circuit.
• Inductance in the power supply attenuates the effect of switching current transients by
producing large voltage spikes.
• Decoupling capacitor provides this demand for shorter time.
• Mitigate the effect of inductance by reducing effective loop area between Power supply
and the ICs.
nl
Z 0  ( R 2  [WL  (1 / WC )]2 )
Reduce impedance of power supply
If you arbitrarily make the decoupling capacitor too large, you will move the resonance
frequency of the supply inductance and decoupling capacitor down into the range of
operation of your circuit and cause excessive ringing in the supply.
Also, large capacitors have larger parasitic inductances than smaller decoupling
capacitors.
D
ow
•
•
•
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
18
Chapter 6: Grounding and Shielding
m
io
en
ot
es
.
ed
u.
np
Instrumentation II
D
ow
nl
oa
de
d
fro
6.6 Line Filters, Isolators and Transient Suppressors
Line filters and Isolators  Mode basis
Transient Suppressor  Amplitude basis
 Common mode filters for AC power lines diverts noise to ground, but beware of
polluting the signal reference ground with noise.
 An optoisolator can eliminate common mode noise by interrupting the conductive path.
 A differential mode filter has to separate noise from signal by criteria other than current
direction; a low pass filter is an example of differential mode filter that uses frequency as
the selection criterion.
 Transient  Machinery switching on or off produces transients through inductive “kick”.
The opening or closing of switches changes the load current instantaneously and
generates a sizable voltage across the line inductance that affects the other loads.
 Transient protection can take one of four approaches: filter, crowbar (thyrister), arching
discharge, or voltage clamp (zener diode or metal-oxide varister i.e. MOV).
1. Filter: It removes the high frequency components of the energy associated with
the sharp edge of a spike. Consequently, the peak of the spike is flattened.
2. Crowbar (thyristor): It detects an over voltage and short circuit current until the
input voltage is cycled off and on again.
3. Arching discharge: It occurs across gap into a gas tube. The initial breakdown of
the gas requires a fairly high voltage; but once the arc is established, the holding
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
19
Instrumentation II
Chapter 6: Grounding and Shielding
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
voltage is much lower. It is used in telephone circuits to suppress surge caused by
lightning.
4. Voltage clamp (Zener): It shorts the excess energy to prevent an overvoltage
condition. Fast, more cost, low current capacity than MOV (Metal oxide varister).
D
ow
nl
6.7 Different kinds of Shielding Mechanism
Shielding
• Shielding either prevents noise energy from coupling between circuits or suppresses it.
o Magnetic flux – inductive shielding
o Electric field – capacitive shielding
o Electromagnetic wave propagation – electromagnetic shielding
Inductive Shielding
• It is concerned with Self-inductance and Mutual inductance.
• It reduces noise coupling by reducing or rerouting magnetic flux.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
20
Instrumentation II
•
•
ow
nl
•
oa
de
d
fro
m
io
en
ot
es
.
•
The most effective inductive shielding minimizes loop area, separating circuits and
reducing the change in current help, while metal or magnetically permeable enclosures
place a distant third in usefulness.
Magnetic noise depends on loop area and current in the emitting and receiving circuits.
Coaxial cable has minimal loop area and may be preferable for high frequencies (>
1MHz) because it provides both capacitive shielding and controlled impedance.
Always pair signals with return, otherwise, we will not gain any inductive shielding.
ed
u.
np
•
Chapter 6: Grounding and Shielding
D
•
On circuit boards,
o Make sure that the return path is always under the signal conductor to minimize
loop area.
o Avoid slots in ground plane, which increase the loop area of signal path.
Enclosures provide magnetic shielding by allowing eddy currents to reflect or absorb
interference energy. These enclosures are heavy, expensive and frequency dependent, but
sometimes they are only solution.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
21
Instrumentation II
Chapter 6: Grounding and Shielding
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
Capacitive Shielding
• Capacitive shielding reduces noise coupling by reducing or rerouting the electrical charge
in an electric field.
• Capacitive shields shunt to ground charge that is capacitively coupled.
• Capacitive coupling provides a path for the injection of noise charges.
• At low frequencies (< 1 MHz), connect a capacitive shield at one point if the signal
circuit is grounded. Multiple connections can form ground loops.
• Capacitive shielding can be improved by reducing:
o Noise voltage and frequency
o Signal impedance
o Floating metal surfaces
• Conversely, multiple ground connections are necessary for high frequencies (> 1 MHz).
Stray capacitance at the ungrounded end of a shield can complete a ground loop.
• Therefore, we should ground both ends of a long (relative to wavelength) shield.
• A mutual enclosure can be an effective electrostatic shield (transformer), or faraday
shield to prevent capacitive coupling.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
22
Instrumentation II
Chapter 6: Grounding and Shielding
Fig: Shielded enclosure and cable shield
nl
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
Electromagnetic Shielding
• Electromagnetic shielding reduces emissions and reception.
• Emission sources: Lightning, Discharges, Radio and TV transmitters, High-frequency
circuits.
• Electromagnetic Interference (EMI) always begins as conductive (current in wires)
becomes radioactive, and ends as conductive (fields interact with circuitry).
• Several techniques can reduce EMI:
o Reduced bandwidth (longer wavelength)
o Good layout and signal routing
o Shielded enclosures
• As shielded enclosure should ideally be a completely closed conducting surface.
Effective enclosure is one that has watertight metallic seams and openings. Openings
include cooling vents, cable penetration with slots larger than a fraction of a wavelength
(> ʎ/20), push buttons, and monitor screens that can leak electromagnetic radiation.
• Similarly, cable shields must seal completely around each connector.
D
ow
Some Practical Applications
Twisted Pair Cable
• Effective up to 1 MHz, lossy at higher frequencies
• Cheaper and mechanically more flexible
• Single ground connection to both the shield and return line provides best attenuation of
the 50 KHz noise.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
23
Instrumentation II
Chapter 6: Grounding and Shielding
ed
u.
np
Coaxial Cable
• Have low loss and less variance in characteristic impedance from DC to very high
frequencies (> 200 MHz).
• A pigtail connection from the shield to ground presents a loop inductance that increases
impedance with frequency. Thus, high frequencies (> 10 MHz) demand a complete 360o
seal of the shield at both ends.
Ribbon cable
• Ribbon cable is ubiquitous in instrumentation.
• It is suitable for low frequency operation << 1 MHz
• We should pair each signal with a return conductor or use a return plane for low-level
signals or higher frequencies.
ot
es
.
EM leakage through openings of conducting enclosure can be reduced by:
o Seams must be soldered, welded or overlapped
o Penetration such as vents and cables need appropriate filters and shields. A
honeycomb matrix invents, acts as a waveguide to filter electromagnetic radiation.
D
ow
nl
oa
de
d
fro
m
io
en
6.8 Protecting Against Electrostatics Discharge
• Electrostatic discharge (ESD) is a discharge at very high voltage and very low current
that readily damages sensitive electronics.
• ESD can range from hundreds to tens of thousands of volts. Any instrument containing
integrated circuits is susceptible.
• ESD transfers electrical charge in three stages: pickup, storage and discharge.
• Usually mechanical rubbing between dry, insulated materials transfers the charge from
source to storage. Often the storage medium is person, who then unwillingly delivers the
damaging discharge.
• Proximity or physical contact discharges the charge from storage.
• Several conditions including humidity, speed of the activity, and material affect the
charge transfer.
• The discharge waveform of ESD has a fast rise time and short duration. The below figure
illustrates sample waveform for simulating ESD while testing products.
Fig: Discharge waveform at 4 kv
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
24
Instrumentation II
•
Several schemes including grounding, shielding and transient limiters can protect circuits
from ESD.
Input gates are the most susceptible to damage, so we should use surge-limiters on input
lines as shown in below figure.
ESDsensesative
circuit
io
en
ot
es
.
Input
sensors
or
switches
ed
u.
np
•
Chapter 6: Grounding and Shielding
0
de
D
ow
nl
oa
•
d
fro
•
m
•
Fig: Preventing damage by shunting high voltage transients away from circuits with zener
diodes or MOVs
Generally zener diodes and MOVs are used to limit surges. Zener diodes tend to turn on
faster, while MOVs are cheaper and handle large peak current.
For prevention, we need to eliminate the activities and materials that create high static
charge control methods including the following.
o Grounding
o Protective handling
o Protective material
o Humidity
Checklist to make work areas less prone to ESD
o Use a “static-free” workstation, and wear a wrist ground strap
o Discharge static before handling devices
o Keep parts in original container
o Minimize handling of components
o Pickup devices by their bodies, not their leads
o Never slide a semiconductor over any surface
o Use conductive or antistatic containers for storage and transport of components
o Clear all plastic, vinyl, Styrofoam from work area
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
25
Chapter 6: Grounding and Shielding
ot
es
.
ed
u.
np
Instrumentation II
D
ow
nl
oa
de
d
fro
m
io
en
6.9 General Rules for design
• When design and develop product, must include grounding and shielding. Also need to
follow these general guidelines.
– System Characterization
– Standards
– Procedure (good design technique)
System Characterization
• Establish the following
– Grounding options
– Source and load impedance
– Frequency bandwidth
• Determine possible coupling mechanism
• Diagram the topology of circuit paths and reduce the loops
– Ground loops
– Inductive loops in signal and power circuits
Standards
• Undoubtedly encounter regulations and standards whatever market, product will compete
in.
• Have to meet or surpass the limits of emission or susceptibility in both conducted and
radiated environments.
• Regulations types may be commercial or military
Procedure
• Good design techniques for grounding and shielding have a few basic rules:
– Reduce Frequency bandwidth
– Balance currents
– Route signals for self shielding: a return (ground) plane, short traces, decoupling
capacitors
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
26
Instrumentation II
Chapter 6: Grounding and Shielding
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
– Add shielding only when necessary
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
27
Chapter 6: Grounding and Shielding
d
fro
m
io
en
ot
es
.
ed
u.
np
Instrumentation II
D
ow
nl
oa
de
Case Study
• Enclosure Design
• Enclosure Testing
• Option Module Design
• Circuit Suppression Design
• Printed Circuit board Design
• Power Supply Filtering
• System Design
• Acknowledgements
Be important Noted:
• Example 6.5.1, Example 6.5.2, Example 6.8.1.1, Example 6.9.1
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
28
Instrumentation II
Chapter 7: Circuit Design
Chapter – 7
Circuit Design
•
•
m
nl
•
fro
•
•
d
•
Converting requirement into design
Establishing requirement is the most difficult part of the circuit design.
Experience is the best guide for setting requirements
General to specific approach of establishing requirements:
– Start by defining the desired function in broad term
– Redefine the function with operational concerns
– Settle on exact regulations and specification
Setting specifications is one of the most difficult parts of engineering where good
judgment and experience are necessary.
Requirements often change late in the effort and spoil the design
Some principles bound the design problem
– E.g. use of electromagnetic spectrum
Time and effort in design increases as the complexity of the function of system increases
Choice of certain technology and devices are the result of good analysis and may depend
on different factors
– E.g. choice of a microprocessor for a system
– Choice of A/D and D/A converters
Technology drives the requirements. Audio frequency (~KHz)  Discrete components,
wirewrap or PCB. Radio frequency (~MHz)  PCB (transmission line effect).
Microwave frequency (~GHz)  RF design (Geometric structures).
Throughput: The average rate of successful message delivers over a communication
channel.
Knowing region of operation, we can pick option available for circuit design. Right
choice  Part count (↓), board apace (↓), Power (↓), Cost (↓), time to market (↓),
reliability (↑).
de
•
•
•
oa
7.1
io
en
ot
es
.
ed
u.
np
From symbols to substance
ow
•
D
•
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
1
Chapter 7: Circuit Design
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
Instrumentation II
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
2
Instrumentation II
Chapter 7: Circuit Design
ed
u.
np
ASIC (Application Specific Integrated Circuits)
• It is an IC customized for particular use. For an example chips designed solely to run cell
phones.
• Modern ASIC includes  32 bit processor, ROM, RAM etc. Such ASIC are called
System on Chip (SOC).
• Solve signal/data processing problems optimally in terms of high throughput and low
power.
• Low cost but takes longer time to market.
ot
es
.
Standard Cells
• Group of transistors are interconnected structures that provides Boolean logic function or
storage function.
• Simplest cells are direct representatives of adder, mux, flip-flops etc.
io
en
Gate Array
• Analogous to Cu layer of PCB.
• Transistors, standard NAND, NOR gates placed at predefined position and manufactured
in wafer.
• Late manufacture process  joined to logic as desired shorter time to market.
Programmable Logic Array (PLA)
• Implement combinational logic
• Set of programmable AND gates which link to set of programmable OR gates
fro
m
Programmable Logic Device (PLD)
• To build reconfigurable logic circuits
• E.g. ROM  store i/p logic as address; o/p logic  store in ROM
de
d
Programmable Array Logic (PAL)
• Fixed OR with programmable AND
• O/P logic  registered or combinational
oa
Electrically PLD (EPLD) or Complex PLD (CPLD)
• Non volatile configuration memory
• Can implement complex logics
D
ow
nl
Field Programmable Gate Array (FPGA)
• Field  firmware can be modified in field without dissembling device or returning into
manufacturer
• IC designed to configure by customer or designer after manufacture
• Programmable logic components called logic blocks wired together to form complex
logic plus it has analog features  programmable slew rates
• Uses HDL (hardware descriptive language) to implement logic functions.
• Low non-recurrent engineering cost but high unit cost in comparison to ASIC
• Logic blocks plus embedded microprocessor to form complex system on programmable
chips.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
3
Instrumentation II
•
•
•
Software processor  implemented within FPGA logic; highly configurable and flexible
than hardwire processor
Applications: DSP, aerospace, ASIC, prototyping, medical imaging etc.
Short time to market
Flexibility in both hardware and software
Technology
ASIC
Custom processor or DSP
FPGA
Generic logic
Performance/Cost
Very high
Medium
Low-medium
Low-medium
Time to market
Very long
Long
Short
Short
Microprocessors
• Requires other parts to make workable computer.
fro
m
io
en
Selection of microprocessor / Microcomputer
1. Experience
2. Software dependent tools for particular processor
3. Performance: Architecture dependent
4. No. of peripheral function
5. Memory
6. Tools support to determine the appropriate processor
7. Low power consumption
ot
es
.
Microcontrollers
• CPU, I/O devices, program memory, data memory all in single chip
ed
u.
np
•
Chapter 7: Circuit Design
de
d
Performance is determined by
o Throughput
o Resolution
o Address space and available memory
o Language choice, code size, speed
o Predominant types of calculation: integer and floating point
D
ow
nl
oa
No. of peripheral function
o Math coprocessor
o Graphics accelerator
o Interrupt handler
o Data transfer and communication: DMA, small computer system interface(SCSI),
Serial I/O Ports
o Timer
o ADC and DAC
o Power drivers
o Watchdog timing (System reset in case of system unresponsiveness)
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
4
Instrumentation II
Chapter 7: Circuit Design
ed
u.
np
Memory
o Require minimum size of memory
o Always plan for and specify margin in the requirements for future updates and
modifications.
o Size of RAM/ROM Depends on
 Data array
 Stack
 Temporary and permanent variable
 Compiler overhead
 I/O buffer
ot
es
.
Tools support to determine the appropriate processor
o Hardware emulator: Helps to debug both circuits and code
o Software tools: supports development on the selected processor
o Vendor: good support, good reputation, markedly affected development tools
io
en
Power consumption within a processor
• Cooling concerns
• Battery sizing
D
ow
nl
oa
de
d
fro
m
Complexity vs. Right Technology
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
5
Instrumentation II
Chapter 7: Circuit Design
io
en
ot
es
.
ed
u.
np
Design time vs. Complexity
D
ow
nl
oa
de
d
fro
m
7.2
Reliability, fault tolerance
Reliability
• How long the product will last?
• Two factors role in the reliability:o Complexity:- Fewer part better
o Design margin:- We must allow for stressing of components
• Two methods to measure reliability:o Model prediction:- help update estimates of reliability but are limited and
cannot predict every outcome
o Prototype test:- find out many weaknesses and problems but are time
consuming
• Combination of both is mostly used
• Standard methods for modeling use formulas based on practical experience of failure
rates and physical knowledge to relate environmental factors to the reliability of
electronic components.
• The failure rate for a component is a generally a base rate modified by various factors
λ = λb πe πq πa
………………………..(1)
Where, λ = failure rate, λb = base failure rate
πe = environmental factor, πq = quality factor
πa = acceleration factor
• Reliability of a component is a function of failure rate:
R(t) = e-λt
……………………..(2)
Where R(t) = Reliability, λ = failure rate, t = time
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
6
Instrumentation II
•
Chapter 7: Circuit Design
Reliability of a System is a product of all component reliabilities:
n
RSystem =
 Ri
……………………..(3)
i 1
•
•
ed
u.
np
•
Where Rsystem = reliability of the system, Ri = reliability of component
Most failure rates relate acceleration factors (πe, πq, and πa) to temperature, but not its
applications.
We may consider the application and some of the stresses and susceptibility factors might
affect reliability
– Corrosion, Thermal cracks, Electro migration, Secondary diffusion, Ionizing
radiation, Vibration, High voltage breakdown, Ageing
These can drastically alter reliability and still not predicted by standard models.
io
en
ot
es
.
Fault tolerance
• Goes beyond the design and analysis for reliable operation and reduces the possibility of
dysfunction or damage from abnormal stresses and failures.
• Allows a measure of continued operation in the event of problem
• Three distinct area
– Careful design
– Testable function
– Redundant Architecture
de
d
fro
m
Careful Design
• Careful design can avoid many failures from abnormal stresses. Some design
techniques that can reduce the probability of failure:
o Reduce overstress from heat with cooling and low dissipation design.
o Use optoisolation or transformer coupling to stop overvoltage and leakage
current
o Implement ESD protection
o Mount for shock and vibration
o Tie down wires and cables
o Prevent incorrect hookup; Use keyed connector
D
ow
nl
oa
Testable Architecture
• The process of testing and diagnosing failures within a system.
• Two possible configurations of testable architecture:
– Simple Configuration: Provides Probe points / test points for a technician
or instrument to stimulate circuits and record responses. Only the trained
personnel must disassemble the system and remove the circuit for testing.
– Complex Configuration: Dedicated internal circuitry called built in test
(BIT) that tests the system and diagnoses problems without disassembly of
the equipment so adds complexity and reduces reliability. The trade off for
BIT is quicker diagnoses and repair versus higher reliability.
• An appropriate calibration standard is always necessary when you measure a
result.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
7
Instrumentation II
Chapter 7: Circuit Design
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
Redundant Architecture
The most complex and fault tolerant architecture are redundant architectures. They use
multiple copies of circuitry and software to self check between functions. It is justified
only when downtime for repair and maintenance cannot be tolerated.
• Doubly redundant architecture: merely indicates a failure in one of the subsystems;
this allows for quick repair.
• Triply redundant architecture: uses voting between the outputs of three identical
modules to select the correct value. It can have failure and still operate correctly.
• Dissimilar redundancy: compares the output from modules with different software
and hardware to select the correct value. It can survive failure and even indicate
errors in design if one system is coded correctly and the others are not.
7.3
D
•
•
High speed design
We should consider transmission line effect when clock of frequency exceeds 1 MHz in a
circuit or system because the harmonics generated by the edges of the clock and signal
pulses can easily be 20 or 30 times the fundamental.
Two conservative criteria may be used to estimate when transmission line effect begins
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
8
Instrumentation II
– Circuit dimension Vs signal wavelength: If circuit dimension exceed 5% of the
minimum wavelength, then signal path approaches a transmission line i.e. l > λ/20
where, l = length of signal path, λ = maximum wavelength of the signal.
– Rise time Vs propagation delay: If the rise time of a signal is less than 4 times
the propagation delay of the signal path, then the signal path approximates a
transmission line with a characteristic impedance i.e. tr < 4tp where, tr = rise time
of signal, tp = propagation delay of the signal path.
Transmission line problems:- BW, decoupling, ground debounce, crosstalk, impedance
mismatch and timing skew or delay
ed
u.
np
•
Chapter 7: Circuit Design
7.3.1 Bandwidth, Decoupling, ground bounce, cross talk, Impedance matching and timing
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
Bandwidth
• Limiting the bandwidth of the signals within a system is the most effective way to reduce
noise, EMI and problems with transmission lines.
• May limit the bandwidth either by increasing the rise or fall times of the signal edges or
by reducing the clock frequency.
• Selecting the appropriate logic family will set the edge rates and the consequent limit on
transmission line concerns.
• One criterion for selecting logic according to transmission line effects is a ratio less than
4 between the rise time, tr and the propagation delay, tp i.e. (tr/tp <4).
• Slower edge rates allow longer interconnections between circuits.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
9
Instrumentation II
Chapter 7: Circuit Design
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
General recommendation for Decoupling:
• Use decoupling capacitor near each chip for two sided board
• Use a large filter capacitor at the power entry point
• Use a ferrite bead at the power entry point to the circuit board
ed
u.
np
Decoupling
• Switching of digital logic causes transients of current on the voltage supply through
inductive impedance of the circuit
• Decoupling capacitor minimizes inductive loop area thus reducing impedance of power
supply circuit. Shortest possible path for decoupling capacitor is best.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
10
Instrumentation II
Chapter 7: Circuit Design
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
Ground Bounce
• Ground bounce is a voltage surge that couples through the ground leads of a chip into non
switching output and injects glitches onto signal lines.
• Asynchronous signals are more prone to ground bounce.
• Can reduce ground bounce by:
o Reducing loop inductance
o Reducing input gate capacitance
o Choosing logic families that either control the signal transition or have slower fall
times.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
11
Instrumentation II
Chapter 7: Circuit Design
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
Crosstalk
• Coupling electromagnetic energy from an active signal to a passive line
• Coupling mechanism:- capacitive or inductive
• Depends on line spacing, length and characteristic impedance, signal rise times
• To reduce crosstalk:
– Decrease coupling length and characteristic impedance
– Increase rise time of signal
– Better layout and design of circuits
Avoiding Crosstalk
– Don’t run parallel traces for long distances – particularly asynchronous signal
– Increase separation between conductors
– Shield clock lines with ground strips
– Reduce magnetic coupling by reducing the loop area of circuits
– Sandwich signal lines between return planes
– Isolate the clock, chip-select, chip-enable, read and write lines
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
12
Instrumentation II
Chapter 7: Circuit Design
ed
u.
np
Impedance matching
• The reflection coefficient for a signal passing from medium 1 to medium 2 is given by:
τ = (η2 – η1) / (η2 + η1)
Where ηi is the intrinsic impedance of medium i and is given by:
ηi = i / i
Reflection coefficient will be zero when η1 = η2
Impedance matching makes the source and termination impedance equal to the
characteristic impedance of the transmission line so that it will eliminate the reflections
of signals that cause ringing (oscillations), undershoot, and overshoot in the signal pulses.
• Impedance discontinuities occur in two configurations endpoint and stub.
End point discontinuity: - the ends of the transmission line don’t match its characteristic
impedance of the transmission line.
– Add series resistances at the end until the total impedance equals the line
impedance.
– Terminate the other end of the signal line from driver.
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
•
•
Stub discontinuities cause impedance mismatch and signal reflection by connecting multiple
circuits to a single line.
• Each Connection of a stub divides the impedance and splits the power of the signal
• Make them very short, even zero to reduce the effect of stub discontinuities
• Good layout and design
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
13
Chapter 7: Circuit Design
ot
es
.
ed
u.
np
Instrumentation II
D
ow
nl
oa
de
d
fro
m
io
en
Timing
• Clock frequency increases, propagation delays, timing skew, and phase jitter (change in
phase) render logic design useless.
• Clock signal is skewed or arrived at different propagation delays of the clock signal to
different destinations (propagation delay  different clock signal to arrive at different
time).
• Differences in propagation delay of rising and falling edges change the duty cycle of the
signal or shrink/expand it.
• Adequate setup and hold time is required to latch data reliably.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
14
Instrumentation II
Chapter 7: Circuit Design
ed
u.
np
Standard data bus and networks
• Data bus or network is required to communicate with other circuit boards or devices
– Bus Architecture
– Serial communication
– Instrumentation and I/O buses
– Back-plane buses
• Backbone of design
• Represents a significant portion of system architecture
Low power design
• Design practices that reduce power consumption by at least one order of magnitude; in
practice 50% reduction is often acceptable.
• Mobile, TV remote controls ,digital multimeter, video cameras, laptops used low power
for Portability, Isolation, Battery power and low heat dissipation
• Power is function of frequency, load capacitance, and voltage reduction of any of these
reduce power consumption.
Ppower (P) = f * C * V2 where f is the switching frequency, C is the load capacitance, and V
is the DC supply voltage
• Reduce power by reducing
– Supply voltage
– Clock frequency
– Load capacitance
• These seven guidelines in design will minimize power
1. Lower clock frequency
2. Lower supply voltage to digital circuit
3. Shut down unused circuits
4. Sleep mode in case of not used
D
ow
nl
oa
de
d
7.4
fro
m
io
en
ot
es
.
Bus architecture concerns:
• Drive configuration
– Single ended:• uses one trace or signal line for transmitted signal and shares circuit
ground for return signal,
• used for shorter paths:- e.g. on PCBs and RS 232 serial lines
– Differential:• transmits two signals with reversed polarity on two separate lines,
• greater tolerance for noise than single ended as they reject common mode
noise,
• better for long cable
• Terminations
– Multiple outputs of transistors connected in parallel present a considerable
capacitive load and slows the transition time of signal
– Use Scotty diodes which has low series capacitance
• Handshakes
– Synchronous buses shares a common clock signal and asynchronous buses use
handshake signals.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
15
Instrumentation II
Chapter 7: Circuit Design
5. Terminate all unused inputs
6. Avoid slow signal transition
7. Make normal state use the lowest current, for instance LEDs should be off
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
Noise and Error Budgets
• Error 1  Production variation, tolerance of resistors, capacitors
• Error 2  Environmental factors e.g. temperature
• Error 3  Noise within each devise
Types of Noise and error budgets:
1) Johnson or Thermal noise
– Has a flat power spectrum and is “white” Gaussian noise
Vnoise (rms) = 4KTRW
Where, K = the Boltzmann constant = 1.38X10-23 J/K
T = absolute temperature (K)
R = resistance (Ω)
W = bandwidth (Hz)
2) Shot noise
– Is transfer of a quantum of charge and is White and Gaussian noise
Inoise (rms) = 2qIDCW
Where, q = 1.60X10-19 C
IDC = DC current (A)
W = measurement bandwidth (Hz)
3) Flicker or Pink noise
– Flicker, 1/f or “pink” noise varies with frequency
Vnoise (rms) = Vf[0.392 + log10(fhigh/flow)]
Where, Vf = noise at a fixed frequency [V/(Hz)1/2]
fhigh = high frequency corner of bandwidth (Hz)
flow = low frequency corner of bandwidth (Hz)
4) Interference
– Coupling of unwanted energy into a device from outside sources.
Vtotal = (V12+V22+ … +Vn2)1/2
Where, Vtotal = total noise (V)
V1, V2, … , Vn = individual noise components (V)
• Quantization error
SNR = 10 log10 (Vsignal2/Vnoise2)
Where SNR = signal to noise ratio
Vsignal = full scale amplitude of the signal (V)
Vnoise = total noise amplitude of the signal (V)
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
16
Instrumentation II
•
•
•
•
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
•
•
Reset and power failure detection and interface unit
All systems should initialize to a known state whenever power is applied
Reset circuit generates a signal that prevents the generation of unwanted conditions by
the system during power application
Reset signal
– Forces the processor to begin execution from a fixed memory location where code
for initialing system operation is written.
– Sets or clears critical output signals to states that don’t cause undesirable actions
Reset circuit senses voltage level and generate reset signal when the voltage of power
supply goes below the preset values and the reset signal stays active until the voltage of
the power supply exceed the preset value.
E.g. RC network, watchdog timer
Some system may turn on the battery backup after power failure and also inform the
processor through interrupt.
ed
u.
np
7.5
Chapter 7: Circuit Design
D
•
•
•
The simple reset circuit as in figure uses the time constants R, C network to set the
desired duration of the reset signal.
The Schmitt trigger inverter transforms the exponential changing waveform on the input
to a signal transition appropriate for logic gates.
The diode D allows charge to drain off the capacitor if the DC voltage fails, thereby
protecting the inverter from an input voltage higher than its supply voltage.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
17
Instrumentation II
•
Chapter 7: Circuit Design
When pressed, the manual push button shorts the charge on the capacitor to ground to
generate a reset signal so that a user can initialize the operation of the system even while
the supply power is stable.
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
Interface Unit
• The input to all circuit is some sort of electrical signal
• Each signal comes from another circuit, a transducer or a switch.
• Most signals need some preprocessing or conversion before the system can assimilate
them
• E.g. Switch generates logic transitions that bounce when pressed; there is a series of rapid
glitches at the beginning and end of signal pulse.
• It is necessary to design some circuitry to suppress the glitches produced by bounce.
• Also sensors produce continuously changing analog signal that must be converted to
digital logic levels for further processing
• You will need to define the types of inputs that you expect the system will receive
• Once you know the type of input, you can decide on the necessary circuitry to manipulate
the input signals.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
18
Instrumentation II
Chapter 7: Circuit Layout
Chapter – 8
Circuit Layout
•
•
nl
oa
de
d
fro
m
io
en
ot
es
.
•
Circuits Boards and PCBs
Technologies available for connecting components and circuits
Circuit boards combine electronic components and connectors into a functional system
through electrical connections and mechanical support.
Stitch weld, Wire wrap, PCB, Chip on board, Hybrid and MCM
[PCB= Printed Circuit Board, MCM= Multi Chip Module]
ed
u.
np
8.1
D
ow
Wire-Wrap
• Easily change the connections, circuit modifications & corrections.
• Larger circuit boards, require extensive effort
• Less useful for production, suitable for prototype development
• Limited in operation to less than 5 or 10 MHz, above which the loop inductances in the
wired connections distort signals.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
1
Instrumentation II
Chapter 7: Circuit Layout
Single Sided PCB
o Low frequency operation (< 25 KHz)
o Signal cross over wire jumpers are used
ot
es
.
PCB (Printed Circuit Board)
• Etched and plated connections
• Make automated placement and soldering of components possible
• Control impedances more effectively than wire-wrap
• Cost effective, manufacturing edge and reliability
ed
u.
np
Stitch Weld
• Connects components with point-to-point wiring on circuit boards much like wire wrap
• Stitch weld ports are shorter and the wire is welded to the pins, not wrapped, results
lower loop inductance and much higher operation (100 MHz).
• Better vibration and shock resistance, more expensive, requires a special welding station.
io
en
Double Sided PCB
o Signal traces on both sides of the circuit board and plated through vias.
o Can support higher frequency operation if laid out very carefully.
fro
m
Multilayer PCB
o A stack of alternate layers of copper-clad laminate or core and prepreg.
o 20 to 30 conducting layers laminated together
o Control impedance much more tightly and are absolutely necessary for high
frequency circuits
o Through-hole vias penetrate all layers and can connect signals on each layer.
o Buried vias connect traces on two sides of an internal layer
o Blind vias are exposed on one external layer and connect traces on the two sides of
that layer.
8.2
Component Placement
Affects circuit operation, manufacturing edge, and the probability of design errors.
General rules:
1) Group high current circuit near the connector to isolate stray currents and near the
edge of the PCB to remove heat.
2) Group high frequency circuits near the connector to reduce path length, crosstalk
and noise.
3) Group low power and low frequency circuits away from high current and high
frequency circuits
4) Group analog circuits separately from digital circuits.
D
ow
nl
•
•
oa
de
d
MCM (Multi-Chip Module)
• Higher level of circuit density by bonding the base die of ICs onto a substrate
• Compact packing improves signal speeds and reduces load capacitance
• Expensive to fabricate
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
2
Instrumentation II
Grouping components and circuits appropriately will reduce crosstalk and noise and will
dissipate heat efficiently.
•
•
Routing Signal Traces
Poor layout  false triggering of logic
Due to formation of capacitive and inductive parasites with stubs, vias, IC pins, multiple
loads and traces; setup and hold time violation and transmission delay.
fro
8.3
m
io
en
ot
es
.
ed
u.
np
•
Chapter 7: Circuit Layout
de
d
8.3.1 Trace Density, Common Impedance, Distribution of signals and Return,
Transmission Line Concerns, Trace Impedance and Matching, and Avoiding
Crosstalk
D
ow
nl
oa
Trace density
– Trade off between greater cost and difficulty in producing the denser circuit
board.
– As you squeeze signal traces together on a board, you can space components
closer and reduce the size of the circuit boards.
– Smaller boards, allowed by higher trace densities, provide flexibility in packaging
your product, reduce the cost of material and may degrade signal integrity.
Common Impedance
– Minimize the number of circuits that share the same return path. Voltage drops
(caused by current switching) on the ground line (return path) increase system
noise.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
3
Instrumentation II
Chapter 7: Circuit Layout
de
d
fro
m
io
en
ot
es
.
ed
u.
np
– Common impedance paths cause components to reside at different ground
potentials from one another.
– You can reduce the voltage drops, and hence the noise by lowering effective
impedance
– Unbroken return plane is the best way.
– Choosing the right logic family and using decoupling capacitors will help by
reducing the magnitude of current pulses.
D
ow
nl
oa
Distribute signal and return
– Address the issues of return path early in design.
– Long return path can shift the ground potential excessively, decrease noise
margins, and cause false switching.
– If the return is longer than signal, then the current has high inductance path that
cause noise spikes in the ground system.
– Large loops of current have high inductance or impedance and radiated noise is
often proportional to return path impedance and loop area.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
4
Chapter 7: Circuit Layout
fro
m
io
en
ot
es
.
ed
u.
np
Instrumentation II
D
ow
nl
oa
de
d
Transmission Line Concerns
– Signal conductors are never ideal transmission lines.
– Characteristic impedance: characteristic impedance Z0 depends on frequency;
higher frequencies attenuate more than lower frequencies.
– Dispersion: signals at different frequencies propagate at different speeds.
– Propagation delay: can corrupt circuit operation; depends on interconnection
length and signal velocity
– Line resistance, skin effect and dielectric losses: degrade signals and introduce
delay and error into circuit operation.
Trace impedance and impedance matching
– Impedance of signal conductors directly affects circuit operation.
– Low characteristic impedance (Z0) radiates less and is less susceptible to
interference than a circuit with higher impedance.
– Impedance mismatches lead to reflections that can both delay switching and
trigger logic falsely.
Reflection Coefficient = (ZL – Z0) / (ZL + Z0)
– Multiple loads have stubs, non-uniform impedance and mismatches that
compromise noise margins.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
5
Chapter 7: Circuit Layout
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
Instrumentation II
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
6
Chapter 7: Circuit Layout
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
ed
u.
np
Instrumentation II
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
7
Instrumentation II
Chapter 7: Circuit Layout
•
Ground, Returns and Shields
Proper ground and return scheme will shield and suppress most EMI in electronics and
reduce errors caused by noise.
ot
es
.
8.4
ed
u.
np
Avoiding Crosstalk
– Simple guidelines when routing signal to a PCB:
• Don’t run parallel traces for long distances- particularly asynchronous
signals.
• Increase separation between conductors.
• Shield clock lines with guard strips.
• Reduce magnetic coupling by reducing the loop area of circuits.
• Sandwich signal lines between return planes to reduce crosstalk.
• Isolate the clock, chip select, chip enable, read and write lines
Grounding
– Provides reference point for signal.
– Signal reference should be a single point and is as close as possible to the power
entry to the PCB.
– A ground plane connected to the single-point reference will also reduce common
impedance.
– Be sure to separate the analog and digital circuits so that current pulses from
digital circuits will not corrupt sensitive analog circuits. Use common ground
plane or different planes and connect their ground leads to the single-point
reference.
•
Distribute power and return carefully
o Address the issues of return path early in design.
o Low impedance and minimum voltage drop within the power distribution of the
PCB is desirable for optimum performance of circuits.
o Reduce the inductive loop area between the powers and return traces.
o Multilayer PCB  with power and return (or ground) planes.
o Keep voltage drop less than 2% in the distribution of circuits.
•
Shielding
o A return plane is the most effective shield for any circuit.
o Power and return planes provide circuit paths with the lowest impedance, which
reduces radiation, noise and crosstalk.
o Minimizing spacing between power and return will minimize impedance
(radiation and susceptibility)
Z0 = (120π/ Er ) . (h/d)
Where, h = separation of planes
d = smaller dimension of two-dimensional plane
Er = dielectric constant of substrate board relative to air
D
ow
nl
oa
de
d
fro
m
io
en
•
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
8
Chapter 7: Circuit Layout
fro
Guidelines for effective shield
– Use power and return planes with minimum separation.
– Place decoupling capacitors near (or in) IC packages.
– Don’t disrupt the power and return planes with slots or traces
– Route digital traces over digital return.
– Route analog traces over analog return.
– Fill the regions between analog traces with copper foil and connect to ground.
D
ow
nl
oa
de
d
•
m
io
en
ot
es
.
ed
u.
np
Instrumentation II
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
9
Chapter 7: Circuit Layout
Cables and Connectors
Connectors are the mechanical and electrical interface between cable and a circuit board.
Shape or keying polarizes a connector so that it cannot be plugged in the wrong way.
Reduce flexing of cables.
Some guideline for connectors and cables:
1) Pre-assign connector ground pins
2) Distribute and intersperse grounds (return paths)
3) Place clock next to a ground line
4) Minimize I/O
5) Use long rise and fall times to reduce high frequency harmonics
6) Keep current to less than 1 amp per connector pin; otherwise use multiple pins or
special pins or special pins with large current capacity.
D
ow
nl
•
•
•
•
oa
8.5
de
d
fro
m
io
en
ot
es
.
ed
u.
np
Instrumentation II
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
10
Chapter 7: Circuit Layout
8.6
Testing and Maintenance
Refer chapter 9
D
ow
nl
oa
de
d
•
fro
m
io
en
ot
es
.
ed
u.
np
Instrumentation II
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
11
Instrumentation II
Chapter 9: Software for instrumentation and control applications
Chapter – 9
Software for instrumentation and control applications
•
•
Software is pervasive in electronic products such as televisions, video recorders, remote
controls, microwave ovens, sewing machines, and cloth washers all have embedded
microcontrollers.
Software accounts for 50-75 percent of a microcontroller project.
General methods to improve software are code generation, reliability, maintainability and
correctness.
ed
u.
np
•
io
en
ot
es
.
9.1
Types of software, Selection and Purchase
Types of software
Software is found in many different types of systems such as real-time control, data processing
systems like payroll, and graphical systems such as games and CAD. Software can be divided
into following types:
• System Software
– Operating system, System drivers, Firmware etc.
• Programming Software
– Compiler, Debugger, Interpreter, Linker, Text editor etc.
• Application Software
– Industrial / Business automation, User interface, Games / Simulating software,
Database, Image editing, Auto CAD, word processor etc.
Compiler
m
Compiler versus Interpreter
Interpreter
fro
Source Code  Executable Code 
Machine
Relatively little time than compiler
de
d
Lots of time is spent in analyzing and
processing the program.
Source Code  Intermediate Code 
oa
Result  Executable in form of machine
specific binary code.
nl
Computer (Hardware) interprets (executes)
the resulting code.
D
ow
Program execution is relatively faster.
Result  Some sort of intermediate code
Resulting code is interpreted by another
program e.g. Java Virtual machine in Java.
Program execution is relatively slower.
Not required extra program to execute the
code.
Requires extra program to execute
intermediate code.
Standalone code
Not standalone code
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
1
Instrumentation II
Chapter 9: Software for instrumentation and control applications
ot
es
.
ed
u.
np
Processed to develop software
1. Algorithms
• List of instructions or recipes for action
• Algorithms describe the general actions to be taken and consequently are independent of
the specific programming language.
• Algorithms have the greatest effect on the utility, success, and failure of software
• Data structures provide another way of designing the processing architecture.
• Make a habit of collecting algorithms for your future programming efforts; when crisis
hits, there will be no time for research.
• Understand each algorithm, its limitations and its boundary conditions
• Jack Ganssle writes: “It’s ludicrous that we software people reinvent the wheel with
every project… Wise programmers make an ongoing effort to built an arsenal of tools for
current and future project…. Make an investment in collecting algorithms for future use.
When a crisis hits there is no time to begin research.”
Assembly Language
io
en
2. Languages
• Software has many applications within embedded systems such as Firmware, Peripheral
interface and drivers, Operating system, User interface, Application programs etc.
• May use variety of languages
• Assembly language
• High level language: Basic, C, C++, Java etc.
High Level Language
m
Processor Architecture dependent and
closer to hardware.
Processor Architecture Independent
Easier due to nitty-gritty details, structure and
readability.
Best suited for small, simple projects
with minimum memory, highest
execution speed & precise control of
peripheral devices.
Better for larger, more complex projects
which require more memory and execute the
code more slowly.
de
d
fro
Tedious because it requires steadfast
attention to exacting detail.
D
ow
nl
oa
3. Methods
• Whatever language you choose, your objective will be to reduce complexity and improve
understanding of the software.
• Design architecture may be Structured or Object oriented or CASE (Computer aided
software engineering)
• Structured designs have strategy before starting to code; small modules with clear
operational flow, easy debugging and testing.
• OOP can help by incorporating data abstractions, information hiding and modularity to
aid structured design.
• CASE tools provide blend of environment, tools and language.
• Tools available are compilers, disassemblers, debuggers, emulators, monitors and logic
analysers.
• Operating system and software libraries ease the task.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
2
Instrumentation II
Chapter 9: Software for instrumentation and control applications
ed
u.
np
4. Selection
• The selection of a particular language depends on management directives, the knowledge
and expertise of the software team, hardware and available tools.
• Function and performance depends on the speed and data path width of processor,
memory (RAM and ROM), architectural features such as coprocessors, peripherals
(ADC, timers, PWM, interrupt handlers), I/O communications, power-down modes and
the level of integration.
• Choice of language also depends on manufacturers having following questions
o Does the vendor provide reasonable documentation and support?
o Does it provide toll-free telephone support and acknowledge application
engineers?
o Does it have liability support for life-critical systems.
fro
m
io
en
ot
es
.
5. Purchase
• Purchase the software after you have defined your software requirements and surveyed
vendors for availability, reputation and experience.
• Some qualification of a vendor:
o Acceptance testing
o Review of vendor’s quality assurance
o Verification testing
o Qualification report
• Furthermore, required documentations from a vendor:
o Requirement specification
o Interface specification
o Test plans, procedures, results
o Configuration management plan
o Hazard analysis
• Don’t buy cheap software tools just to save money! You will lose much more money in
the long run from wasted time forced by delays and inadequacies of cheap tools.
Software Models and Their Limitations
Traditional software lifecycle / Waterfall Model
Over the years many models have been proposed to deal with the problems of defining
the critical activities and tying them together
The first formally defined software life cycle model was the waterfall model [Royce
1970]
The waterfall model is a software development model in which the results of one activity
flowed sequentially into the next as seen as flowing steadily downwards (like a water)
through different phases.
Water cascades from one stage down to the next, in stately, lockstep, glorious order.
– gravity only allows the waterfall to go downstream; it’s hard to swim upstream
The US Department of Defense contracts prescribed this model for software deliverables
for many years, in DOD Standard 2167-A.
•
nl
•
oa
•
de
d
9.2
1.
ow
•
D
•
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
3
Chapter 9: Software for instrumentation and control applications
io
en
ot
es
.
ed
u.
np
Instrumentation II
oa
de
d
fro
m
Quality Assurance
• Oversees each steps of model towards producing useful, reliable software rather than
connection of modules
• Methods are necessary but not sufficient to produce useful, reliable software.
• First: Classify your system and its software according to any relevant standards.
• Second: Software development plan:
o Hazard and fault tree analysis for life critical functions
o Configuration management: ensures current and correct version is released.
o Documentation
o Traceability
D
ow
nl
Concept & Analysis:
• Problem described in human language.
• Model the concept with mathematical formulas and algorithms.
• Analyze the software within the framework of the system description and concept.
• Analyse on the interactions and interfaces between the software, the hardware and data
inputs.
• Analyze should concentrate on where most problem occurs which include:
o technical tradeoff
o performance timing
o human factor
o hazard and risk analysis
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
4
Instrumentation II
Chapter 9: Software for instrumentation and control applications
o Fault tree analysis: Graphical model of sequential and concurrent events
that leads to failure of problems
ot
es
.
ed
u.
np
Requirements
• Reduce the abstract intentions of the customer into realizable constraints.
• Tells what the software does
• Includes standards that the software must adhere to, the development process, the
constraints, and reliability or fault tolerance
• Requirements may call for several, successive specifications:
o General specification
o Functional performance specification
o Requirements specification
o Design specification
• Needs constraints considerations such as memory, timing margin, hardware,
communication, I/O and execution speed;
• Will the selected processor and associated hardware support the requirements?
• Can the software use these resources and satisfy the requirements.
nl
oa
de
d
fro
m
io
en
Design
• Design tells how the software does its functioning.
• Specifies how the software will fulfill the requirements.
• Consider these software elements in preparing the design:
o System preparation and setup
o Operating system and procedures
o Communication and I/O
o Monitoring procedures
o Fault recovery and special procedures
o Diagnostics features
• Interfaces demands most attention communication format:
o Polled I/O
o Interrupt I/O
o Synchronization between tasks
o Intertask signaling
o Communications of polling and queuing to avoid overrunning events
• Design can specify algorithms and techniques that optimize performance, management of
memory.
• Design may reuse modules and libraries in an effort to improve productivity and
reliability.
D
ow
Programming
• The methods of programming – assembly language, high level languages.
• CASE tools are on the horizon
• Tools, language, methods
Source file (Assembly language mnemonics)  assembler  object file  linker  Binary
machine code  Burn  PROM
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
5
Instrumentation II
Chapter 9: Software for instrumentation and control applications
ed
u.
np
Testing
A) Internal reviews
• By colleagues examine the correctness of software and can figure out mistakes and error
in logic
• More than 50% of errors, can be found and correct by code inspection or audit
B) Black box testing:
• To ensure that input and output interfaces are functioning correctly without concerning
what happens in software.
• Ensures the integrity of the information flow.
io
en
ot
es
.
C) White box testing:
• Exercises all logical decisions and functional path within a software module.
• Requires intimate knowledge of software module
• Useful for determining bugs on special case
• Exhaustive testing is impossible; may take 100 of years to test each and every possible
combination
D) Alpha and Beta testing:
• Type of black box testing in actual environment
o Alpha testing - programmer collaborate with user
o Beta testing - user isolated from programmer
fro
m
Verification
• Debuggers, logic analyzer, in circuit analyzer in circuit debugger etc.
de
d
Maintenance:
• Require to control the software configurations: reports, measurement, personnel costs and
documentation
• Plans for releasing software upgrades, to achieve consistency and continuity of the
product.
• Cannot separate software maintenance from system concern
D
ow
nl
oa
Disadvantages of Waterfall Model:
• Traditional view of software development
• Develop each component sequentially
• Not iterative - difficult to climb up the waterfall
• Focused on software rather than work design
• One phase is completed, documented and signed off before next phase for quality
assurance
• Difficult to respond to changing customer requirement
• Software only available at late development schedule
• Based on hardware engineering model widely used in defense/aerospace
• Waterfall develops each component sequentially and usually does not iterate through
more than a stage. In reality software seldom develops according to that model.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
6
Instrumentation II
Chapter 9: Software for instrumentation and control applications
ot
es
.
ed
u.
np
Benefits of Waterfall Model
• Managers love waterfall models
• Minimizes change, maximizes predictability
• Costs and risks are more predictable
• Highly documented
• Can be used for the projects whose requirements will not changeable
• Each stage has milestones and deliverables: project managers can use to gauge how close
project is to completion
• Sets up division of labor: many software shops associate different people with different
stages:
– Systems analyst does analysis,
– Architect does design,
– Programmers code,
– Testers validate, etc.
fro
m
io
en
Problems with Waterfall Model
• Offers no insight into how each activity transforms artifacts (documents) of one stage
into another
• Fails to treat software a problem-solving process
– Unlike hardware, software development is not a manufacturing but a creative
process
– Manufacturing processes really can be linear sequences, but creative processes
usually involve back-and-forth activities such as revisions
– Software development involves a lot of communication between various human
stakeholders
• Complex documentation requires highly profiled manpower
• Cannot be used for changing requirements
• Nevertheless, more complex models often embellish the waterfall,
– incorporating feedback loops and additional activities
•
•
D
ow
d
nl
•
•
Prototyping Model
In this model the developer and client interact to establish the requirements of the
software.
Accommodates the problem of changing requirements and make a subset of the software
available early.
Essence of prototyping is a quickly designed model that can undergo immediate
evaluation.
Define the broad set of objectives.
This is follow up by the quick design, in which the visible elements of the software, the
input and the output are designed.
The quick design stresses the client’s view of the software.
The final product of the design is a prototype.
The client then evaluates the prototype and provides its recommendations and suggestion
to the analyst.
The process continues in an iterative manner until the all the user requirements are met.
Accommodates problem of changing requirements
de
•
oa
2.
•
•
•
•
•
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
7
Instrumentation II
Helps to identify missing client requirements
A prototype may take one of three forms
o A paper model or computer based simulation
o A program with a subset of functions
o An existing program with other features that will be modified for your product.
io
en
ot
es
.
ed
u.
np
•
•
Chapter 9: Software for instrumentation and control applications
fro
m
Advantages of Prototyping Model
The following are the advantages of Prototyping model:
• Due the interaction between the client and developer right from the beginning, the
objectives and requirements of the software is well established.
• Suitable for the projects when client has not clear idea about his requirements.
• The client can provide its input during development of the prototype.
• The prototype serves as an aid for the development of the final product.
D
ow
nl
oa
de
d
Disadvantages of Prototyping Model
The prototyping model has the following disadvantages.
• The quality of the software development is compromised in the rush to present a working
version of the software to the client.
• The clients looks at the working version of the product at the outset and expect the final
version of the product to be deliver immediately. This cause additional pressure over the
developers to adopt shortcut in order to meet the final product deadline.
• It becomes difficult for the developer to convince the client as why the prototype has to
be discarded.
• Sometimes prototype ends as final product which result in quality + maintenance
problem
• Client may divert attention solely to interface issue
• Testing + documentation forgotten
• Designer tends to rush product to market without considering long term reliability,
maintenance, configuration control
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
8
Instrumentation II
•
•
•
•
•
•
de
d
fro
m
io
en
•
•
Spiral Model
Uses incremental approach to development that provides a combination of waterfall and
prototyping model.
Each cycle around the development spiral provides a successively more complete version
of the software.
Model allows flexibility to manage requirements control changes
Used in proprietary application
Spiral Model – risk driven rather than document driven
The "risk" inherent in an activity is a measure of the uncertainty of the outcome of that
activity
High-risk activities cause schedule and cost overruns
Risk is related to the amount and quality of available information. The less information,
the higher the risk
ed
u.
np
3.
Creeping featurism: The customer voices new desires after each evolution, and the
project effort balloons.
ot
es
.
•
Chapter 9: Software for instrumentation and control applications
D
ow
nl
oa
Spiral Model Strengths
– Introduces risk management
– Prototyping controls costs
– Evolutionary development
– Release builds for beta testing
– Marketing advantage
Spiral Model Weaknesses
– Lack of risk management experience
– Lack of milestones
– Management is dubious of spiral process
– Change in Management
– Prototype Vs Production
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
9
Instrumentation II
Chapter 9: Software for instrumentation and control applications
ed
u.
np
Metrics
• Objective understanding of the completion of the software at each stage or of its
usefulness
• Software size, development time, personnel requirements, productivity, and number of
defects all interrelate metric can define those relationships
• Cost and schedule are very poor metrics for producing quality software
• To rely on your estimates, you need to track the metrics honestly and record them
carefully & consistently
• Good process model needs metrics to access performance and progress of software
– Correctness, Reliability, Efficiency, Maintainability, Flexibility, Testability,
Portability, Reuse, Utility, Size etc.
io
en
ot
es
.
Process
• Process incorporate models of software development to generate useful, reliable and
maintainable software
• Good process keeps statistics for feedback & improvement of the software development
• Software tools are integral to the software process; don’t change them in midstream.
• Process maturity levels defined by the software engineering institute:
1) Initial: Chaos or ad hoc process
2) Repeatable: Design & Management defined
3) Defined: Fully defined & enforced technical practices
4) Managed Process: Feedback that detects and prevents problems, a control process
5) Optimizing Process: Automating, monitoring & introducing new technologies
d
fro
m
Software Limitations
• Not all problems can be solved
• Specifications cannot anticipate all possible uses and problems
• Errors creep into development in a number of ways
• Software simulation can predict only known outcomes
• Human error can occur in operating the software
nl
•
•
de
•
Software Reliability
Reliability is a broad concept.
– It is applied whenever we expect something to behave in a certain way.
Reliability is one of the metrics that are used to measure quality.
It is a user-oriented quality factor relating to system operation.
– Intuitively, if the users of a system rarely experience failure, the system is
considered to be more reliable than one that fails more often.
A system without faults is considered to be highly reliable.
– Constructing a correct system is a difficult task.
– Even an incorrect system may be considered to be reliable if the frequency of
failure is “acceptable.”
Key concepts in discussing reliability:
– Fault
– Failure
– Time
oa
9.3
D
ow
•
•
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
10
Instrumentation II
Reliability develops complete plan
Understands nature of bugs, their introduction and removal.
Guidelines to write reliable software
• Make each module independent
• Reduce the complexity of each task
• Isolate tasks from influences, both hardware and timing
• Communicate through a single well-defined interface between tasks
9.4
Fault Tolerance
Fault tolerance concerns safety and operational uptime, not reliability.
It defines how a system prevents or responds to bugs, errors, faults or failures.
Use
– Check sums on blocks of memory to detect bit flips
– Watchdog timer: h/w that monitors a system characteristic to check the control
flow and signals the processor with logic pulse when it detect fault.
– Roll-Back-Recovery or Roll-Forward-Recovery
– Careful design
– Redundant architecture
m
fro
9.5
Software Bugs and Testing
Phases of bugs
1. Intent
2. Translation
3. Execution
4. Operation
io
en
ot
es
.
•
•
•
ed
u.
np
•
•
Chapter 9: Software for instrumentation and control applications
de
d
Intent
o Wrong assumption +misunderstanding
o Correctly solving wrong problems
o Viruses
o Slang-limits of operation to broadly or too narrowly defined
D
ow
nl
oa
Translation
o Incorrect algorithm
o Incorrect analysis
o Misinterpretation
Execution
o Semantic error –does not know how command works
o Syntax error- rules of language
o Logic error- using wrong decision
o Range error-overflow /underflow error
o truncation error- incorrect rounding
o Data error –not initialing values, wrong error etc
o Language misuse-inefficient coding
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
11
Instrumentation II
Chapter 9: Software for instrumentation and control applications
o Documentation-wrong/misleading comments
ed
u.
np
Operation
o Changing paradigm
o Interface error
o Performance
o Hardware error
o Human error
io
en
ot
es
.
Debugging
• Print statement
• Break points and watch values
• In circuit emulators ,in circuit debugger
• Logic analyzer
• White box testing
• Black box testing
• Grey Box testing
o Having knowledge of internal data structure & algorithm for purpose of designing
test case but testing is black box
o Used in reverse engineering to determine instance, boundary value
d
fro
m
Testing Levels
• Unit test
o To test functionality of specific section of code at functional level
o Building blocks work independently of each other
o E.g. Class level testing in OOP
• Integration test
o To verify interface between components
• System test
o To test the whole system which is to be used
oa
•
Good Programming Practice
For useful, reliable, maintainable program we must make them readable and
understandable. Good design and programming practices can make programs more
readable.
de
9.6
D
ow
nl
A) Style and format
• program- to do something
- To communicate designer’s intent to other structure of program and comment.
Design:
• Documentation form begin
• Pseudocode before program
• Keep routine short
• Write clearly: don’t sacrifice clarity for efficiency
• Make routine right, clear, simple and correct before making it faster
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
12
Instrumentation II
Chapter 9: Software for instrumentation and control applications
ed
u.
np
Comments:
• Readable and clear
• Should not be paraphrase of code
• Should be correct (incorrect comments are worse than no comment)
• Comment more than you think you need
Variables:
• Name properly
• Minimize use of global variables
• Don’t pass pointer
• Pass intact values
io
en
ot
es
.
B) Structured Programming
• Establish framework for generating code that is more readable useful, reliable
and maintainable.
• Framework based on clearly defined modules or procedures, each doing one
task well in a variety of situations.
• Modules can isolate device dependent code for simplicity and reuse.
• Large modules: divide among team for more productive and parallel effort.
• Use of libraries of modules and procedures load faster and resist inadvertent
changes
• Structure programming encourages the installation and testing of one module
at a time to simplify the verification of the software.
de
d
fro
m
Points to be noted
• 90% of processor time is spent in executing 10% of code. Identify this 1%.
• Listen to customer while developing specification
• Prototype complex task on host computer and investigate their behavior.
• Design architecture for debugging and testing.
• Code small modules so that you can test and forget
• Code single entry and exit in routine
• Document carefully
nl
oa
C) Coupling and Cohesion
• Define tasks and design the modules.
• Modules should have a minimum of coupling or communication. If two tasks or
processes communicate heavily, they should reside in the same module.
• Cohesion means everything within a module should be closely related that is they should
stick together.
D
ow
Cohesion:
• A cohesive module performs a single task
• Modules should have maximum cohesion
• Different levels of cohesion
– Coincidental, logical, temporal, procedural, communications, sequential,
functional
• Coincidental Cohesion
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
13
Instrumentation II
•
•
•
ot
es
.
•
– Occurs when modules are grouped together for no reason at all
Logical Cohesion
– Modules have a logical cohesion, but no actual connection in data and control
Temporal Cohesion
– Modules are bound together because they must be used at approximately the same
time
Communication Cohesion
– Modules grouped together because they access the same Input/Output devices
Sequential Cohesion
– Elements in a module are linked together by the necessity to be activated in a
particular order
Functional Cohesion
– All elements of a module relate to the performance of a single function
ed
u.
np
•
Chapter 9: Software for instrumentation and control applications
d
fro
m
io
en
Coupling:
• Coupling describes the interconnection among modules
• Modules should have minimum Communication or coupling
• Data coupling
– Occurs when one module passes local data values to another as parameters
• Stamp coupling
– Occurs when part of a data structure is passed to another module as a parameter
• Control Coupling
– Occurs when control parameters are passed between modules
• Common Coupling
– Occurs when multiple modules access common data areas such as Fortran
Common or C extern
• Content Coupling
– Occurs when a module data in another module
• Subclass Coupling
– The coupling that a class has with its parent class
nl
oa
de
D) Documentation and Source Control
• Documentation describes the overall system function.
• Documentation: first to begin and last to finish ensuring completeness and veracity.
• Back up source files: disks, CD, tape drivers
• Store multiple copies in separate location
• File storage is cheap but reconstructing lost data is expensive and impossible.
D
ow
E) Scheduling
• Should record all efforts expended in current jobs to estimate future job
• Timing of meeting, planning, designing, debugging testing should be properly planned
• Give more time than required to debugging and testing.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
14
Instrumentation II
9.7
Chapter 9: Software for instrumentation and control applications
User Interface
The user interface is a major concern from a system viewpoint, and software plays a
principal role in the interface.
Good user interfaces require extraordinary attention to detail.
The use interface can make or break an instrument; for instance, half of all hospital
accidents are due to improper use of correctly operating equipment.
Strangely, the higher the cost of the equipment, the lower the quality of the humaninterface design.
Common design issues for a user interface include response time, error handling and help
facilities.
The response time should have a reasonable interval and consistent variation application
to the task.
Error handling should be clear and give remedial action.
Help facilities should be on line and context sensitive.
Command sequences should be useful and consistent.
•
•
•
•
•
•
•
ot
es
.
ed
u.
np
•
•
m
Make error messages meaningful
Provide help facilities
Verify critical actions
Permit reversal of actions
Reduce memory load
Comments
Make it smooth and consistent. Use logical
rather than visual thinking.
Let the user know what is going on
Let the user know what is going on
Help user understand consequences
Forgive mistakes
Don’t compromise simple operations by
extending them for infrequent ones
Remove static or redundant information
Fade out or clear from screen unused
Use a modular format
io
en
User Interface Guidelines
Action or Concern
Tune dialogue to user
d
fro
Display only relevant information
Deactivate commands
Use good layout techniques
D
ow
nl
oa
de
User Interface Development
• Storyboarding and rapid prototyping are particularly suited for developing user interfaces
because they are informal and fast.
• Try to develop the user interface with a top-down approach prototype which can take any
of three forms
o A paper prototype depicting user interaction
o A working prototype with a subset of functions
o An existing program that has all features but needs modification
• Creeping featurism can sidetrack development because prototyping concentrates on short
term results and can miss long term concerns that may require substantial reworking in
the future.
• Finally, you need cooperation from both customer and management.
• Management must support the goal of prototyping and effect of development schedule
• Customer must be committed to both evaluation and refinement of the prototype.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
15
Instrumentation II
•
•
•
•
•
•
•
D
ow
nl
oa
de
d
•
fro
m
•
ed
u.
np
•
•
ot
es
.
•
Embedded and Real Time Software
Most of the software that runs or controls instruments is embedded and real time
software.
Real-time software is code that responds to current events in a timely manner.
Embedded software is hardware specific; often a user interacts with a portion of the
software system but does not have complete control over the source code.
Software design concerns with occurrence and loading.
Occurrence is the timing of events in real-time software. Events occur either
synchronously and asynchronously.
Loading is the measure of processor capacity; two metrics are utilization (amount of
processing) and throughput (no. of I/O operations).
Real time software has two components  operating system and device driver.
Real time operating system (RTOS) controls the flow of events in priority scheduling
mechanism.
Performance, fault tolerance, and reliability are major concerns for embedded software
which has following metrics:
o Execution speed of the processor
o Response time of the system
o Data transfer rate
o Interrupt handling: context switching and interrupt latency
o Memory size
Performance can measure with time I/O bus signals with an oscilloscope, logic analyzer,
or performance analyzer.
Fault tolerance defines how the software deals with misused resources and outright errors
with various degrees as:
o Limit on downtime of the system
o Absence of catastrophic errors
o Predictableness
o Robustness
Some types of failure that affect reliability include missed or incomplete tasks, deadlock,
spurious interrupts, and stack overflow.
io
en
9.8
Chapter 9: Software for instrumentation and control applications
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
16
Instrumentation II
Chapter 9: Software for instrumentation and control applications
Chapter - 10
Case Study
ed
u.
np
Examples chosen from local industrial situations with particular attention paid to the basic
measurement requirements, accuracy, and specific hardware employed environmental
conditions under which the instruments must operate, signal processing and transmission,
output devices:
Instrumentation for a power station including all electrical and non-electrical parameters.
Instrumentation for a wire and cable manufacturing and bottling plant
Instrumentation for a beverage manufacturing and bottling plant
Instrumentation for a complete textile plant; for example, a cotton foil from raw cotton
through to finished dyed fabric.
e) Instrumentation for a process; for example, an oil seed processing plant from raw seeds
through to packaged edible oil product.
f) Instruments required for a biomedical application such as a medical clinic or hospital.
g) Other industries can be selected with the consent of the subject teacher.
io
en
ot
es
.
a)
b)
c)
d)
fro
m
Preliminary
1. All students must team up for the case study and it is recommended to form a group of four
to six students in a group. Once formed, the group cannot be reshuffled.
2. The group will take a request letter from the department. However, before approaching to an
organization, students need to bring the responsible person’s name and post for issuing the
letter. The letter must be addressed accordingly.
3. The duration for the case study is for a month from the date of presentation. You need to
submit the report. Apart from the new recommended design, you need to present the cost
benefit analysis of the project.
D
ow
nl
oa
de
d
During Visit
1. You need to understand the current process control system of the visited organization and
describe the same in your own word in the report. List all the variables that are included in
the process control system.
2. The systematic approach to understand the system must be presented with necessary block
and detailing diagrams, if it is required.
3. Interview managers and the personnel who are directly involved in the current system and get
to know the merits and demerits of the system.
4. Learn more from users and consumers who are directly participating and using the product of
the visited organization. Comment on the product and recommend better option for the
product in the present context, if you feel its need.
5. List down all the requirements needed to go for the improvised system.
6. Mention the cost of the current system.
7. Compare it to the latest system available in the market.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
17
Instrumentation II
Chapter 9: Software for instrumentation and control applications
ed
u.
np
After Visit
1. Think and recommend the extra mechanism to provide a better solution the current problem.
2. Draw the block diagram of the newly recommended system. How does the current system
adjusts the demerits discussed in item no 3 of during visit.
3. Include how the cost varies and what additional benefit you get with the newly proposed
system in place.
4. Did you face a difficulty to go for the case study? How do you relate this with the real life
situation?
5. Recommend what you feel like.
6. On the basis of above prepare a report on the case study.
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.
The final report should present the instrumentation requirements in terms of engineering
specifications, the hardware solution suggested, a listing of the particular devices chosen to satisfy
the requirements, appropriate system flow diagrams, wiring diagrams, etc. to show how the system
would be connected and operated.
Compiled By: Er. Hari Aryal [haryal4@gmail.com]
Reference: K. R. Fowler |
18
Instrumentation II
Chapter 10 - Case Study
Chapter - 10
Case Study
du
.n
p
Examples chosen from local industrial situations with particular attention paid to the basic
measurement requirements, accuracy, and specific hardware employed environmental
conditions under which the instruments must operate, signal processing and transmission,
output devices:
ot
es
.e
a) Instrumentation for a power station including all electrical and non-electrical
parameters.
b) Instrumentation for a wire and cable manufacturing and bottling plant
c) Instrumentation for a beverage manufacturing and bottling plant
d) Instrumentation for a complete textile plant; for example, a cotton foil from raw
cotton through to finished dyed fabric.
e) Instrumentation for a process; for example, an oil seed processing plant from raw
seeds through to packaged edible oil product.
f) Instruments required for a biomedical application such as a medical clinic or hospital.
g) Other industries can be selected with the consent of the subject teacher.
fro
m
io
en
Preliminary
1. All students must team up for the case study and it is recommended to form a group of
four to six students in a group. Once formed, the group cannot be reshuffled.
2. The group will take a request letter from the department. However, before approaching to
an organization, students need to bring the responsible person’s name and post for issuing
the letter. The letter must be addressed accordingly.
3. The duration for the case study is for a month from the date of presentation. You need to
submit the report. Apart from the new recommended design, you need to present the cost
benefit analysis of the project.
D
ow
nl
oa
de
d
During Visit
1. You need to understand the current process control system of the visited organization and
describe the same in your own word in the report. List all the variables that are included
in the process control system.
2. The systematic approach to understand the system must be presented with necessary
block and detailing diagrams, if it is required.
3. Interview managers and the personnel who are directly involved in the current system and
get to know the merits and demerits of the system.
4. Learn more from users and consumers who are directly participating and using the
product of the visited organization. Comment on the product and recommend better
option for the product in the present context, if you feel its need.
5. List down all the requirements needed to go for the improvised system.
6. Mention the cost of the current system.
7. Compare it to the latest system available in the market.
1
Instrumentation II
Chapter 10 - Case Study
du
.n
p
After Visit
1. Think and recommend the extra mechanism to provide a better solution the current
problem.
2. Draw the block diagram of the newly recommended system. How does the current system
adjusts the demerits discussed in item no 3 of during visit.
3. Include how the cost varies and what additional benefit you get with the newly proposed
system in place.
4. Did you face a difficulty to go for the case study? How do you relate this with the real life
situation?
5. Recommend what you feel like.
6. On the basis of above prepare a report on the case study.
es
.e
The final report should present the instrumentation requirements in terms of engineering
specifications, the hardware solution suggested, a listing of the particular devices chosen to
satisfy the requirements, appropriate system flow diagrams, wiring diagrams, etc. to show how
the system would be connected and operated.
D
ow
nl
oa
de
d
fro
m
io
en
ot
Below is given a sample case study.
2
Instrumentation II
Chapter 10 - Case Study
Abstract
The course of Instrumentation II is essentially related to design issues an electronics engineer faces
in his/her career. The design we perform on classes and labs are not adequate as they don’t involve
the rightful applications. Thus we have been asked to conduct a case study on a production industry
du
.n
p
related to our field and view how actual design principles are in practice.
This report presents an overview of the practical applications of electronics in Bottler’s Nepal Pvt.
Ltd. There is nothing such as perfect in real world. Thus, we are proposing some modification in the
.e
plant to improve its production capacity efficiently.
es
We are not boasting that our proposed design is more faultless than the current one. As every coin
has two sides the proposed design can also have its own flaws along with the new efficiency.
ot
However, being an Electronics Engineer we believe that our proposed design can improve the
D
ow
nl
oa
de
d
fro
m
io
en
efficiency of the existing plant.
3
Instrumentation II
Chapter 10 - Case Study
Introduction
Coca-cola, imported from India, was, first introduced into Nepal in 1973, with local production of
coca-cola beginning in 1979.
du
.n
p
Bottlers Nepal Limited (BNL) is the only bottler of Coca-cola products in Nepal, and has two bottling
plants; namely Kathmandu (Bottlers Nepal Limited- BNL) and Bharatpur (Bottlers Nepal (Terai)
Limited which is 160km from Kathmandu, its capital.
.e
Coca-cola sabco operates in seven southern and East African countries and five Asian countries, and
employs more than 9500 people. It operates 25 bottling plants and aims to fulfill the refreshment
needs of more than 240 million consumers that live in its markets. It is a proud developing markets
Anchor bottler.
es
Objectives of case study
en
ot
The main objective of doing case study is to get acquainted about use instrumentation in real field.
So we research about the application of different designs of electronics. We were guided to find any
problems in the existing plant and propose a design to solve the problem. So in our case we propose
a design to solve problems related to operation and manufacturing of coca cola.
Hence the main objective of our visit can be summarized as following:
io
d

m




To visit the chosen organization and learn its operation under supervision of senior
engineers and technicians.
To study the existing management system and technology of company.
To be familiar with various engineering aspects demanded by that particular company.
To learn the vital role of engineer in a particular company.
To learn about electronics design using microcontroller and microprocessor in commercial
field. To observe the current system carefully and detect any fault in existing system if any.
To propose solutions to boost the efficiency of the system.
fro

D
ow
nl
oa
de
The processing plant of coca-cola company has been installed in Balaju industrial state several years
ago. All the processing plants are being closely monitored by Nepal ease technicians and engineers.
The plant has been working smoothly.
Process of manufacturing:
1. Preparation of bottles and cans.
2. Chemicals
3. Machinery Equipments
4. Computers
1. Preparation of bottles and cans: The pre-form for preparing Bottles are imported
from India where as the pre-form for the PET bottles are manufactured in Bhutan
and blown in Nepal using Blow Mold machine which outputs bottle and cans. The
associated label is imported from India.
4
Instrumentation II
Chapter 10 - Case Study
fro
m
io
en
ot
es
.e
du
.n
p
2. Chemicals: The flavor used for the production of beverage is imported from South
Africa and sugar from Dubai (U.A.E). The sugar required is of the quality prescribed
by the company.
As coca-cola company is primarily a private owned company, has an obligation to fulfill
various criteria for most of its work. The effect is seen in the procurement of materials and
machines. The department, either mechanical, electrical or AC section identifies need for
necessary equipments and prepares a report bases in it and forward it to material and
management Department. The material management then seeks for the bidders and buys
the needed materials and equipments in accordance with company rule and policy.
Generally, the bidder with equipments meeting all the required specification as produced
the coca-cola company and low in price obtains the tender to sell the equipments to
company. Then material management department forwards the equipments to the
departments that for material.
There are various operations implemented during the production and distribution of the
products. They are
 Collection of bottles from every part of the country.
 Cleaning of the bottles with water jet.
 Testing of bottles for unwanted materials (EBI).
 Mixing of the ingredients in a proportion prescribed by coca-cola company
(Atlanta).
 Automatic time controlled filling.
 Automatic capping.
 Automatic Date coding.
 COLLECTION OF BOTTLES:
Initially the empty bottles are collected from the retailers by the dealers.
Now the bottles are brought to the company’s depot from the dealers.
Further these bottles are fed to the plant for the next process.
d
EBI(ELECTRONIC BOTTLE INDICATOR)TEST
The bottles are now cleaned by keeping the bottle in various positions and striking with the
water jet. Then so called cleaned bottle is send to the EBI unit where the sensor senses any
alien materials present in the bottle. The test if passed sends the bottle for further
processing and if failed rejects the bottle and again the bottle is recycled. This unit also
checks if there is any cracks in bottle.
nl
oa
de

D
ow


MIXING OF INGREDIENTS
In this unit, first of all the given proportion of the flavor is diluted with specified ratio of
water with added sugar. Additional amount of flavors are also mixed up with the solution to
give it the proper flavor. The mixture thus obtained is called syrup.
AUTOMATIC TIME CONTROLLED FILLING UNIT
In this unit, the bottles passed from the EBI unit are filled the solution of the mixture on the
time basis. The bottles are clamped by a robotics arm for a certain period of time during
5
Instrumentation II
Chapter 10 - Case Study
TEMPERATURE TEST UNIT
Here, the filled bottles are tested for the appropriate temperatures. The testing is
performed by the bottles into water kept at 120 degree Celsius. If there is any impurity
present in the mixture, certain symptoms like clotting etc may seem to occur. If such
symptoms are encountered, the whole lot of the solution is discarded.
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
.e

du
.n
p
which the mixture is filled into it. The time duration is kept different for different sizes of
bottles. Followed by the filling, the carbon dioxide gas is also introduced in the bottle with
immediate capping. The carbon dioxide gas is used to make the solution harder and give it
additional flavor. It is also used as preservative.
The capping is also done automatically. As soon as the mixture is carbonated, the caps
loaded into the machine are locked onto the bottle ensuring the proper sealing.
6
Instrumentation II
Chapter 10 - Case Study
Block Diagram & Description of the Plant
du
.n
p
PET (Polyethylenterepthalate)
Blow Mold
(sipa)
Chiller
HP Compressor
Rinser+Filter+cappe
ot
Chain
es
Para mix
Blender
.e
Air
en
Conveyor
Data Code
Warmer
(Khs)
Lableller
(Krones)
Cartoon Taking
D
ow
nl
oa
de
d
fro
m
io
(Video jet)
7
Instrumentation II
Chapter 10 - Case Study
du
.n
p
RGB (Returnable Glass)
.e
Decrater (Ketlner)
es
Bottle Washer
io
EBI
en
ot
(Crown/Bade)
fro
m
(Empty Bottle)
Data Code
D
ow
nl
oa
de
d
Filling+ Crowner
Carter
8
Instrumentation II
Chapter 10 - Case Study
PRODUCTION:
The production of drinking soft drink in coca-cola company broadly involves four steps:
1. Importing spring water from various part of Kathmandu.
2. Purification of soft drink.
3. Washing and filling of bottles.
4. Storage
du
.n
p
1. Importing spring water from various part of Kathmandu.
As there is no boring in coca-cola company, the company has to import spring water. It imports
spring water from various part of Kathmandu such as Balaju water supply etc.
.e
2. Purification of water
Purification of water is a very important process. The brand name depends on the production pure
water. The basic block diagram for purification of water is shown below:
es
Chlorine
Sand filter (Removes suspended particles)
Sedimentation
Tank (sediment for
6-8 hours)
+
ot
io
Softener (Removes hardness of water)
Bag filter (Removes microscopic particles
up to 5 microns)
m
Chlorination
Carbon filter (Removes organic Residue)
en
Spring water
AM filter (Anthracite & manganese filter)
fro
Candle filter
Ozone contact
Tank
Reverse
Osmosis
D
ow
nl
oa
de
d
Pure water for
packing (should be
left for at least 4
hours before
drinking)
Ozone
Generator
Fig 1.Water Purification Plant
9
Instrumentation II
Chapter 10 - Case Study
Water is obtained as spring water. The water is then collected in sedimentation Tank. The simple
process of sedimentation allows heavy suspended particles to settle down. The process of
chlorination is also performed in this tank. Chlorination is the process of adding the element to
water as a method of water purification to make it fit for human consumption as drinking water.
Water which has been treated with chlorine is effective in preventing the spread of disease.
.e
du
.n
p
Next, pressurized water is passed through a variety of filters as shown in the figure. First, the water
is passed through sand filter. A sand filter is a basic tool of water purification passing flocculated
water through a sand filter strains out the flock and the particles trapped within it. The medium of
filter is sand of varying grades. As water flows through the sand, impurities such as solids,
precipitates, turbidity and in some case even bacterial particles are filtered out. After being filtered
through the sand filter water is then filtered for any anthracite and manganese through AM filter.
en
ot
es
Next, water is passed through carbon filter. Carbon filters are most effective at removing chlorine
and volatile organic compounds from water. They are not generally effective at removing minerals,
salt, and dissolved inorganic compounds. Spring water generally is exposed to variety of minerals
underground. This causes the formation of hard water. Hard water is the one with high mineral
content. Hard water deposits can serve as a medium for bacterial growth and irritation. During
purification the mineral ions are exchanged with the ions that don’t cause hardness.
io
Then, water is passed through bag filter to remove suspended particles smaller than 5 microns and
finally through candle filter.
de
d
fro
m
After completion of the purification reverse osmosis is performed. The term reverse osmosis comes
from the process of osmosis, the natural movement of solvent from an area of low solute
concentration, through a membrane to an area of high solute concentration if no external pressure
is applied. Reverse osmosis is the process of pushing a solution through a filter that traps the solute
on one side and allows the pure solvent to be obtained from the other side. More formally, it is the
process of forcing a solvent from a region of high solute concentration through a membrane to a
region of low solute concentration by applying a pressure in excess of the osmotic pressure. This
process removes minerals in the water and is best known for it’s used in desalination.
ow
nl
oa
The final stage of purification involves sterilizing water with ozone. Ozone is bubbled in ozone
contact tank to sterilize water from any remaining contamination. Ozone is an excellent sterilizing
agent without any effects. As ozone is unstable it breaks down into oxygen molecules after some
time.
D
3. Washing and filling of bottles
The PC (polycarbonate) bottles are the reusable bottles. They have a capacity of holding 19 liters of
water. The company distributes filled bottles and collects the empty bottles from the customers.
10
Instrumentation II
Chapter 10 - Case Study
The equipments used are fine at performing the corresponding job assigned to them. The
equipments are from snap co. The equipments is separated into two section for washing and filling
water respectively. The overall block diagram is shown below.
Automatic jet washer
Clean bottles
Filter and
capper
du
.n
p
Manual input of
unclean bottles
(Cap snap co)
es
.e
Delivery
trolley
Fig 2. Washing and filling of PC jars
D
ow
nl
oa
de
d
fro
m
io
en
ot
The reusable bottles encounter a variety of environments and thus are susceptible to contamination.
The first process is thus cleaning of the bottles as soon as they arrive at the company. Although the
machine cleaning is sufficient enough, the bottles are first manually cleaned by sprinkling detergent
water. Then the bottles are transported to automatic jet washer. An employee observes for any
cracks and unwanted residues that cannot be removed. S/He then mounts them in the Automatic jet
Washer one by one. The bottles are rotated in a convey halting at certain points. When halted a jet
of detergent water with chlorine jets into the bottle. Next it is washed by recalculating water. Then
the bottle is washed by hyper assonated water to remove any remaining infections.
11
Instrumentation II
Chapter 10 - Case Study
The Automatic bottle Washer performs the first three tasks. The water is filled and the bottle sealed
at filler and capper. The filler and capper section first detects the arrival of bottle and lifts them off
the convey belt. It is then filled with soft drink. The bottle is not released until the next one arrives.
After being released the caps are placed on the mouth of the bottle and sealed. The filled bottles are
then loaded in a trolley and taken to storage facility.
du
.n
p
4. Storage
The assonated soft drink is not suitable for drinking. Since, ozone is unstable it breaks down into
oxygen molecules, the soft drink has to be left aside for at least four hours. Coca-cola Company,
however stores the recently packed bottles for one whole day. They are dispatched only on the
other day.
ot
es
.e
The purification of the water is quite perfect and employs a number of filters to remove impurities
and infections. However, the washing and filling stations employ electro mechanics. The current
system is only based on the timing sequences. The processes repeat itself in a fixed duration of time.
The disorder in any timing sequences can disrupt the whole system. Also, if any sequence is to be
rearranged the entire system may have to be dismantled for a small purpose.
en
Here, we purpose a microprocessor based automatic washing and filling station, which has a much
easier control structure.
io
The different instruments and devices we propose to add are:
Bottle sensor: These can be anything from simple limit switch to IR sensors to detect the
presence of the bottle at that position. The detected signal is used as an input to
microcontroller or the counter.
2.
Solenoid valve: Solenoid valve are valves controlled via electrical signals. The proposed
design uses four of them. Three solenoid valves are used in the Automatic Jet Washer while
the final one is fill the bottle with pure soft drink.
3.
Temperature sensors: Although sensors are already present in the previous design we
will use the temperature sensor to maintain the temperature using heaters and coolers.
4.
Load cell: Previously no weighing machine was used. The time a bottle took to fill was
estimated to be around 10-12 seconds. Now we proposed to add a weighing machine and
weigh the amount of soft drink filled. The weight information will be used to control the
amount of soft drink.
nl
oa
de
d
fro
m
1.
D
ow
5.
User keypad: This is a new feature allows user to make different modifications according
to his need.
6.
Electromagnetic lift: This is a magnetic lift the bottles during filling of soft drink.
7.
Press: This may be a hydraulic press or any other one seal the bottle.
12
Instrumentation II
8.
Chapter 10 - Case Study
LCD Display: The display shows the temperature in the automatic bottle washer and the
total number of production in the factory.
du
.n
p
The block diagram of the proposed bottle washer is as shown in fig below. The new jet
washer incorporates the use of bottle sensors to jet the soft drink in the corresponding slot.
If the bottle is into present in a slot then the corresponding jet will not eject soft drink. This
design allows the plant to save water, detergent and hyper assonated water.
.e
First the jets are in the off state. As soon as the motors stall the sensors checks the
corresponding location. If the slot is full then the solenoid valve corresponding to the slot is
activated. After 10 seconds the jet are turned off and the motor rotates for about 2 seconds
to move the bottle to next cleaning location. Again the slots are checked and results verified
to open the equivalent solenoid valve. After the washing is complete the bottles are passed
on to the conveyer belt to pass bottle to filling and capping station.
D
ow
nl
oa
de
d
fro
m
io
en
ot
es
After the bottle is washed it is transported to the filling section by a convey line. But it
should be remembered that convey should transported the bottles smoothly without any
13
Chapter 10 - Case Study
en
ot
es
.e
du
.n
p
Instrumentation II
D
ow
nl
oa
de
d
fro
m
io
Fig . Block Diagram of Proposed Design
14
Download