Instrumentation II
Instrumentation II
Chapter – 1
Microprocessor Based Instrumentation System
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
np
input, processes data according to those instructions and provide result s as output.
u.
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.
ed
Microprocessor based Instrumentation System: Any instrumentation systems centered
.
around a microprocessor are known as microprocessor based system. Logical and
es
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,
ot
fuel control, oven etc.
Why microprocessor?
Can be used in any system. en
Can be used in specific applications and specific design.
io
Logical and computational power of microprocessor has been used to develop
more accurate and efficient system.
m
np
open loop control system and closed loop control system.
u.
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
ed
operator makes changes in the necessary control inputs.
Example: pressure and temperature monitoring system in any chemical
processing plant
.
es
It is simple, low cost and used when feedback is not critical.
ot
Data / Address / Control Bus Microprocesor
Pressure (Analog
Signal)
ADC
en
RAM
Memory
Panel
Interface
Panel
io
Fig: Block diagram of pressure monitoring system - Open loop control
m
the output signal to the electromechanical devices, which in turn controls the
values of process variables.
Example: automatic temperature control system in an oven
nl
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Fowler | 2
Instrumentation II Chapter 1: Microprocessor Based Instrumentation System
DAC
To Heater
Control System
Port RAM
np
Data / Address / Control Bus Microprocesor
u.
ed
Panel
port Panel
Interface
.
es
ADC
Temperature of
Oven
Fig: Block diagram of automatic temperature control system – Closed loop
ot
control
en
In microprocessor, upper and lower limits of temperature are set.
Every sample of temperature measurement from transducer is compared by
the processor.
io
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
m
heater elements.
If temperature is less than the preset lower limit, the microprocessor transmits
fro
signal to system so that it turns on the supply to the heater element of the
oven.
Complete automation
de
Added intelligence
Reduced manpower
Flexibility to modify
oa
Economic design
Reduced circuit complexity
Reduced operating costs (eg. Fuel savings)
nl
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Fowler | 3
Instrumentation II Chapter 1: Microprocessor Based Instrumentation System
np
Information exchange with other plant system for process synchronization.
u.
Process / Multiplexer
ed
Analog
Plant / (to sequentially feeds
Transducer
System the outputs one at atime)
.
es
Signal Conditioner
And
Magnetic Disk Print Out ADC
ot
Computer Digital
Data Logger
en
Produces O/P Computer Software
io
Data Operator Command
Monitor
Display Through I/O
m
Device
fro
Data
Communica-
tion
d
Remote Indicator
de
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
nl
Advantages:
Suitably programmed to automatically carry out the mundane tasks of drift
correction, noise reduction, gain adjustments, automatic calibration etc.
D
Disadvantages:
They cannot replace the program themselves.
np
Software update
Prone to virus problem, so may become in-operational.
u.
1.5 Interfacing With Microprocessor
The primary function of microprocessor is to accept data from input devices such
ed
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
es
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
ot
interfacing devices.
card, sound card, network card etc. are inserted into the slots for
various applications.
d
3) USB ports
nl
The R/W memory is made of registers and each register has a group of flip flops or field-
effect 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 [[email protected]] References: Gaonkar, Hall & Fowler | 5
Instrumentation II Chapter 1: Microprocessor Based Instrumentation System
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
np
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.
u.
Microprocessor is connected with memory and I/O devices via common address and data
ed
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.
es
In address decoding method, all devices like memory blocks, I/O units etc. are assigned
ot
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
en
( ). If the microprocessor has to write or to read from a device, the
block should be enabled and the address decoding circuit must ensure that
other devices are not activated.
signal to that
signal to
io
Depending upon the no. of address lines used to generate chip select signal for the device,
m
and upper bits A8-A15 are considered don’t care. Usually I/O mapped I/O is used to
de
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
nl
bytes . Usually memory mapped I/O is used to map memories like RAM, ROM etc.
ow
Depending on the address that are allocated to the device the address decoding are
categorized in the following two groups.
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Fowler | 6
Instrumentation II Chapter 1: Microprocessor Based Instrumentation System
np
u.
. ed
es
ot
If A0 is high and A1- A7 are low and if
en
becomes low, the latch gets enabled.
io
The data to the LED can be transferred in only one case and hence the device has unique
address of 01H.
m
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Fowler | 7
Instrumentation II Chapter 1: Microprocessor Based Instrumentation System
np
u.
. ed
es
ot
- 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.
A memory chip requires a chip select ( ) signal to enable the chip. The
fro
Example: Design an address decoding circuit for two RAM chips each of 4K X 8 at address
2050H.
Step 1: Calculate the number of address pins
oa
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.
nl
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Fowler | 8
Instrumentation II Chapter 1: Microprocessor Based Instrumentation System
Memory Address A A A A A A A A A A A A A A A A
Block 1 1 1 1 1 1 9 8 7 6 5 4 3 2 1 0
5 4 3 2 1 0
np
RAM Start:2050H 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0
u.
End:304FH 0 0 1 1 0 0 0 0 0 1 0 0 1 1 1 1
ed
ROM Start:3050H 0 0 1 1 0 0 0 0 0 1 0 1 0 0 0 0
End:404FH 0 1 0 0 0 0 0 0 0 1 0 0 1 1 1 1
.
es
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
ot
base address that is 2050H + FFFH = 304FH.
en
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
io
is 3050H + FFFH = 404FH.
Step 3: Decide decoder pins
m
Here, bit A12 in address lines for RAM1 and RAM2 referring to start address are different, so
fro
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.
d
de
oa
nl
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Fowler | 9
Instrumentation II Chapter 1: Microprocessor Based Instrumentation System
np
u.
. ed
es
ot
en
io
m
fro
d
de
oa
nl
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Fowler | 10
Instrumentation II Chapter 1: Microprocessor Based Instrumentation System
np
u.
. ed
es
ot
en
io
m
fro
1.5.4 Programmed I/O, Interrupt Driven I/O and Direct Memory Access
(DMA)
d
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
oa
pressed.
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
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Fowler | 11
Instrumentation II Chapter 1: Microprocessor Based Instrumentation System
np
u.
. ed
es
ot
en
io
m
fro
d
de
oa
nl
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Fowler | 12
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Chapter – 2
Parallel Interfacing with Microprocessor Based System
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.
np
2.1 Methods of Parallel Data Transfer: Simple Input and Output, Strobe I/O, Single
Handshake I/O, & Double Handshake I/O
u.
Parallel transmission of data is used for short distance where the speed of information transfer is
ed
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.
.
es
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
ot
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
en
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
io
in parallel data transfer such as simple input and output, simple strobe I/O, single handshaking
and double handshaking.
m
Simple I/O
fro
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
d
LED is always there and ready so that data can be sent at any time.
de
oa
This timing waveform illustrates the simple I/O where cross lines represent the time at which a
nl
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.
ow
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 [[email protected]] References: Gaonkar, Hall & Brey | 1
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
and then sends out a strobe signal on another line to indicate that valid data is present on eight
data lines
np
u.
ed
The sending device outputs parallel data on the data lines, and then outputs STB’ signal to
represent the valid data is present.
.
es
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
ot
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
en
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.
io
Consider the tri-state A/D converter:
m
fro
d
de
oa
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.
nl
Strobe signal indicates the time at which data is being activated to transmit.
ow
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.
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 2
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
np
u.
. ed
es
The peripheral outputs some data and send signal to microprocessor to tell “Here is
ot
the data for you”.
Microprocessor detects asserted
en
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”.
io
Microprocessor sends or receives data when peripheral is ready.
m
For data transfers where even more coordination is required between the sending system and the
de
receiving system, a double handshake is used. It can have two transfer schemes.
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
nl
microprocessor reads data, it drops its acknowledgement (ACK) line low and request sending
ow
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 3
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
np
u.
ed
The peripheral asserts its line low to ask microprocessor “Are you ready?”
The microprocessor raises its ACK line high to say “I am ready”.
line low to say “Here is some valid data for
.
Peripheral then sends data and raises its
es
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
Output Handshake (Peripheral from Microprocessor):
en
Microprocessor sends a strobe (STB’) signal and data and peripheral sends acknowledgement
io
(ACK) signal.
2.2 8255 as General Purpose Programmable I/O Device and its interfacing examples
m
The Intel 8255 A is a general purpose programmable I/O device designed for use with Intel
fro
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
d
oa
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
nl
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
ow
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
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 4
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
np
u.
. ed
es
ot
en
io
m
fro
The pin diagram and block diagram of 8255 is given above. It has the following main blocks.
d
The 3-state bidirectional 8-bit buffer is used to interface the 8255A to the system data bus.
oa
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.
nl
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
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 5
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
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
np
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.
u.
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
ed
bus.
The CS’ signal is the master chip select, and A0 and A1 specify one of the I/O ports or the
.
es
control register as given below.
CS’ A1 A0 Selected
ot
0 0 0 Port A
0
0
0
0
1
1
1
0
1
en Port B
Port C
Control Register
io
1 X X 8255A is not
selected
m
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.
d
Each of the control blocks (Group A and Group B) accepts “commands” from the
de
Read/Write control logic, receives control word from the internal data bus and issues the
proper commands to its associated ports.
oa
Control Word
ow
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
D
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 [[email protected]] References: Gaonkar, Hall & Brey | 6
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
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.
np
To communicate with peripherals through 8255, following are the steps are necessary.
Determine the Port addresses of Ports A, B and C and of the control register according to
u.
Chip Select logic and address lines A1 and A0.
Write a control word in control register.
ed
Write I/O instructions to communicate with peripherals through Ports A, B and C.
.
es
ot
en
io
m
fro
d
de
oa
nl
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 7
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Q. Determine the Control word for the following configuration of ports of Intel 8255A
PPI chip.
a. Port A output, mode of port A mode 1, port B output, mode of port B mode 0, port C lower
np
pins as output and remaining pins of port C upper as output.
u.
D7 D6 D5 D4 D3 D2 D1 D0 = A0H
1 0 1 0 0 0 0 0
ed
b. Port A output, mode 0, port B output, mode 0, port C lower output and port C upper input.
.
es
D7 D6 D5 D4 D3 D2 D1 D0 = 88H
1 0 0 0 1 0 0 0
ot
c.
en
Port A input, mode 1, port B output, mode 1, and remaining pins of port C upper input.
d. Port A input mode 1, port B output mode 0, port C lower input and port C upper output.
D7 D6 D5 D4 D3 D2 D1 D0 = B1H
d
1 0 1 1 0 0 0 1
de
e. Port A bidirectional (Mode 2), port B input mode 0, port C lower output.
oa
Operating Modes
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 [[email protected]] References: Gaonkar, Hall & Brey | 8
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
np
16 different input/output configurations are possible in this mode.
u.
BSR Mode (Bit Set/Reset)
ed
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
.
es
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.
ot
BSR Control Word: This control word, when written in control register, sets or resets one
bit at a time, as specified in figure.
en
io
m
fro
d
de
oa
nl
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 9
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Q. Determine the BSR Control word for the following Port C configurations.
a. Set PC7
np
To set PC7
u.
D7 D6 D5 D4 D3 D2 D1 D0 = 0FH [Normally don’t care (X) = 0]
0 X X X 1 1 1 1
ed
b. Reset PC3
.
es
D7 D6 D5 D4 D3 D2 D1 D0 = 06H [Normally don’t care (X) = 0]
0 X X X 0 1 1 0
ot
Mode 1 (Strobe Input/output)
en
The functional configuration provides a means for transferring I/O data to or from a specified
io
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.
m
The 4-bit port is used for control and status of the 8-bit data port.
de
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
nl
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 [[email protected]] 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)
np
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
u.
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
ed
changed by writing a single mode word onto the control register, when required.
.
Modes for Group A and Group B can be separately defined with Port C taking on responsibilities
es
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.
ot
en
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
io
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
m
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
fro
operation in Mode 2.
d
The eight possible combinations of the states of bits D1 -D3 (B2 B1 B0) in the Bit Set-Reset
de
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
oa
have to be loaded into the control register will be, 0XXX001 and 0XXX1110, respectively,
where X can be either '0' or '1'.
nl
The BSR, word can also be used for enabling or disabling interrupt signals generated by Port C
ow
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.
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 11
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
np
are to be configured as Input or Output.
Example 1
u.
a) Identify the port addresses in given figure.
ed
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.
.
es
ot
en
io
m
fro
Solution
a) This is I/O mapped I/O; when A15 A14 A13 is 011, then chip select of 8255 is enabled. We
d
also know that during the execution of IN and OUT instruction, A15-A8 and AD7-AD0 carry
de
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
oa
0 1 1 X X X X X = X X X X X X 0 0
nl
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
ow
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
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 12
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
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:
np
D7 D6 D5 D4 D3 D2 D1 D0 = 90H
1 0 0 1 X 0 0 X
u.
c) Program subroutine to read DIP switches and display the reading from port A at port B is as
under:
ed
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
es
OUT 61H; Display the reading at port B
RET
ot
Programming on BSR Mode
en
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
io
/ 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
m
Example 2
Write a BSR control word to set PC7, PC6, PC5, PC4, PC3, PC2, PC1, and PC0 and reset each after
1 second.
d
de
oa
nl
ow
D
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:
np
Word
Set PC7 0 0 0 0 1 1 1 1 0FH
u.
Reset PC7 0 0 0 0 1 1 1 0 0EH
Set PC6 0 0 0 0 1 1 0 1 0DH
ed
Reset PC6 0 0 0 0 1 1 0 0 0CH
Set PC5 0 0 0 0 1 0 1 1 0BH
.
es
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
ot
Set PC3 0 0 0 0 0 1 1 1 07H
Reset PC3
Set PC2
0
0
0
0
0
0
0
0
0
0
1
1
1
0 en 0
1
06H
05H
io
Reset PC2 0 0 0 0 0 1 0 0 04H
Set PC1 0 0 0 0 0 0 1 1 03H
m
Program Subroutine
d
MVI A, 80H
de
OUT 63H
CALL DELAY
DCR A
nl
ANI 0FH
ow
JMP LOOP
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 14
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
LOOP2: DCR E
JNZ LOOP2
DCR D
JNZ LOOP1
DCR C
np
JNZ LOOP
RET
u.
Programming in Mode 1 (Strobe I/O Mode)
ed
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
.
es
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
ot
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
en
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.
io
Mode 1 Input
Below figure shows Port A as input port (when it operates in Mode 1) along with the control
m
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
fro
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
d
data by making IBFA (Input Buffer Full) high. IBFA is set when the STBA input is made low.
de
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
oa
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,
nl
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.
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 15
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
np
u.
. ed
es
ot
en
io
m
fro
d
de
oa
nl
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 16
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
np
u.
. ed
es
Fig: Timing Waveforms for Strobed Input (With Handshake) – 8255 Mode 1
ot
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.
en
io
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
m
often called Program Controlled I/O. The status word is accessed by reading Port C (A1 A0 must
fro
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.
d
STB’ (Strobe Input): A low on this input loads data into the input latch. The 8255A, in
response to STB’, generates IBF and INTR.
oa
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.
nl
INTR (Interrupt Request): This is an output signal that may be used to interrupt the CPU. This
ow
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.
D
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 [[email protected]] References: Gaonkar, Hall & Brey | 17
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
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
np
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
u.
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
ed
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.
es
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
ot
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
en
enabled or disabled by writing a '1' or a '0' respectively to PC6 in the BSR mode.
io
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
m
assumed by the bits of Port C when Ports A and B are Output ports in Mode 1 is shown in Figure
fro
below.
d
de
oa
nl
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 18
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
np
u.
. ed
es
ot
en
io
m
fro
d
de
oa
nl
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 19
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
np
u.
ed
Fig: Timing Waveform for Strobed (With Handshake) Output - 8255 Mode 1
.
es
Mode 1 Output Control Signals
ot
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.
en
ACK’ (Acknowledgement Input): A low on this input informs the 8255A that the data from
io
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.
m
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
fro
Example 3
Below mentioned figure shows an interfacing circuit using the 8255A in Mode 1. Port A is
oa
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.
nl
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 20
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
np
u.
. ed
es
ot
en
io
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
m
1111 11XX:
Port A = 1111 1100 (FCH)
fro
b) Control word to set up port A as input and port B as output Mode 1 is:
de
D7 D6 D5 D4 D3 D2 D1 D0 = B4H
oa
1 0 1 1 X 1 0 X
c) BSR word to set INTEA
nl
D7 D6 D5 D4 D3 D2 D1 D0 = 09H
ow
0 0 0 0 1 0 0 1
d) Status word to check OBFB’
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 21
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
np
OUT FFH ; Using BSR Mode
EI ; Enable Interrupt
u.
CALL READ ; Read Character
CALL PRINT ; Display Character
ed
HLT ; Terminate Program
READ: ; Keyboard Read Subroutine
IN FEH ; Read Port C
.
es
ANI 20H ; Check IBFA (PC5)
JZ READ
ot
IN FCH ; Read ASCII code of character
MOV C, A ; Save Character
PRINT:
RET
en
io
IN FEH ; Read port C
ANI 02H ; Check OBFB’ (D1)
JZ PRINT
m
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
oa
handshaking).
Figure below shows the control word that would have to be loaded into the control port to
nl
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
ow
(PC3) line.
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 22
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
np
u.
. ed
es
ot
en
io
m
fro
d
de
oa
nl
ow
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 23
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
np
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
u.
in tri-state until enabled.
INTE 1
ed
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.
.
es
Input Control Signals
STB (Strobe Input)
ot
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)
en
This is an active high output which indicates that data has been loaded into the input latch of Port
A.
io
INTE 2
This is an Interrupt enable flip-flop associated with Input Buffer Full. It can be controlled by
m
bits D2 – D0 depend on the mode setting of Group B. If B is programmed in Mode 0, D2–D0 carry
de
information about the control signals for B, depending upon whether B is an Input port or Output
port respectively.
oa
Assignment 1:
Interfacing keyboard and seven segment display
Interfacing a microprocessor to a tape reader and lathe
nl
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 [[email protected]] References: Gaonkar, Hall & Brey | 24
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
np
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.
u.
8-bit ISA bus Architecture
ed
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.
.
es
ISA bus connector contains:
o 20 bit address bus (A19-A0)
o 8 bit data bus
ot
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’
en
io
o Clock signals
o Power lines and Reset
m
fro
d
de
oa
nl
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 25
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
np
u.
. ed
es
ot
en
io
m
fro
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 26
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
np
u.
. ed
es
ot
en
Fig: The 16-bit ISA bus. (a) Both 8- and 16-bit connectors and (b) the pinout of the 16-bit
io
connector.
be used.
Since address lines of 24 bits, a maximum of 224=16 MB of RAM can only be accessed
for DMA.
d
Since data bus size is 16 bits only, higher bits data (32-bits) communication would reduce
system performance.
de
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
oa
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 27
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
np
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
u.
device sends more than one signal over a single pin
Also, PCI supports devices that use 5v signalling voltage levels
ed
PCI card support plug and play (PnP) feature i.e. PCI devices are automatically
recognized and configured to work in system.
.
es
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
ot
en
io
m
fro
d
de
oa
nl
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 28
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
np
u.
. ed
es
ot
en
io
m
fro
d
de
oa
nl
ow
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 29
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
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)
np
Weight measurement (1 point)
Volume measurement for filling (5 points)
Your group also decided to use 8255A PPI card at base address 0550H.
u.
a) List out collected documents and components
b) List out different signals you need to derive and or can be directly connected to your
ed
interfacing circuit.
c) Draw minimum mapping circuit for above system
d) What are the address captured by card
.
es
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.
ot
Solution:
D0 8 Bit Vin
A15 ADC
de
. PC7 EOC
. CS PC0 SC
.
oa
A2 8255A
A1 PPI
nl
A0
Select Line
ow
RD PB4 32X1
WR PB0 MUX
……
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 30
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
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 A A A
1 1 1 1 1 1 9 8 7 6 5 4 3 2 1 0
5 4 3 2 1 0
A 0550H 0 0 0 0 0 1 0 1 0 1 0 1 0 0 0 0
B 0551H 0 0 0 0 0 1 0 1 0 1 0 1 0 0 0 1
np
C 0552H 0 0 0 0 0 1 0 1 0 1 0 1 0 0 1 0
CR 0553H 0 0 0 0 0 1 0 1 0 1 0 1 0 0 1 1
u.
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
ed
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
es
Port C Output port (PC0 as SC) and Input port (PC7 as EOC)
ot
e) Control word and BSR words:
Control word to set up port ports in above configuration:
D7
1
D6
0
D5
0
D4
1
D3
1
D2
0
D1
0
en
D0
0
= 98H
io
BSR word to set PC0
m
D7 D6 D5 D4 D3 D2 D1 D0 = 01H
0 0 0 0 0 0 0 1
fro
D7 D6 D5 D4 D3 D2 D1 D0 = 00H
d
0 0 0 0 0 0 0 0
de
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
oa
data in its data lines which can be now be read through port A.
f) Program Module:
nl
LXI H, MEMORY
MVI A, 98H
ow
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 [[email protected]] References: Gaonkar, Hall & Brey | 31
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
np
JNC READ; check for PC7
LDA 0550H; read data from port A
MOV M, A; store value in memory
u.
CPI MAX_VALUE; compare with maximum value
JNC CONTROL; control value
ed
CPI MIN_VALUE; compare with minimum value
JC CONTROL; control value
INR B
.
INX H
es
DCR C
JNZ NEXT
ot
2. Interfacing keyboard and seven-segment display.
(Refer Gaonkar 15.2 pages 480-487)
3. Interfacing Lathe machine and tape reader.
(Refer Hall)
en
io
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
m
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
fro
Load temperature from temperature sensor LM135 and control fan and heater.
If temperature > 35o Fan ON
d
6. You are required to monitor the operation of pump as well as status of upper and lower tank
oa
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
nl
necessary.
Your group also decided to use 8255 PPI card at base address 3000H in memory mapped I/O
ow
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
D
exceeds.
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Brey | 32
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
Chapter -3
np
3.2 Synchronous and Asynchronous Data Transfer
3.3 Errors in Serial Data Transfer
3.4 Simplex, Half Duplex and Full Duplex Data Communication
u.
3.5 Parity and Baud Rates
3.6 Introduction Serial Standards RS232, RS423, RS422
ed
3.7 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
es
3.7.4 Interface Chips: USB Device and USB Host
ot
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
en
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
io
buses.
0 +3V to +25V
o Parallel; 1 +5V
0 0V
o Voltage loss is not much a problem in serial communication.
d
Serial transmission requires less number of wires than parallel and so cheaper to transmit
de
data.
Crosstalk is less of an issue because there are fewer conductors’ compared to that of
parallel cables.
oa
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.
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Hyde | 1
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
np
u.
ed
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
es
transmission. Serial data can be sent synchronously or asynchronously.
ot
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
en
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
io
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.
m
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
fro
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
d
following the SYNC characters and converts them to parallel form so they can be read in by a
de
computer.
oa
nl
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Hyde | 2
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
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
np
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
u.
computers are communicating to each other at a high speed or a buffered terminal is
communicating to the computer.
ed
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
es
communication channel.
The disadvantage includes the possible in accuracy. Because when a receiver goes out of
ot
Synchronization, loosing tracks of where individual characters begin and end. Correction of
errors takes additional time.
bit. The data bits are then sent out on the line one after the other where the least significant bit is
de
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.
oa
nl
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Hyde | 3
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
np
u.
. ed
In asynchronous transmission each character is transmitted separately, that is one character at a
es
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
ot
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
The START bit and STOP bit including gaps allow the receiving and sending computers to
io
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
m
require the complex and costly hardware equipments as is required for synchronous
transmission.
fro
4. Framing Start and stop bits are sent SYNC characters are sent
Information with each character. with each character.
5. Implementation Hardware / Software Hardware
nl
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
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Hyde | 4
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
np
Transmitting SDU
The interface chip has a transmitter hold register for transmitting data which first fetches
the data bytes from CPU.
u.
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
ed
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
es
output (LSB first). If no data, then the chip possesses a logical high level.
ot
Interface Control & Baud
rate Generator
Transmitter Transmitter
en
io
Bus SDU
Interfac e Hold Shift
Logic D7 D6 D5 D4 D3 D2 D1 D0
Register Register
Stop Parity Data Bits Start
m
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.
oa
nl
Interfac e Logic D0 D1 D2 D3 D4 D5 D6 D7
Register Register
Start Data Bits Parity Stop
np
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.
u.
2. Break Error
If the reception line is at logic low level for longer time than the SDU usually lasts, then
ed
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;
es
the latter received byte overwrites the older data in the buffer.
4. Parity Error
ot
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
en
io
Mark parity
Space parity
m
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
d
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
de
practice; they are parity check, checksum and cyclic redundancy check.
Parity Check
oa
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
nl
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
D
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 [[email protected]] 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.
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
np
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.
u.
Cyclic Redundancy Check (CRC)
This technique is based on mathematical relationships of polynomials. A stream of data can be
ed
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.
es
ot
Baud Rate / Bit Rate
The difference between Bit and Baud rate is complicated and intertwining. Both are dependent
and inter-related.
en
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.
io
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
m
letters or numbers) that are also referred to as bytes are composed of several bits.
fro
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
d
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:
oa
= 300 mbd
ow
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.
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Hyde | 7
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
np
primarily to receive information, such as printers must be able to communicate
acknowledgement signals back to the sender devices.
System A System B
u.
Unidirectional
Transmitter Receiver
ed
Fig: Simplex mode
.
es
Half Duplex Mode
It is a two way communication between two ports provided that only party can communicate at a
ot
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
en
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
io
acknowledge an interruption.
System A System B
m
Transmitter/Rec Transmitter/Rec
OR
eiver eiver
fro
It provides simultaneous two way transmission without the intervening stop-and-wait aspect of
de
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
oa
Transmitter/Rec Transmitter/Rec
eiver OR/AND eiver
ow
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Hyde | 8
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
np
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.
u.
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
ed
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
es
this section.
ot
RS-232C
Serial transmission of data is used as an efficient means for transmitting digital information
en
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
io
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).
m
RS- 232C is the interface standard developed by electronic industries Association (EIA) in
fro
response to the need for the signal and handshake standards between the DTE and DCE. RS-
232C has following standardize features.
- It uses 25 pins (DB – 25P) or 9 Pins (DE – 9P) standard where 9 pins standard does not
d
- 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.
oa
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Hyde | 9
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
np
u.
ed
- Mc1488 line driver converts logic 1 to -9V
Logic 0 to +9v
.
es
- 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.
ot
RS- 232 signals used in handshaking:
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
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Hyde | 10
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
np
indicate that it has established connection with the computer.
u.
When the modem is fully ready to receive data, it asserts the clear-to-send (CTS’) signal
back to the terminal.
ed
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
es
if DTR is not active.
ot
Transmitted Data (TxD):
The terminal then sends serial data characters to the modem.
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.
d
de
oa
nl
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Hyde | 11
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
np
- 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.
u.
- To communicate from serial port of a computer to serial port of another computer without
modem, null-modem is used.
ed
Simplex, Half Duplex and Full Duplex Operation Using RS-232 port
.
es
Simplex Connection for RS-232C
There are two possibilities; data transfer from DTE to DCE or vice versa.
ot
From DTE to DCE
The DTE transfers data to the DCE via the TxD line. The RxD line is not connected. The DCE
en
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
io
disable DCE. RI signal has no meaning because normally transmitter calls receiver.
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
fro
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
d
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
nl
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
ow
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 [[email protected]] References: Gaonkar, Hall & Hyde | 12
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
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
np
receiver and transmitter i.e. we may keep RTS signal active all time ignoring CTS and DSR
signals.
u.
Null (Zero) Modem Connection
ed
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
es
are connected to outputs and inputs are connected to inputs. With this convention, no data
transfer is possible.
ot
For the transmission of data, it is required to twist the TxD and RxD lines. In this way, the
en
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
io
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.
m
fro
d
de
oa
nl
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Hyde | 13
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
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
np
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
u.
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,
ed
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
es
with serial interface provide such a buffer full signal at pin 19.
ot
en
io
m
fro
d
de
oa
RS-423A
A major problem with RS-232C is that it can only transmit data reliably for about 50 ft at its
nl
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
ow
- Voltage levels
o Logic High 4V - 6V negative
o Logic Low 4V - 6V positive
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Hyde | 14
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
- 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.
np
u.
. ed
es
RS-422A
It is a newer standard for serial data transfer. It specifies that each signal will be sent
ot
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
en
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
io
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.
m
fro
d
de
oa
- The voltage difference between the two lines must be greater than 0.4V but less than
ow
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.
D
- 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 [[email protected]] References: Gaonkar, Hall & Hyde | 15
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
np
2. Distance 50 ft 4000 ft 4000 ft
3. Logic 0 +3 V to +25 V +4 V to +6 V B line > A line
4. Logic 1 -3 V to -25 V -4 V to –6 V A line > B line
u.
5. Receiver Input ±15V ±12V ±7V
Voltage
ed
6. Mode of Single ended Differential Differential
Operation input and output input and single input and output
ended output
.
es
7. Noise Immunity 2.0 V 3.4 V 1.8 V
8. Input Impedance 3-7 KOhm and >4 KOhm >4 KOhm
2500 pf
ot
9. Short circuit 500 mA 150 mA 150 mA
current
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,
d
mass storage devices, telephones, modems, digital still-image cameras, video cameras,
audio devices to a computer. USB devices do not directly consume system resources.
de
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
oa
and parallel ports, as well as separate power chargers for portable devices.
ow
Features of USB
Single connector type: USB replaces all the different legacy connectors with one well-
defined, standardized USB connector for all USB peripheral devices, eliminating the need
D
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.
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Hyde | 16
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
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.
np
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.
u.
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
ed
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
es
system automatically recognizes the USB device attachment and loads appropriate device
drivers.
ot
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: en
– Suitable for device bandwidths ranging from a few kb/s to several Mb/s
io
– Supports isochronous as well as asynchronous transfer types over the same set of
wires
– Supports concurrent operation of many devices (multiple connections)
m
devices
– Allows compound devices (i.e., peripherals composed of many functions)
– Lower protocol overhead, resulting in high bus utilization
• Isochronous bandwidth
d
– Guaranteed bandwidth and low latencies appropriate for telephony, audio, etc.
de
USB Standards
USB 1.0
ow
Compiled By: Er. Hari Aryal [[email protected]] 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.
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.
np
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).
u.
USB 3.0
ed
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
.
es
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
ot
Gbit/s) than Hi-Speed USB (USB 2.0), SuperSpeed USB is the next step in the continued
evolution of USB technology.
en
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
io
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
m
Wireless USB
oa
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
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
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Hyde | 18
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
• 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.
np
u.
ed
Fig: 'A' Plug, 'B' Plug and 'Mini-B' Plug
.
es
Signals
ot
en
io
Pin Color Name Description
1 Red Vcc +5V dc
m
2 White D- Data-
fro
3 Green D+ Data+
4 Black GND Ground
d
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Hyde | 19
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
np
Data J State:
Low-speed Differential '0'
Full-speed Differential '1'
u.
Data K State:
ed
Low-speed Differential '1'
Full-speed Differential '0'
Idle State:
.
Low-speed D- high, D+- low
es
Full-speed D+ high, D- low
Resume State Data K state
ot
Data lines switch from idle to K
Start of Packet (SOP)
state
End of Packet (EOP)
Disconnect
en SE0 for 2 bit times followed by J
state for 1 bit time
SE0 for >= 2us
io
Connect Idle for 2.5us
Reset SE0 for >= 2.5 us
m
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.
d
The Single Ended Zero (SE0) is when both lines are being pulled low.
de
The J and K terms are used because for Full Speed and Low Speed links they are actually of
opposite polarity.
oa
Reset
ow
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
D
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 [[email protected]] 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.
Suspend
One of the features of USB which is an essential part of today's emphasis of 'green' products is
np
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
u.
every 1 ms, and this is what keeps the device awake.
A suspended device may draw no more than 0.5 mA from Vbus.
ed
A suspended device must recognise the resume signal, and also the reset signal.
Resume
.
When the host wants to wake the device up after a suspend, it does so by reversing the polarity of
es
the signal on the data lines for at least 20ms. The signal is completed with a low speed end of
packet signal.
ot
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
en
between 1 and 15 ms. The host takes over the driving of the resume signal within 1 ms.
Throughput
fro
• 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
d
– Types of data
oa
nl
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Hyde | 21
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
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.
np
u.
. ed
es
ot
en
io
m
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Hyde | 22
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
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.
np
Each USB transaction consists of a
Token Packet (Header defining what it expects to follow), an
Optional Data Packet, (Containing the payload) and a
u.
Status Packet (Used to acknowledge transactions and to provide a means of error
correction)
ed
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
es
handshaking packet, reporting if the data or token was received successfully, or if the endpoint is
stalled or not available to accept data.
ot
Common USB Packet Fields
en
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
io
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.
m
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.
fro
• ADDR: The address field specifies which device the packet is designated for. Being 7
d
bits in length allows for 127 devices to be supported. Address 0 is not valid, as any
de
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.
oa
(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.
nl
• EOP: End of packet. Signalled by a Single Ended Zero (SE0) for approximately 2 bit
times followed by a J for 1 bit time.
ow
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 [[email protected]] References: Gaonkar, Hall & Hyde | 23
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
np
Sync PID ADDR ENDP CRC5 EOP
• Data Packets: There are two types of data packets each capable of transmitting up to
u.
1024 bytes of data.
o Data0
ed
o Data1
High Speed mode defines another two data PIDs, DATA2 and MDATA.
Data packets have the following format,
.
es
Sync PID Data CRC16 EOP
o Maximum data payload size for low-speed devices is 8 bytes.
ot
o Maximum data payload size for full-speed devices is 1023 bytes.
o Maximum data payload size for high-speed devices is 1024 bytes.
•
o
en
Data must be sent in multiples of bytes.
Status / Handshake Packets: There are three type of handshake packets which consist
io
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
m
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.
oa
Transfer Model
Endpoints
ow
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
D
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 [[email protected]] References: Gaonkar, Hall & Hyde | 24
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
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.
np
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
u.
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
ed
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
es
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
ot
interrupt transfer types. Stream pipes can either be controlled by the host or device.
en
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
io
only support control transfers.
• Control Transfers:
– typically used for short, simple commands to the device, and a status response,
fro
in one big packet, uses the bulk transfer mode. A block of data is sent to the
de
mouse or a keyboard, which will be sending very little data, would choose the
interrupt mode.
• Isochronous Data Transfers:
nl
– 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
ow
mode. Data streams between the device and the host in real-time, and there is no
error correction.
D
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Hyde | 25
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
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
np
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
u.
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
ed
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.
es
ot
en
io
m
fro
Hub
de
• 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
oa
• 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.
ow
Un-powered Hub
• Un-powered hubs can be used with any number of high-power devices such as printers
D
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 [[email protected]] References: Gaonkar, Hall & Hyde | 26
Instrumentation II Chapter 3: Serial Interfacing With Microprocessor Based System
np
• 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
u.
• The ability to be either host or peripheral (dual role devices) and to dynamically switch
between the two.
ed
• 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,
es
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
ot
magic of OTG is that a host and peripheral can exchange roles if necessary.
• 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.
np
• 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
u.
active at a time.
• A configuration defines the attribute and features of a specific model.
. ed
es
ot
en
io
m
fro
Compiled By: Er. Hari Aryal [[email protected]] References: Gaonkar, Hall & Hyde | 28
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
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
np
4.4 Selection of A/D and D/A converter based on Design Requirements
4.1 Introduction
u.
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
ed
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
es
(Digital to Analog Converter).
ot
Analog to Digital Converter
The A/D converter is a quantizing process whereby an analog signal is represented by equivalent
en
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
io
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
m
integrator and voltage to frequency converters. The flash type is expensive and difficult to design
for high accuracy.
Fig. 4.1.a shows a block diagram of a 3-bit A/D converter, it has one input line for an analog
d
signal and three output lines for digital signals. Fig. 4.1.b shows the graph of the analog input
de
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.
oa
D0
nl
A/D
Analog D1
Input Converter
ow
D2
(a)
D
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 1
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
np
u.
. ed
es
ot
Fig. 4.1: a) A 3-bit ADC block diagram en
(b)
b) Analog input versus digital output
io
Parameters (Characteristics) of ADC
Resolution
m
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
fro
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
d
The A/D conversion another critical parameter is conversion time. This is defined as the
de
total time required converting an analog signal into its digital output.
Accuracy
It is the comparison of the actual output and the expected output.
oa
Linearity
The output should be the linear function of input.
Full scale output value
nl
Types of ADC
1. Successive Approximation A/D Converter
It is one of the most used ADC.
D
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 [[email protected]] References: R. Gaonkar & D.V. Hall | 2
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
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.
Comparator
np
VIN +
Analog Input Start
Control Status
u.
_ Data
Ready
ed
CLK
VO Successive
.
4-Bit D/A
Approximation
es
Converter
Register
ot
Analog Output
Reference Register
en
D3 D2 D1 D0
io
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
m
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
fro
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
de
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
nl
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.
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 3
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
Comparator
V+ + AND Gate
Analog Input
8-Bit Counter
V- _ Q7Q6Q5Q4Q3Q2Q1Q0
np
Digital
Clock
u.
Output
DAC Output
ed
D7D6D5D4D3D2D1D0
.
Fig. 4.3: Block diagram of an 8-bit counter type ADC
es
3. Parallel Comparator ADC (Flash Type ADC)
The Flash Type ADC (Simultaneous ADC) is the fastest ADC that utilizes comparators
ot
that compares reference voltage with input analog voltage.
A priority encoder is used to convert the output of comparator into digital output.
en
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.
io
VRef = 4V
10 Ω
m
+ A3
_
fro
3V
10 Ω D1
Analog Input
VIN + A2 Priority Binary Code
d
_ Encoder Output
2V
10 Ω
de
D0
+ A1
_
oa
1V
10 Ω
nl
Advantages: Very Fast, Clocks not required. Disadvantages: Expensive, Consume high power,
Complexity doubles for each additional bit.
D
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 [[email protected]] References: R. Gaonkar & D.V. Hall | 4
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
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
np
1 ≤ VIN ≤ 2 0 0 1 0 1
2 ≤ VIN ≤ 3 0 1 1 1 0
3 ≤ VIN ≤ 4 1 1 1 1 1
u.
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
ed
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.
.
es
4. Ramp ADC / Dual slope ramp ADC
Conversion from analog to digital form inherently involves comparator action where the value of
ot
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
en
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
io
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.
m
fro
d
de
oa
nl
ow
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 5
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
np
u.
ed
Fig. 4.5 (b): Dual Slope Ramp ADC
Operation:
.
First of all capacitor is reset (i.e. Vo is made zero)
es
For positive Vin we need negative Vref.
During time T1, the capacitor is charged by the Vin for fixed time interval which is
ot
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
en
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.
io
m
fro
d
de
5. Integrator ADC
oa
nl
ow
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 [[email protected]] References: R. Gaonkar & D.V. Hall | 6
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
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
np
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.
u.
Q. Calculate the maximum conversion time of a successive approximation ADC and an 8-bit
ed
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 106 s 4s
.
f 2 106
es
For a 8-bit staircase ramp ADC, the maximum number of count is
nc = 28 = 256
ot
Therefore, the maximum conversion time is
n 256
Tc c 128 106 s 128s
f 2 10 6
en
It can be noted that the conversion speed of successive approximation ADC is much
io
faster than the staircase ramp type.
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 7
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
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.
np
The START pulse initiates conversion.
When the conversion is complete, the DR goes low and data are made available on the
u.
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
ed
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
.
es
flowchart are shown below.
ot
OUT 82H; Start conversion
Test: en
IN 80H; Read data ready status
RAR; Rotate D0 into carry
io
m
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 8
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
np
u.
. ed
es
ot
en
io
Fig: Interfacing ADC 0801 using Interrupt
In ADC interfacing using status check, we need external ports to access data and monitor
m
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
fro
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
d
respectively.
The frequency is calculated by using the formula F = 1 / 1.1 RC.
de
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
ow
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
D
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 9
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
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.
np
u.
. ed
es
Fig: Timing diagram for Reading Data from ADC
ot
Service Routine:
LDA 8000H; Read data
MOV M, A ; store data in memory
INX H;
DCR B;
Next memory location
Next count
en
io
STA 8000H; start next conversion
EI; Enable interrupt again
RNZ; Go back to main if counter not equal to zero
m
HLT
fro
The result of sampling process is identical to multiplying the analog signal by a train of pulses of
de
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.
oa
nl
ow
D
Compiled By: Er. Hari Aryal [[email protected]] 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
Quantization
np
It is the process of converting an input function having continuous values to an output having
only discrete values.
u.
Binary Coding
It is the method of assigning a binary equivalent number to each discrete level.
. ed
es
ot
en
io
m
fro
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
d
analog signal. The rate of new values is called the Sampling Rate or Sampling Frequency of the
de
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
oa
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.
nl
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
ow
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
D
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 11
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
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
np
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.
u.
Dither:
ed
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
es
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
ot
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.
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.
fro
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.
d
de
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
oa
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:
nl
ow
The signal x(t) is said to be band limited to a one-sided baseband bandwidth, B, if:
for all
D
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 [[email protected]] References: R. Gaonkar & D.V. Hall | 12
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
or equivalently:
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.
np
The time interval between successive samples is referred to as the sampling interval:
u.
and the samples of x(t) are denoted by:
ed
(integers).
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.
es
What happens if we sample the signal at a frequency that is lower that the Nyquist rate? When
ot
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.
en
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"
io
around half the sampling frequency - which is why this frequency is often referred to as the
folding frequency.
m
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
fro
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.
d
de
oa
nl
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 13
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
np
MSB
u.
Digital D2 D/A Analog
Input D1 Converter Output
ed
D0
LSB
.
es
(a)
FS
ot
A 7/8
n
a 3/4
l
en
io
o 5/8
g LSB
m
1/2
O
fro
u 3/8
t
p 1/4
u
d
t 1/8
de
Digital Input
nl
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
D
= 1/2 V.
Compiled By: Er. Hari Aryal [[email protected]] 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.
np
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.
u.
Full scale output voltage
The maximum output voltage of a converter (when all input are 1) will always have a
ed
value 1 LSB less than the named value.
Accuracy
.
es
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
ot
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
en
io
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
m
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
fro
line output.
Settling time
d
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
de
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.
oa
Monotonicity
nl
A converter is said to be monotonic if its output voltage value continuous to increase with
a continuously increasing input value.
ow
Temperature Coefficient
It is defined as the degree of inaccuracy that the temperature change can cause in any of
the parameter of the DAC.
D
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 15
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
Types of DAC:
np
u.
. ed
es
Fig: DAC with Binary Weighted Resistor Network
ot
WRN DAC circuit consists of
Reference voltage VRef
N Binary weighted resistors R, 2R, 4R,…. 2N-1R
en
Single Pole Double Throw (SPDT) Switches S0, S1, S2…. SN-1
Op Amp with feedback resistance RF=R/2
io
Switches controlled N-bit digital input word
m
fro
d
de
oa
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 16
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
np
u.
. ed
es
ot
Fig: R-2R Ladder (Voltage Mode)
en
io
m
fro
d
de
oa
nl
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 17
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
np
u.
. ed
es
ot
Fig: Interfacing 1408 DAC in Unipolar Range en
io
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
m
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
fro
Output voltage,
ow
VO = IO * RF
= 2mA (255/256) * 5K
= 9.961V
D
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 18
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
np
u.
ed
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.
es
Q. Explain the operation of the 1408 which is calibrated for a bipolar range ±5V. Calculate
ot
output voltage VO if the input is 100000002.
en
io
m
fro
d
de
oa
The 1408 is calibrated for the bipolar range from -5V to +5V by adding the resistor RB (5.0K)
nl
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.
ow
= (IO – VRef/RB) RF
= (0 – 5V/5K) 5K
= -5V
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 19
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
np
= 0V
Microprocessor Compatible DAC
In response to the growing need for interfacing DAC with the microprocessor, specially designed
u.
microprocessor-compatible DAC are available. These DAC generally include a latch on the chip,
thus eliminating the need for an external latch.
. ed
es
ot
en
io
m
fro
Fig: Block Diagram of Analog Device along with latch and output Op-Amp internal to the Chip
d
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
de
Chip Select, which assigns port address 80H (assuming all other address lines 0) to the DAC
port.
oa
nl
ow
D
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.
np
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
u.
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.
. ed
es
ot
en
io
m
fro
d
de
oa
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
ow
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
D
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 [[email protected]] References: R. Gaonkar & D.V. Hall | 21
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
np
u.
ed
Fig: Timing Diagram
The following instructions illustrate how to load the maximum input of 10-bits all 1’s
into the DAC.
.
es
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
ot
INX H; Point to port address 8001H
MOV M, B; Load two bits D9 and D8 and switch all ten bits for conversion
HLT
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 22
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
np
• Codes Used
• Cost
u.
Errors in ADC and DAC
1. Dynamic Errors
ed
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.
.
es
B. Delay Time
It is the time interval between the instant when the digital input changes and the instant when
ot
the analog output passes a specified value that is close to its initial value.
C. Settling Time
en
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
io
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.
m
fro
A
n
a
d
O
oa
u
t
p
nl
u
t
ow
Digital Input
Settling Time (TS)
Time that digital Time of last entry
D
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 23
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
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%
np
Actual Output
FS Ideal Output
u.
A 7/8
n
a 3/4
ed
l
o 5/8
g
1/2
.
O
es
u 3/8
t
p 1/4
ot
u
t 1/8
B. Monotonicity
In a D/A converter; means that as the digital input to the converter increases over its full scale
fro
range, the analog output never exhibit a decrease between one conversion step and next.
A FS Ideal Output
n
a 7/8
d
l Actual Output
de
o
3/4
g
5/8
O
oa
u 1/2
t
p 3/8
u
nl
t
1/4
ow
1/8
Digital Input
Point of Non-Monotonic Output
Compiled By: Er. Hari Aryal [[email protected]] 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 Actual Output
np
a 7/8
l
o Expected Output
3/4
u.
g Integral
Linearity Error
5/8
ed
O
u 1/2
t
.
es
p 3/8
u
t
1/4
ot
1/8
en
io
000 001 010 011 100 101 110 111
Digital Input
m
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
d
It is the difference between the actual output and zero when the digital word for a zero
de
output is applied.
b. Full Scale Error
It is the difference between the actual and the ideal voltage when the digital word for a
oa
characteristics.
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 25
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
A FS Expected Output
n
a 7/8
l Actual Output
o
3/4
g
np
5/8
O
u 1/2
t
u.
p 3/8
u
t
ed
1/4
1/8
.
es
000 001 010 011 100 101 110 111
Digital Input
ot
Fig: Gain error
a 7/8
l
fro
o
3/4
g
5/8
O
d
u 1/2
t
de
p 3/8
u
t
oa
1/4
1/8
nl
Offset Error
000 001 010 011 100 101 110 111
ow
Digital Input
D
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 26
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
np
n
a
l u t } Gain Error
u.
o Outp
d
g
ju ste
ed
Ad ut
utp
O a lO
u Ide
.
es
t
p
u
ot
t
Offset Error
en
Digital Input
io
Fig: Best straight line error
III. End Point Linearity
m
It uses a straight line through the actual end points instead of the ideal points.
fro
A
n
a
d
l
ut
o utp
de
g lO
tua
Ac
oa
O
u
t
nl
p
u
ow
t
D
Digital Input
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 27
Instrumentation II Chapter 4: Interfacing A/D and D/A Converters
Static Dynamic
np
Integral Best Straight Differential Linearity: is Conversion Time: is
u.
Linearity: is Line Linearity: a measure of the the elapsed time
the maximum depicts the separation between between the command
ed
deviation of accuracy of a D/A adjacent levels. to perform a
the output of a in terms of the Differential linearity conversion and the
D/A for any deviation from the measures the bit-to-bit appearance at the
.
es
given input ideal output range deviations from ideal converter output of the
code from a without regard to output steps rather than complete digital
straight line zero or full scale entire output range. If VS representation of the
ot
drawn from its errors. is the ideal change and analog input value.
ideal minimum
to its ideal
maximum.
End Point
Linearity: uses a
straight line
en
VCX is the actual change,
then the differential
linearity can be expressed Delay Time: is the
io
through the actual as: [(VCX-VS)/VS]*100% time interval between
end points instead the instant when the
m
the actual output its full scale range, the its initial value.
Linearity: is
analog output never
de
through these full scale output is Offset Error: it adds a a specified error band
two points. applied. constant value to output. about its final value.
Compiled By: Er. Hari Aryal [[email protected]] 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
Temperature
Humidity EOC
Display
np
Pressure OP Micro 8255
…………..
u.
Select
Parallel
to Serial
ed
Selectors Converter
RS232/RS422/RS423 or
Radio link or Optical Fibre
Display 1
.
Serial to
8255
es
Parallel Display 2
Converter PPI
Recorder
ot
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
en
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
io
A transducer that converts electrical signals into real life non-electrical signals
(sound, pressure, and video)
m
fro
d
de
oa
nl
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 29
Instrumentation II Chapter 5: Data Acquisition and Transmission
Chapter – 5
Data Acquisition and Transmission
5.1 Analog and Digital Transmission
Analog Transmission
• Analog signal transmitted without regard to content
np
• May be analog or digital data
• Attenuated over distance
u.
• Use amplifiers to boost signal
• Also amplifies noise
ed
Digital Transmission
• Concerned with content
.
• Integrity endangered by noise, attenuation etc.
es
• Repeaters used
• Repeater receives signal
• Extracts bit pattern
ot
• Retransmits
• Attenuation is overcome
• Noise is not amplified
• Integration
o Can treat analog and digital data similarly
de
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.
D
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 1
Instrumentation II Chapter 5: Data Acquisition and Transmission
np
Fig: Analog communication system
u.
Presently, all the AM, FM radio transmission and TV transmission is analog communication.
ed
The analog communication needs lower bandwidth compared to digital communication. But the
effect of noise interference is more in case of analog communication.
.
es
Digital Communication System
ot
en
io
m
fro
• Efficiently converting the source into a sequence of binary digits is a process, which is
de
• 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,….
nl
• 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
D
Compiled By: Er. Hari Aryal [[email protected]] 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
np
• 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
u.
Design Factors
ed
• Bandwidth
o Higher bandwidth gives higher data rate
• Transmission impairments
.
o Attenuation
es
• Interference
• Number of receivers
ot
o In guided media
o More receivers (multi-point) introduce more attenuation (need more amplifies or
repeaters)
• 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
fro
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.
d
de
oa
nl
ow
D
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 3
Instrumentation II Chapter 5: Data Acquisition and Transmission
np
Fig: Optical Fiber transmission block diagram
u.
1. Single-mode fibers:
It is used to transmit one signal per fiber (used in telephone and cable TV). They have small
ed
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.
es
Because of it high performance it is used for long distance, very high speed, large bandwidth
applications.
ot
2. Multi-mode fibers:
It is used to transmit many signals per fiber (used in computer networks). They have larger
en
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
io
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
m
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
D
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 [[email protected]] References: R. Gaonkar & D.V. Hall | 4
Instrumentation II Chapter 5: Data Acquisition and Transmission
np
u.
. ed
es
Advantages of Optical Fiber
• Thinner
ot
• Less Expensive
• Higher Carrying Capacity
• Less Signal Degradation& Digital Signals
• Light Signals
• Non-Flammable
en
io
• Light Weight
• Enormous capacity
m
• Electrical isolation
• Signal security
• Silica fibers have abundant raw material
d
de
the body are now visible to the surgeon without actually cutting through the body. Ex.
Endoscopy.
Compiled By: Er. Hari Aryal [[email protected]] 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.
5.2.2 Satellite
np
• 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
u.
• 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
ed
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
es
avoid interference.
• The downlink beam can be broad, covering a substantial fraction of the earth’s surface
ot
(used in broadcasting) or narrow beam covering only a hundreds of km in diameter.
en
io
m
fro
d
de
oa
nl
1. Space Segment
2. Ground Segment
The Space Segment includes
• Satellite
D
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 6
Instrumentation II Chapter 5: Data Acquisition and Transmission
np
• Rear Ward Communication links
• User terminal and interface network
u.
. ed
es
ot
en
io
m
fro
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.
d
• LEO satellites don’t stay in fixed position relative to the surface, and are only visible for
de
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
nl
communication.
o A LEO satellite’s smaller area of coverage is less of a waste of bandwidth.
ow
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
D
movement.
o Atmospheric drag affects LEO satellites, causing gradual orbital deterioration.
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 7
Instrumentation II Chapter 5: Data Acquisition and Transmission
np
• 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
u.
satellites are needed in a MEO network than a LEO network.
Disadvantage
ed
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.
.
3. Geostationary Earth Orbit (GEO)
es
• 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
ot
rotates. This means GEO satellites remain in the same position relative to the surface of
earth.
Advantages
en
o A GEO satellite’s distance from earth gives it a large coverage area, almost a
fourth of the earth’s surface.
io
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.
m
Disadvantages
o A GEO satellite’s distance also cause it to have both a comparatively weak signal
fro
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
Advantages of Satellites
de
coverage area.
• Satellite to Satellite communication is very precise.
• Higher Bandwidths are available for use.
nl
Disadvantages of satellite
• Bandwidth is decreased due to gradually becoming used up
ow
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 8
Instrumentation II Chapter 5: Data Acquisition and Transmission
np
• Mobile Service Satellites (MSS)
o Example: Satellite Phones
u.
Different kinds of satellites use different frequency bands.
• L–Band: 1 to 2 GHz, used by MSS
ed
• 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)
es
• K-Band: 18 to 26.5 GHz: used by FSS and BSS
• Ka-Band: 26.5 to 40 GHz: used by FSS
ot
5.2.3 Bluetooth Devices
Bluetooth
en
• Bluetooth is a global standard Radio Frequency (RF) specification for short-range, point-
to-multipoint voice and data transfer. Bluetooth can transmit through solid, non-metal
io
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.
m
• 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
d
international agreement for the use of industrial, scientific and medical devices (ISM).
de
• 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 [[email protected]] References: R. Gaonkar & D.V. Hall | 9
Instrumentation II Chapter 5: Data Acquisition and Transmission
Bluetooth Connection
np
u.
. ed
es
ot
en
Bluetooth uses the concept of Master/Slave mode of data communication which is packet based.
1. Passive State
io
2. Inquiry; Search of devices
3. Paging; Synchronization
m
Bluetooth Characteristics
oa
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
nl
number of hop channels. During a connection, radio transceivers hop from one channel
to another in a pseudo-random fashion.
ow
Omni-directional.
Supports both isochronous and asynchronous services; easy integration of TCP/IP for
networking.
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 10
Instrumentation II Chapter 5: Data Acquisition and Transmission
np
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
u.
• No central network structure: “Ad-hoc” network
. ed
es
ot
en
io
2. Scatternet
• Interconnected piconets, one master per piconet
• A few devices shared between piconets
m
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 11
Instrumentation II Chapter 5: Data Acquisition and Transmission
np
u.
. ed
es
ot
en
io
m
• Radio layer: defines the requirements for a Bluetooth transceiver operating in the 2.4
GHz ISM band
fro
• 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 set-
up and control
d
• Host Controller Interface (HCI): provides a command interface to the Baseband Link
de
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
oa
service information
• RFCOMM protocol: provides emulation of serial ports over the L2CAP protocol. The
protocol is based on the ETSI standard TS 07.10
nl
• Service Discovery Protocol (SDP): provides a means for applications to discover which
services are provided or available.
ow
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 [[email protected]] References: R. Gaonkar & D.V. Hall | 12
Instrumentation II Chapter 5: Data Acquisition and Transmission
o Signals supported are Rx, Tx, RTS and CTS. The module is DCE, Data Circuit-
terminal 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.
np
What could be done with Bluetooth?
• Wireless package handling
• Secure and instant credit transactions
u.
• Phones headsets computers networks
• Security-selective access
ed
• Anywhere a wire is currently run
Bluetooth Applications
.
• Bluetooth profiles were written to make sure that the application level works the same
es
way across different manufacturers' products
• Bluetooth applications:
ot
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 en
Wireless communications with PC input devices such as mice and keyboards
io
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
m
Advantages
Uses low power
oa
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 13
Instrumentation II Chapter 5: Data Acquisition and Transmission
np
u.
. ed
es
ot
en
io
Components Description
Data acquisition At the heart of any data acquisition system lies the data acquisition
m
hardware hardware. The main function of this hardware is to convert analog signals to
digital signals, and to convert digital signals to analog signals.
fro
Sensors and Sensors and actuators can both be transducers. A transducer is a device that
actuators converts input energy of one form into output energy of another form. For
(transducers) example, a microphone is a sensor that converts sound energy (in the form
d
Signal Sensor signals are often incompatible with data acquisition hardware. To
conditioning overcome this incompatibility, the signal must be conditioned. For example,
oa
Computer The computer provides a processor, a system clock, a bus to transfer data,
ow
configure the sampling rate of your board, and acquire a predefined amount
of data.
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 14
Instrumentation II Chapter 5: Data Acquisition and Transmission
np
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
u.
processing plants etc.
ed
Characteristics of Data Logger
a) Modularity
b) Reliability and Raggedness
.
c) Accuracy
es
d) Management Tool
e) Easy to Use
ot
Application of Data Logger
en
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
io
d) Gas pressure
e) Environmental Monitoring
m
1) Input Signals
• May be
o Pressure, transducers
D
o Thermocouple
o AC signal
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 15
Instrumentation II Chapter 5: Data Acquisition and Transmission
np
o Low closed resistance
o High open circuit resistance
o Low contact potential
u.
o Negligible interaction between switch, enter going signal and input signal
o Short operating time
ed
o Negligible contact bounce
o Long operation life
3) Signal Amplifier & Conditioner
.
• Amplifier for gain adjustment i.e. low level signal amplified up to 5v output.
es
Characteristics are:
o Precise and stable DC gain
ot
o High SNR
o High CMMR
o Low DC drift
o Low output impedance
o High input impedance
en
io
o Good linearity
o Wide bandwidth
• Conditioner for scaling linear transducer or correcting curvature of non linear
m
transducer i.e. signal is changed to more linear from and suitable for digital
analysis. Characteristics are:
fro
o Linear scale
o Correcting the curvature of non linear transducer
o It may include sample and hold circuit
4) A/D Converter
d
o Resolution
o Accuracy
o Conversion time
oa
o Memory
o Writing technique (Serial / Parallel)
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 16
Instrumentation II Chapter 5: Data Acquisition and Transmission
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:
np
o Set amplifier
o Set linearity factor
o Set high and low alarm value
u.
o Start A/D conversion
o Record reading channel
ed
o Identify channel and time of recording
o Display recording
o Reset logger
.
es
Compact Data Logger
• A typical data logger unit provides 60 channels of data in a 20x40x60 cm box weighing
ot
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
en
• 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
io
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
m
operation and carryout calculations through a single amplifier – A/D converter, which is
automatically ranged in gain switched under program control.
fro
• 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.
d
• Electro-mechanical read switches are used frequently in such scanners since speed
de
• 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
nl
accuracy.
• The microprocessor sets the amplifier gains at a proper value as each channel is sampled.
ow
• 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
D
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 17
Instrumentation II Chapter 5: Data Acquisition and Transmission
np
u.
. ed
es
ot
5.3.2 Data Archiving and Storage
en
io
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
m
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
fro
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
d
backups are used to restore data in case it is corrupted or destroyed. In contrast, data
de
archives protect older information that is not needed for everyday operations but may
occasionally need to be accessed.
oa
Data Storage
Storage Factors:
• Speed with which data can be accessed
nl
np
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
u.
that will mount and dismount removable mass storage media into a storage device
according to the system demands.
ed
o also called off-line storage
o E.g. Tape libraries, optical jukebox etc.
.
es
Data Compression
• Process of encoding information using fewer bits than an un-encoded representation
would use, through specific encoding schemes.
ot
• Reduce consumption of expensive resources such as hard drive and transmission
bandwidth.
Types:
Lossy
en
• Trade-off between compression speed, compressed data size and quality (loss)
Lossless
io
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
m
Examples: Pictures (JPEG), Video (MPEG), Examples: zip, rar, Picture (PNG, TIFF),
Audio (MP3) etc. Video (Huff, YUV, AVI) etc.
fro
o high capacity and high speed by using multiple disks in parallel, and
de
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.
oa
o a single parity bit is enough for error correction, not just detection, since we
know which disk has failed
ow
• 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
D
all N + 1 disks, rather than storing data in N disks and parity in 1 disk.
Compiled By: Er. Hari Aryal [[email protected]] References: R. Gaonkar & D.V. Hall | 19
Instrumentation II Chapter 6: Grounding and Shielding
Chapter – 6
Grounding and Shielding
np
Shields minimize interference from noise by reducing noise emission and noise
susceptibility.
u.
6.1 Outline for Grounding and Shielding Design
ed
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.
.
es
Safety
Reduce the voltage differentials between external conductor surfaces.
Usually the design is – conducted energy, low frequency (less than 1 MHz) and
ot
associated with power lines.
Microwave energy is not a shock hazard but it does pose danger and demands especial
attention to shielding. en
io
Safety Ground
Provides a path for the dangerous leakage currents and short circuits.
Properly connected safety ground reduces voltage differential between external surfaces.
m
Safety ground must be a permanent, continuous, low impedance conductor with adequate
capacity that runs from the power source to load.
fro
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
d
Always draw your ground scheme to understand the possible circuit paths.
Don’t blindly rely on building steel for a ground conductor.
nl
Noise is unwanted electrical activity coupled from one circuit into another.
– 3 components: A source, A coupling mechanism, and A receiver
D
np
Fig: Block diagram of noise disrupting a circuit
u.
Noise Sources
ed
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.
.
es
spark plug, igniter), Dischargers and sparks (e.g. lightning, static electricity), High
current equipment (e.g. arc welder)
ot
Energy Coupling Mechanism
Four mechanisms: Conductive, inductive, capacitive & electromagnetic
Coupling
Mechanism
Frequency Range
en
Comment
io
Conductive DC to 10 MHz Requires a complete circuit loop (really no upper
limit to frequency)
m
Inductive Usually > 3KHz Larger loop area in circuit means greater self
inductance and mutual inductance associated with
fro
Electromagnetic Usually > 15 MHz Needs antenna s greater than 1/20 of wave length
in both the source and susceptible circuit.
oa
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.
D
np
u.
. ed
es
ot
en
io
m
circuit. These antennas must be in appropriate fraction of the signal wavelength to couple
effectively.
d
de
oa
nl
Susceptible Circuit
• Third component of noise is susceptible circuit.
ow
• 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
D
np
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
u.
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;
ed
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.
es
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
ot
coupling.
Conductive Coupling
en
• 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
io
grounding.
m
fro
d
de
oa
• Such connections are inadvertent and difficult to find; such connections are called Sneak
ow
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
D
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 [[email protected]] Reference: K. R. Fowler | 4
Instrumentation II Chapter 6: Grounding and Shielding
• The use of high frequency and reduction of ground loop can reduce conductive coupling
or conductive noise.
np
u.
. ed
es
ot
en
io
Inductive Coupling
m
dB di
v A( ) A 0 n( )
dt dt dt
de
i = Current
v = Voltage
ow
• 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Ω
D
• Generally, the load impedance is large, while the source impedance is small.
np
u.
. ed
es
ot
en
io
m
fro
• Current follows the path of lowest impedance, not necessarily lowest resistance.
Therefore, current will follow the path of minimum inductive reactance; this means the
d
• 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.
oa
nl
ow
D
np
u.
. ed
es
• 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
ot
and the mutual inductive coupling between circuits.
en
io
m
fro
d
de
oa
nl
ow
Capacitive Coupling
• Capacitive coupling mechanism requires both proximity between circuits and a changing
D
voltage.
• It occurs when two conductors are placed at some distance apart and voltage level and
frequency are changed.
Compiled By: Er. Hari Aryal [[email protected]] Reference: K. R. Fowler | 7
Instrumentation II Chapter 6: Grounding and Shielding
np
u.
. ed
es
ot
en
io
m
fro
d
de
Electromagnetic Coupling
• Electromagnetic coupling or radiative coupling becomes a factor only when the
oa
• Generally, the length of conductor must be longer than 5% of the bandwidth i.e. l > ʎ/20.
• Pseudo impedance factor between 100Ω and 500Ω.
ow
np
u.
. ed
es
ot
en
io
m
fro
d
de
np
u.
. ed
es
ot
en
io
m
fro
d
Safety Grounding
de
Signal Referencing
• Seeks to reduce the voltage differentials between reference points.
• Should have one connection between reference points at low frequency.
nl
• In either case, ground is not the return path for a signal. Both safety and signal grounds
ow
np
u.
Single Point Grounding
ed
• 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.
es
• The ground conductor should be a short strap to reduce high-frequency noise and unsafe
voltages.
ot
en
io
m
fro
d
de
oa
nl
ow
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;
D
that is, current tends to flow along the surface, and braided cable has a large surface
area).
• 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.
np
u.
. ed
es
ot
en
io
m
fro
d
de
np
u.
. ed
es
Ground Loop
• A ground loop is a complete circuit that comprises a signal path and part of the ground
ot
structure.
• It arises whenever multiple connections to ground are physically separated.
• External currents in the ground structure generate potential differences between the
en
ground connections and introduce noise in the signal circuit.
io
m
fro
d
de
oa
nl
•
ow
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.
D
• Either circuit balance or signal isolation can eliminate noise from ground loops.
np
u.
. ed
es
ot
en
io
m
fro
•
d
For safety, coordinate the routing of power and signal to reduce noise introduces by the
ground structure.
de
oa
nl
ow
D
np
u.
. ed
es
ot
en
io
6.4 Filtering and Smoothing
m
Filtering
• Only filtering reduces conductive noise coupling.
fro
np
u.
Differential-mode noise injects current in opposite directions in the signal
ed
and return lines. Filter blocks common mode currents while passing
differential mode current.
.
es
ot
en
io
m
fro
d
de
• 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
nl
in power supply.
ow
Minimize Bandwidth
• A low-pass filter reduces high frequency emissions and susceptibility for signal
applications.
D
• 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.
np
u.
. ed
es
• Filtering clock signal to reduce the high-frequency harmonics is one area where we may
ot
significantly reduce noise interference. But be careful not to violate the minimum skew
rate required by the logic circuits.
en
io
m
fro
d
de
oa
nl
ow
• 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
np
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
u.
typically 5 or 7 times. Clamp-on cores are also available, which can be attached without
wrapping the wire at all.
. ed
es
ot
en
io
Decoupling and Bypass Capacitors
• They provide Filtering based on frequency
m
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.
d
• Inductance in the power supply attenuates the effect of switching current transients by
de
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
D
capacitors.
np
u.
. ed
es
ot
en
io
m
A differential mode filter has to separate noise from signal by criteria other than current
de
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”.
oa
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
nl
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.
D
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
np
u.
. ed
es
ot
en
io
m
fro
d
de
oa
Inductive Shielding
D
• 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.
np
• Always pair signals with return, otherwise, we will not gain any inductive shielding.
u.
. ed
es
ot
en
io
m
fro
d
de
oa
•
nl
On circuit boards,
o Make sure that the return path is always under the signal conductor to minimize
ow
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
D
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
np
circuit is grounded. Multiple connections can form ground loops.
• Capacitive shielding can be improved by reducing:
o Noise voltage and frequency
u.
o Signal impedance
o Floating metal surfaces
ed
• 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
es
shield to prevent capacitive coupling.
ot
en
io
m
fro
d
de
oa
nl
ow
D
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).
np
• Several techniques can reduce EMI:
o Reduced bandwidth (longer wavelength)
o Good layout and signal routing
u.
o Shielded enclosures
• As shielded enclosure should ideally be a completely closed conducting surface.
ed
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.
es
ot
en
io
m
fro
d
de
oa
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.
np
Ribbon cable
• Ribbon cable is ubiquitous in instrumentation.
u.
• 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
ed
signals or higher frequencies.
.
o Seams must be soldered, welded or overlapped
es
o Penetration such as vents and cables need appropriate filters and shields. A
honeycomb matrix invents, acts as a waveguide to filter electromagnetic radiation.
ot
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. en
• ESD can range from hundreds to tens of thousands of volts. Any instrument containing
io
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
m
source to storage. Often the storage medium is person, who then unwillingly delivers the
damaging discharge.
fro
• 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.
Input ESD-
np
sensors sensesative
or circuit
switches
u.
. ed
es
ot
0 en
Fig: Preventing damage by shunting high voltage transients away from circuits with zener
io
diodes or MOVs
• Generally zener diodes and MOVs are used to limit surges. Zener diodes tend to turn on
m
faster, while MOVs are cheaper and handle large peak current.
• For prevention, we need to eliminate the activities and materials that create high static
fro
o Humidity
• Checklist to make work areas less prone to ESD
de
np
u.
. ed
es
ot
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
en
io
– Standards
– Procedure (good design technique)
System Characterization
m
– Ground loops
de
in.
• Have to meet or surpass the limits of emission or susceptibility in both conducted and
radiated environments.
nl
Procedure
• Good design techniques for grounding and shielding have a few basic rules:
– Reduce Frequency bandwidth
D
– Balance currents
– Route signals for self shielding: a return (ground) plane, short traces, decoupling
capacitors
np
u.
. ed
es
ot
en
io
m
fro
d
de
oa
nl
ow
D
np
u.
. ed
es
ot
en
io
m
fro
d
Case Study
de
• Enclosure Design
• Enclosure Testing
• Option Module Design
oa
• System Design
• Acknowledgements
ow
Be important Noted:
• Example 6.5.1, Example 6.5.2, Example 6.8.1.1, Example 6.9.1
D
Chapter – 7
Circuit Design
From symbols to substance
np
u.
. ed
es
ot
7.1
•
•
Converting requirement into design
en
Establishing requirement is the most difficult part of the circuit design.
Experience is the best guide for setting requirements
io
• General to specific approach of establishing requirements:
– Start by defining the desired function in broad term
– Redefine the function with operational concerns
m
• Time and effort in design increases as the complexity of the function of system increases
de
• 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
oa
channel.
• Knowing region of operation, we can pick option available for circuit design. Right
choice Part count (↓), board apace (↓), Power (↓), Cost (↓), time to market (↓),
D
reliability (↑).
np
u.
. ed
es
ot
en
io
m
fro
d
de
oa
nl
ow
D
np
power.
• Low cost but takes longer time to market.
u.
Standard Cells
• Group of transistors are interconnected structures that provides Boolean logic function or
ed
storage function.
• Simplest cells are direct representatives of adder, mux, flip-flops etc.
.
Gate Array
es
• Analogous to Cu layer of PCB.
• Transistors, standard NAND, NOR gates placed at predefined position and manufactured
ot
in wafer.
• Late manufacture process joined to logic as desired shorter time to market.
manufacturer
• IC designed to configure by customer or designer after manufacture
ow
• 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.
D
• 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.
• 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
np
Technology Performance/Cost Time to market
ASIC Very high Very long
Custom processor or DSP Medium Long
u.
FPGA Low-medium Short
Generic logic Low-medium Short
ed
Microcontrollers
• CPU, I/O devices, program memory, data memory all in single chip
.
es
Microprocessors
• Requires other parts to make workable computer.
ot
Selection of microprocessor / Microcomputer
1. Experience
en
2. Software dependent tools for particular processor
3. Performance: Architecture dependent
io
4. No. of peripheral function
5. Memory
6. Tools support to determine the appropriate processor
m
Performance is determined by
o Throughput
o Resolution
o Address space and available memory
d
o Math coprocessor
o Graphics accelerator
o Interrupt handler
nl
o Timer
o ADC and DAC
o Power drivers
D
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
np
Stack
Temporary and permanent variable
Compiler overhead
u.
I/O buffer
ed
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
es
Power consumption within a processor
ot
• Cooling concerns
• Battery sizing
np
u.
. ed
es
ot
7.2 Reliability, fault tolerance
en
io
Reliability
• How long the product will last?
• Two factors role in the reliability:-
m
consuming
• Combination of both is mostly used
de
• Standard methods for modeling use formulas based on practical experience of failure
rates and physical knowledge to relate environmental factors to the reliability of
oa
electronic components.
• The failure rate for a component is a generally a base rate modified by various factors
λ = λb πe πq πa ………………………..(1)
nl
π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
D
np
• We may consider the application and some of the stresses and susceptibility factors might
affect reliability
– Corrosion, Thermal cracks, Electro migration, Secondary diffusion, Ionizing
u.
radiation, Vibration, High voltage breakdown, Ageing
• These can drastically alter reliability and still not predicted by standard models.
ed
Fault tolerance
• Goes beyond the design and analysis for reliable operation and reduces the possibility of
.
es
dysfunction or damage from abnormal stresses and failures.
• Allows a measure of continued operation in the event of problem
• Three distinct area
ot
– Careful design
– Testable function
– Redundant Architecture
Careful Design
en
io
• 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.
m
Testable Architecture
• The process of testing and diagnosing failures within a system.
• Two possible configurations of testable architecture:
oa
personnel must disassemble the system and remove the circuit for testing.
– Complex Configuration: Dedicated internal circuitry called built in test
ow
(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
D
result.
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.
np
• 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
u.
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.
. ed
es
ot
en
io
m
fro
d
de
oa
nl
ow
• Two conservative criteria may be used to estimate when transmission line effect begins
np
of signal, tp = propagation delay of the signal path.
• Transmission line problems:- BW, decoupling, ground debounce, crosstalk, impedance
mismatch and timing skew or delay
u.
7.3.1 Bandwidth, Decoupling, ground bounce, cross talk, Impedance matching and timing
ed
Bandwidth
• Limiting the bandwidth of the signals within a system is the most effective way to reduce
.
noise, EMI and problems with transmission lines.
es
• May limit the bandwidth either by increasing the rise or fall times of the signal edges or
by reducing the clock frequency.
ot
• 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
en
4 between the rise time, tr and the propagation delay, tp i.e. (tr/tp <4).
• Slower edge rates allow longer interconnections between circuits.
io
m
fro
d
de
oa
nl
ow
D
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.
np
General recommendation for Decoupling:
• Use decoupling capacitor near each chip for two sided board
• Use a large filter capacitor at the power entry point
u.
• Use a ferrite bead at the power entry point to the circuit board
. ed
es
ot
en
io
m
fro
d
de
oa
nl
ow
D
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
np
o Reducing input gate capacitance
o Choosing logic families that either control the signal transition or have slower fall
times.
u.
. ed
es
ot
en
io
m
fro
d
de
oa
nl
ow
D
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
np
– Increase rise time of signal
– Better layout and design of circuits
u.
. ed
es
ot
en
io
m
fro
d
de
oa
nl
Avoiding Crosstalk
ow
– 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
D
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
np
• 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
u.
of signals that cause ringing (oscillations), undershoot, and overshoot in the signal pulses.
• Impedance discontinuities occur in two configurations endpoint and stub.
ed
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.
es
– Terminate the other end of the signal line from driver.
ot
en
io
m
fro
d
de
oa
nl
ow
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
D
• Make them very short, even zero to reduce the effect of stub discontinuities
• Good layout and design
np
u.
. ed
es
Timing
ot
• Clock frequency increases, propagation delays, timing skew, and phase jitter (change in
phase) render logic design useless.
en
• 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).
io
• 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.
m
fro
d
de
oa
nl
ow
D
np
• Backbone of design
• Represents a significant portion of system architecture
u.
Bus architecture concerns:
• Drive configuration
ed
– 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
es
– Differential:-
• transmits two signals with reversed polarity on two separate lines,
ot
• greater tolerance for noise than single ended as they reject common mode
noise,
• better for long cable
• Terminations en
– Multiple outputs of transistors connected in parallel present a considerable
io
capacitive load and slows the transition time of signal
– Use Scotty diodes which has low series capacitance
• Handshakes
m
– Synchronous buses shares a common clock signal and asynchronous buses use
handshake signals.
fro
• Mobile, TV remote controls ,digital multimeter, video cameras, laptops used low power
de
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
nl
– Supply voltage
– Clock frequency
ow
– Load capacitance
• These seven guidelines in design will minimize power
1. Lower clock frequency
D
np
• Error 2 Environmental factors e.g. temperature
• Error 3 Noise within each devise
Types of Noise and error budgets:
u.
1) Johnson or Thermal noise
– Has a flat power spectrum and is “white” Gaussian noise
ed
Vnoise (rms) = 4KTRW
Where, K = the Boltzmann constant = 1.38X10-23 J/K
T = absolute temperature (K)
.
es
R = resistance (Ω)
W = bandwidth (Hz)
2) Shot noise
ot
– 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)
en
io
W = measurement bandwidth (Hz)
3) Flicker or Pink noise
– Flicker, 1/f or “pink” noise varies with frequency
m
np
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
u.
supply goes below the preset values and the reset signal stays active until the voltage of
the power supply exceed the preset value.
ed
• E.g. RC network, watchdog timer
• Some system may turn on the battery backup after power failure and also inform the
processor through interrupt.
.
es
ot
en
io
m
fro
d
de
oa
nl
ow
• 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
D
• 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.
Interface Unit
• The input to all circuit is some sort of electrical signal
np
• Each signal comes from another circuit, a transducer or a switch.
• Most signals need some preprocessing or conversion before the system can assimilate
them
u.
• 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.
ed
• 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
es
• Once you know the type of input, you can decide on the necessary circuitry to manipulate
the input signals.
ot
en
io
m
fro
d
de
oa
nl
ow
D
Chapter – 8
Circuit Layout
8.1 Circuits Boards and PCBs
• Technologies available for connecting components and circuits
• Circuit boards combine electronic components and connectors into a functional system
np
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]
u.
. ed
es
ot
en
io
m
fro
d
de
oa
nl
Wire-Wrap
ow
• Limited in operation to less than 5 or 10 MHz, above which the loop inductances in the
wired connections distort signals.
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.
np
PCB (Printed Circuit Board)
• Etched and plated connections
• Make automated placement and soldering of components possible
u.
• Control impedances more effectively than wire-wrap
• Cost effective, manufacturing edge and reliability
ed
Single Sided PCB
o Low frequency operation (< 25 KHz)
.
o Signal cross over wire jumpers are used
es
Double Sided PCB
ot
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.
Multilayer PCB en
o A stack of alternate layers of copper-clad laminate or core and prepreg.
io
o 20 to 30 conducting layers laminated together
o Control impedance much more tightly and are absolutely necessary for high
frequency circuits
m
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
fro
o Blind vias are exposed on one external layer and connect traces on the two sides of
that layer.
• Higher level of circuit density by bonding the base die of ICs onto a substrate
de
1) Group high current circuit near the connector to isolate stray currents and near the
edge of the PCB to remove heat.
ow
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
D
frequency circuits
4) Group analog circuits separately from digital circuits.
• Grouping components and circuits appropriately will reduce crosstalk and noise and will
dissipate heat efficiently.
np
u.
. ed
es
ot
en
io
m
• 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.
Crosstalk
Trace density
oa
– 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
nl
your product, reduce the cost of material and may degrade signal integrity.
Common Impedance
D
– 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 [[email protected]] Reference: K. R. Fowler | 3
Instrumentation II Chapter 7: Circuit Layout
np
reducing the magnitude of current pulses.
u.
. ed
es
ot
en
io
m
fro
d
de
– Large loops of current have high inductance or impedance and radiated noise is
often proportional to return path impedance and loop area.
ow
D
np
u.
. ed
es
ot
en
io
m
fro
np
u.
. ed
es
ot
en
io
m
fro
d
de
oa
nl
ow
D
np
u.
. ed
es
ot
en
io
m
fro
d
de
oa
nl
ow
D
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.
np
• 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
u.
8.4 Ground, Returns and Shields
ed
• Proper ground and return scheme will shield and suppress most EMI in electronics and
reduce errors caused by noise.
.
• Grounding
es
– Provides reference point for signal.
– Signal reference should be a single point and is as close as possible to the power
ot
entry to the PCB.
– A ground plane connected to the single-point reference will also reduce common
impedance.
en
– 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
io
plane or different planes and connect their ground leads to the single-point
reference.
m
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.
d
• Shielding
o A return plane is the most effective shield for any circuit.
oa
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
nl
np
u.
. ed
es
ot
en
io
m
•
fro
– Fill the regions between analog traces with copper foil and connect to ground.
oa
nl
ow
D
np
u.
. ed
es
ot
en
io
m
fro
d
de
• Shape or keying polarizes a connector so that it cannot be plugged in the wrong way.
• Reduce flexing of cables.
•
nl
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.
np
u.
. ed
es
ot
en
io
m
fro
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.
np
• Software accounts for 50-75 percent of a microcontroller project.
• General methods to improve software are code generation, reliability, maintainability and
u.
correctness.
ed
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
es
into following types:
• System Software
– Operating system, System drivers, Firmware etc.
ot
• Programming Software
– Compiler, Debugger, Interpreter, Linker, Text editor etc.
• Application Software
en
– Industrial / Business automation, User interface, Games / Simulating software,
Database, Image editing, Auto CAD, word processor etc.
io
Compiler versus Interpreter
m
Compiler Interpreter
Machine
Lots of time is spent in analyzing and Relatively little time than compiler
d
Not required extra program to execute the Requires extra program to execute
code. intermediate code.
np
• 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.
u.
• Understand each algorithm, its limitations and its boundary conditions
• Jack Ganssle writes: “It’s ludicrous that we software people reinvent the wheel with
ed
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.”
.
es
2. Languages
• Software has many applications within embedded systems such as Firmware, Peripheral
ot
interface and drivers, Operating system, User interface, Application programs etc.
• May use variety of languages
• Assembly language
Assembly Language
en
• High level language: Basic, C, C++, Java etc.
High Level Language
io
Processor Architecture dependent and Processor Architecture Independent
closer to hardware.
m
Tedious because it requires steadfast Easier due to nitty-gritty details, structure and
fro
3. Methods
• Whatever language you choose, your objective will be to reduce complexity and improve
oa
software engineering)
• Structured designs have strategy before starting to code; small modules with clear
ow
• Tools available are compilers, disassemblers, debuggers, emulators, monitors and logic
analysers.
• Operating system and software libraries ease the task.
Compiled By: Er. Hari Aryal [[email protected]] Reference: K. R. Fowler | 2
Instrumentation II Chapter 9: Software for instrumentation and control applications
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
np
the level of integration.
• Choice of language also depends on manufacturers having following questions
o Does the vendor provide reasonable documentation and support?
u.
o Does it provide toll-free telephone support and acknowledge application
engineers?
ed
o Does it have liability support for life-critical systems.
5. Purchase
.
• Purchase the software after you have defined your software requirements and surveyed
es
vendors for availability, reputation and experience.
• Some qualification of a vendor:
ot
o Acceptance testing
o Review of vendor’s quality assurance
o Verification testing
o Qualification report en
• Furthermore, required documentations from a vendor:
io
o Requirement specification
o Interface specification
o Test plans, procedures, results
m
• 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.
• 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
oa
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)
nl
– 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.
D
np
u.
. ed
es
ot
en
io
Quality Assurance
m
• Oversees each steps of model towards producing useful, reliable software rather than
connection of modules
fro
• 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:
d
o Documentation
o Traceability
oa
• 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
ow
inputs.
• Analyze should concentrate on where most problem occurs which include:
o technical tradeoff
D
o performance timing
o human factor
o hazard and risk analysis
Compiled By: Er. Hari Aryal [[email protected]] Reference: K. R. Fowler | 4
Instrumentation II Chapter 9: Software for instrumentation and control applications
Requirements
• Reduce the abstract intentions of the customer into realizable constraints.
• Tells what the software does
np
• 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:
u.
o General specification
o Functional performance specification
ed
o Requirements specification
o Design specification
• Needs constraints considerations such as memory, timing margin, hardware,
.
communication, I/O and execution speed;
es
• Will the selected processor and associated hardware support the requirements?
• Can the software use these resources and satisfy the requirements.
ot
Design
• Design tells how the software does its functioning.
en
• Specifies how the software will fulfill the requirements.
• Consider these software elements in preparing the design:
io
o System preparation and setup
o Operating system and procedures
o Communication and I/O
m
o Monitoring procedures
o Fault recovery and special procedures
fro
o Diagnostics features
• Interfaces demands most attention communication format:
o Polled I/O
o Interrupt I/O
d
o Intertask signaling
o Communications of polling and queuing to avoid overrunning events
• Design can specify algorithms and techniques that optimize performance, management of
oa
memory.
• Design may reuse modules and libraries in an effort to improve productivity and
reliability.
nl
Programming
ow
Source file (Assembly language mnemonics) assembler object file linker Binary
machine code Burn PROM
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
np
B) Black box testing:
• To ensure that input and output interfaces are functioning correctly without concerning
u.
what happens in software.
• Ensures the integrity of the information flow.
ed
C) White box testing:
• Exercises all logical decisions and functional path within a software module.
.
• Requires intimate knowledge of software module
es
• Useful for determining bugs on special case
• Exhaustive testing is impossible; may take 100 of years to test each and every possible
ot
combination
Verification
m
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
d
product.
de
assurance
• Difficult to respond to changing customer requirement
• Software only available at late development schedule
D
np
• 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
u.
stages:
– Systems analyst does analysis,
ed
– Architect does design,
– Programmers code,
– Testers validate, etc.
.
es
Problems with Waterfall Model
• Offers no insight into how each activity transforms artifacts (documents) of one stage
ot
into another
• Fails to treat software a problem-solving process
– Unlike hardware, software development is not a manufacturing but a creative
process en
– Manufacturing processes really can be linear sequences, but creative processes
io
usually involve back-and-forth activities such as revisions
– Software development involves a lot of communication between various human
stakeholders
m
2. Prototyping Model
d
• In this model the developer and client interact to establish the requirements of the
de
software.
• Accommodates the problem of changing requirements and make a subset of the software
available early.
oa
• This is follow up by the quick design, in which the visible elements of the software, the
input and the output are designed.
ow
to the analyst.
• The process continues in an iterative manner until the all the user requirements are met.
• Accommodates problem of changing requirements
np
u.
. ed
es
ot
en
io
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
m
• The client can provide its input during development of the prototype.
• The prototype serves as an aid for the development of the final product.
• 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
oa
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
nl
be discarded.
• Sometimes prototype ends as final product which result in quality + maintenance
ow
problem
• Client may divert attention solely to interface issue
• Testing + documentation forgotten
D
• Designer tends to rush product to market without considering long term reliability,
maintenance, configuration control
• Creeping featurism: The customer voices new desires after each evolution, and the
project effort balloons.
3. Spiral Model
• Uses incremental approach to development that provides a combination of waterfall and
prototyping model.
np
• Each cycle around the development spiral provides a successively more complete version
of the software.
• Model allows flexibility to manage requirements control changes
u.
• Used in proprietary application
• Spiral Model – risk driven rather than document driven
ed
• 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,
es
the higher the risk
ot
en
io
m
fro
d
de
– Evolutionary development
– Release builds for beta testing
– Marketing advantage
nl
– Lack of milestones
– Management is dubious of spiral process
– Change in Management
D
– Prototype Vs Production
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
np
• 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
u.
– Correctness, Reliability, Efficiency, Maintainability, Flexibility, Testability,
Portability, Reuse, Utility, Size etc.
ed
Process
• Process incorporate models of software development to generate useful, reliable and
.
maintainable software
es
• 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.
ot
• Process maturity levels defined by the software engineering institute:
1) Initial: Chaos or ad hoc process
2) Repeatable: Design & Management defined
en
3) Defined: Fully defined & enforced technical practices
4) Managed Process: Feedback that detects and prevents problems, a control process
io
5) Optimizing Process: Automating, monitoring & introducing new technologies
Software Limitations
m
– Fault
– Failure
– Time
np
• Isolate tasks from influences, both hardware and timing
• Communicate through a single well-defined interface between tasks
u.
9.4 Fault Tolerance
• Fault tolerance concerns safety and operational uptime, not reliability.
ed
• 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
es
flow and signals the processor with logic pulse when it detect fault.
– Roll-Back-Recovery or Roll-Forward-Recovery
ot
– Careful design
– Redundant architecture
4. Operation
fro
Intent
o Wrong assumption +misunderstanding
o Correctly solving wrong problems
o Viruses
d
Translation
o Incorrect algorithm
oa
o Incorrect analysis
o Misinterpretation
nl
Execution
o Semantic error –does not know how command works
ow
o Documentation-wrong/misleading comments
Operation
o Changing paradigm
o Interface error
o Performance
np
o Hardware error
o Human error
u.
Debugging
• Print statement
ed
• Break points and watch values
• In circuit emulators ,in circuit debugger
• Logic analyzer
.
• White box testing
es
• Black box testing
• Grey Box testing
ot
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
Testing Levels
en
io
• Unit test
o To test functionality of specific section of code at functional level
o Building blocks work independently of each other
m
• For useful, reliable, maintainable program we must make them readable and
understandable. Good design and programming practices can make programs more
readable.
oa
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:
np
• Name properly
• Minimize use of global variables
• Don’t pass pointer
u.
• Pass intact values
ed
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
es
task well in a variety of situations.
• Modules can isolate device dependent code for simplicity and reuse.
ot
• Large modules: divide among team for more productive and parallel effort.
• Use of libraries of modules and procedures load faster and resist inadvertent
changes
en
• Structure programming encourages the installation and testing of one module
at a time to simplify the verification of the software.
io
Points to be noted
• 90% of processor time is spent in executing 10% of code. Identify this 1%.
m
Cohesion:
ow
np
• Communication Cohesion
– Modules grouped together because they access the same Input/Output devices
• Sequential Cohesion
u.
– Elements in a module are linked together by the necessity to be activated in a
particular order
ed
• Functional Cohesion
– All elements of a module relate to the performance of a single function
.
Coupling:
es
• Coupling describes the interconnection among modules
• Modules should have minimum Communication or coupling
ot
• Data coupling
– Occurs when one module passes local data values to another as parameters
• Stamp coupling
en
– Occurs when part of a data structure is passed to another module as a parameter
• Control Coupling
io
– Occurs when control parameters are passed between modules
• Common Coupling
– Occurs when multiple modules access common data areas such as Fortran
m
Common or C extern
• Content Coupling
fro
E) Scheduling
• Should record all efforts expended in current jobs to estimate future job
ow
np
• Strangely, the higher the cost of the equipment, the lower the quality of the human-
interface design.
• Common design issues for a user interface include response time, error handling and help
u.
facilities.
• The response time should have a reasonable interval and consistent variation application
ed
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.
es
User Interface Guidelines
ot
Action or Concern Comments
Tune dialogue to user Make it smooth and consistent. Use logical
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
D
np
• Software design concerns with occurrence and loading.
• Occurrence is the timing of events in real-time software. Events occur either
synchronously and asynchronously.
u.
• Loading is the measure of processor capacity; two metrics are utilization (amount of
processing) and throughput (no. of I/O operations).
ed
• 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
es
which has following metrics:
o Execution speed of the processor
ot
o Response time of the system
o Data transfer rate
•
o Memory size en
o Interrupt handling: context switching and interrupt latency
Performance can measure with time I/O bus signals with an oscilloscope, logic analyzer,
io
or performance analyzer.
• Fault tolerance defines how the software deals with misused resources and outright errors
with various degrees as:
m
o Predictableness
o Robustness
• Some types of failure that affect reliability include missed or incomplete tasks, deadlock,
spurious interrupts, and stack overflow.
d
de
oa
nl
ow
D
Chapter - 10
Case Study
Examples chosen from local industrial situations with particular attention paid to the basic
measurement requirements, accuracy, and specific hardware employed environmental
np
conditions under which the instruments must operate, signal processing and transmission,
output devices:
u.
a) Instrumentation for a power station including all electrical and non-electrical parameters.
ed
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.
es
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.
ot
g) Other industries can be selected with the consent of the subject teacher.
Preliminary
en
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.
io
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.
m
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
fro
During Visit
1. You need to understand the current process control system of the visited organization and
d
describe the same in your own word in the report. List all the variables that are included in
de
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
nl
the visited organization. Comment on the product and recommend better option for the
product in the present context, if you feel its need.
ow
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.
D
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
np
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?
u.
5. Recommend what you feel like.
6. On the basis of above prepare a report on the case study.
ed
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
es
would be connected and operated.
ot
en
io
m
fro
d
de
oa
nl
ow
D
Chapter - 10
Case Study
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,
p
output devices:
.n
a) Instrumentation for a power station including all electrical and non-electrical
parameters.
du
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
.e
cotton through to finished dyed fabric.
e) Instrumentation for a process; for example, an oil seed processing plant from raw
es
seeds through to packaged edible oil product.
f) Instruments required for a biomedical application such as a medical clinic or hospital.
ot
g) Other industries can be selected with the consent of the subject teacher.
Preliminary
en
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
io
an organization, students need to bring the responsible person’s name and post for issuing
the letter. The letter must be addressed accordingly.
m
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.
fro
During Visit
1. You need to understand the current process control system of the visited organization and
d
describe the same in your own word in the report. List all the variables that are included
in the process control system.
de
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
oa
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.
ow
1
Instrumentation II Chapter 10 - Case Study
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
p
situation?
5. Recommend what you feel like.
.n
6. On the basis of above prepare a report on the case study.
du
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
.e
the system would be connected and operated.
es
Below is given a sample case study.
ot
en
io
m
fro
d
de
oa
nl
ow
D
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
related to our field and view how actual design principles are in practice.
p
.n
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
du
plant to improve its production capacity efficiently.
.e
We are not boasting that our proposed design is more faultless than the current one. As every coin
es
has two sides the proposed design can also have its own flaws along with the new efficiency.
However, being an Electronics Engineer we believe that our proposed design can improve the
ot
efficiency of the existing plant.
en
io
m
fro
d
de
oa
nl
ow
D
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.
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.
p
.n
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
du
needs of more than 240 million consumers that live in its markets. It is a proud developing markets
Anchor bottler.
.e
Objectives of case study
es
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
ot
a design to solve problems related to operation and manufacturing of coca cola.
en
Hence the main objective of our visit can be summarized as following:
To visit the chosen organization and learn its operation under supervision of senior
io
engineers and technicians.
To study the existing management system and technology of company.
m
The processing plant of coca-cola company has been installed in Balaju industrial state several years
de
ago. All the processing plants are being closely monitored by Nepal ease technicians and engineers.
The plant has been working smoothly.
oa
Process of manufacturing:
1. Preparation of bottles and cans.
2. Chemicals
nl
3. Machinery Equipments
4. Computers
ow
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
D
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
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
p
management Department. The material management then seeks for the bidders and buys
.n
the needed materials and equipments in accordance with company rule and policy.
Generally, the bidder with equipments meeting all the required specification as produced
du
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.
.e
There are various operations implemented during the production and distribution of the
products. They are
es
Collection of bottles from every part of the country.
Cleaning of the bottles with water jet.
ot
Testing of bottles for unwanted materials (EBI).
Mixing of the ingredients in a proportion prescribed by coca-cola company
(Atlanta).
en
Automatic time controlled filling.
Automatic capping.
io
Automatic Date coding.
COLLECTION OF BOTTLES:
m
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.
fro
Further these bottles are fed to the plant for the next process.
The bottles are now cleaned by keeping the bottle in various positions and striking with the
de
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
oa
MIXING OF INGREDIENTS
In this unit, first of all the given proportion of the flavor is diluted with specified ratio of
ow
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.
D
5
Instrumentation II Chapter 10 - Case Study
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.
p
TEMPERATURE TEST UNIT
.n
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
du
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.
.e
es
ot
en
io
m
fro
d
de
oa
nl
ow
D
6
Instrumentation II Chapter 10 - Case Study
PET (Polyethylenterepthalate)
p
.n
Chiller Blow Mold HP Compressor
(sipa)
du
Air
.e
Para mix Rinser+Filter+cappe
es
Blender
Chain
ot
en Conveyor
Data Code
(Video jet)
io
m
Warmer
fro
(Khs)
d
de
Lableller
oa
(Krones)
nl
ow
Cartoon Taking
D
7
Instrumentation II Chapter 10 - Case Study
p
Decrater (Ketlner)
.n
du
.e
Bottle Washer
es
(Crown/Bade)
ot
en
EBI
io
(Empty Bottle)
m
fro
Filling+ Crowner
d
de
oa
Data Code
nl
ow
D
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
p
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.
.n
2. Purification of water
du
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:
.e
Chlorine
es
Sand filter (Removes suspended particles)
Sedimentation
AM filter (Anthracite & manganese filter)
ot
Tank (sediment for
Spring water 6-8 hours) en Carbon filter (Removes organic Residue)
Candle filter
fro
Ozone
D
Generator
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.
Next, pressurized water is passed through a variety of filters as shown in the figure. First, the water
p
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
.n
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
du
through the sand filter water is then filtered for any anthracite and manganese through AM filter.
.e
Next, water is passed through carbon filter. Carbon filters are most effective at removing chlorine
es
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
ot
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
en
purification the mineral ions are exchanged with the ions that don’t cause hardness.
Then, water is passed through bag filter to remove suspended particles smaller than 5 microns and
io
finally through candle filter.
After completion of the purification reverse osmosis is performed. The term reverse osmosis comes
m
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
fro
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
d
region of low solute concentration by applying a pressure in excess of the osmotic pressure. This
de
process removes minerals in the water and is best known for it’s used in desalination.
The final stage of purification involves sterilizing water with ozone. Ozone is bubbled in ozone
oa
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.
nl
ow
The PC (polycarbonate) bottles are the reusable bottles. They have a capacity of holding 19 liters of
D
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.
p
(Cap snap co)
.n
du
Delivery
.e
trolley
es
Fig 2. Washing and filling of PC jars
The reusable bottles encounter a variety of environments and thus are susceptible to contamination.
ot
The first process is thus cleaning of the bottles as soon as they arrive at the company. Although the
en
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
io
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
m
the bottle is washed by hyper assonated water to remove any remaining infections.
fro
d
de
oa
nl
ow
D
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.
4. Storage
p
The assonated soft drink is not suitable for drinking. Since, ozone is unstable it breaks down into
.n
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
du
other day.
The purification of the water is quite perfect and employs a number of filters to remove impurities
.e
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.
es
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.
ot
Here, we purpose a microprocessor based automatic washing and filling station, which has a much
en
easier control structure.
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.
d
3. Temperature sensors: Although sensors are already present in the previous design we
de
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
oa
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
5. User keypad: This is a new feature allows user to make different modifications according
ow
to his need.
6. Electromagnetic lift: This is a magnetic lift the bottles during filling of soft drink.
D
7. Press: This may be a hydraulic press or any other one seal the bottle.
12
Instrumentation II Chapter 10 - Case Study
8. LCD Display: The display shows the temperature in the automatic bottle washer and the
total number of production in the factory.
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.
p
First the jets are in the off state. As soon as the motors stall the sensors checks the
.n
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
du
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.
.e
After the bottle is washed it is transported to the filling section by a convey line. But it
es
should be remembered that convey should transported the bottles smoothly without any
ot
en
io
m
fro
d
de
oa
nl
ow
D
13
Instrumentation II Chapter 10 - Case Study
p
.n
du
.e
es
ot
en
Fig . Block Diagram of Proposed Design
io
m
fro
d
de
oa
nl
ow
D
14