You are on page 1of 79

1

2
CHAPTER 1: DESCRIPTION OF THE PROJECT

1.1 INTRODUCTION
.

1.2 OVERVIEW
The Step-by-step advances and ability to design and fabricate circuits at higher
frequencies have produced a technology for use of microwaves. In todays microwave
practice, there are two types of microwave circuits i.e. passive and active circuits.
Among passive circuits, the directional coupler is a very important part of microwave
measurement system. The directional coupler finds a variety of applications i.e. power
monitoring, reflectometer, power divisions, scalar analyzer, vector analyzer and radar
systems. Among these various applications, reflectometer is a prominent one that forms
the heart of scalar and vector analyzers. The development of micro strip and strip line
directional couplers is capable of reducing the size and cost. In this type of coupler, the
continuous coupling takes place between two lines close to each other and the detection
of the power parameters can be continuously detected by the usage of various detectors
and these detected outputs will be analyzed to calculate different parameters like
reflection coefficient, VSWR and return loss etc., and these calculated values can be used
readily in various designing aspects, and there is an immense need of such design
certainly help the communication engineers in many ways.

1.3 AIM OF THE PROJECT


This project aims for the Measurement of Through line power parameters which
includes the design of RF Analyzer
micro controller AT 89C55, also displaying all the quantities on to the LCD display in
digital form viz. Pi, Pr. K,S, rl., using a key pad respectively
1.The fourth stage, the assembly of the fabricated components and Hardware design for
the RF Analyzer i.e. the digital display unit.
2. The final module, the testing of the fabricated components, the coupler and
Logarithmic Detector unit, and the Digital analyzer and modifications if any are
required.

3
CHAPTER 2: EMBEDDED SYSTEMS
2.1 Embedded Systems:
complete device often including hardware and mechanical parts. By contrast, a general-
purpose computer, such as a personal computer (PC), is designed to be flexible and to
meet a wide range of end-user needs. Embedded systems control many devices in
common use today.
Embedded systems are controlled by one or more main processing cores that are
typically either microcontrollers or digital signal processors (DSP). The key
characteristic, however, is being dedicated to handle a particular task, which may require
very powerful processors. For example, air traffic control systems may usefully be
viewed as embedded, even though they involve mainframe computers and dedicated
regional and national networks between airports and radar sites. (Each radar probably
includes one or more embedded systems of its own.)
Since the embedded system is dedicated to specific tasks, design engineers can
optimize it to reduce the size and cost of the product and increase the reliability and
performance. Some embedded systems are mass-produced, benefiting from economies of
scale.
Physically embedded systems range from portable devices such as digital
watches and MP3 players, to large stationary installations like traffic lights, factory
controllers, or the systems controlling nuclear power plants. Complexity varies from low,
with a single microcontroller chip, to very high with multiple units, peripherals and
networks mounted inside a large chassis or enclosure.
In general, "embedded system" is not a strictly definable term, as most systems
have some element of extensibility or programmability. For example, handheld computers
share some elements with embedded systems such as the operating systems and
microprocessors which power them, but they allow different applications to be loaded and
peripherals to be connected. Moreover, even systems which don't expose programmability
as a primary feature generally need to support software updates. On a continuum from
"general purpose" to "embedded", large application systems will have subcomponents at
most points even if the system as a whole is "designed to perform one or a few dedicated
functions", and is thus appropriate to call "embedded". A modern example of embedded
system is shown in fig: 2.1.

4
Fig 2.1:A modern example of embedded system
Labeled parts include microprocessor (4), RAM (6), flash memory (7).Embedded
systems programming is not like normal PC programming. In many ways, programming
for an embedded system is like programming PC 15 years ago. The hardware for the
system is usually chosen to make the device as cheap as possible. Spending an extra
dollar a unit in order to make things easier to program can cost millions. Hiring a
programmer for an extra month is cheap in comparison. This means the programmer must
make do with slow processors and low memory, while at the same time battling a need
for efficiency not seen in most PC applications. Below is a list of issues specific to the
embedded field.

2.1.1 History:

In the earliest years of computers in the 193040s, computers were sometimes


dedicated to a single task, but were far too large and expensive for most kinds of tasks
performed by embedded computers of today. Over time however, the concept
of programmable controllers evolved from traditional electromechanical sequencers, via
solid state devices, to the use of computer technology.

One of the first recognizably modern embedded systems was the Apollo
Guidance Computer, developed by Charles Stark Draper at the MIT Instrumentation

5
Laboratory. At the project's inception, the Apollo guidance computer was considered the
riskiest item in the Apollo project as it employed the then newly developed monolithic
integrated circuits to reduce the size and weight. An early mass-produced embedded
system was the Autonetics D-17 guidance computer for the Minuteman missile, released
in 1961. It was built from transistor logic and had a hard disk for main memory. When the
Minuteman II went into production in 1966, the D-17 was replaced with a new computer
that was the first high-volume use of integrated circuits.

2.1.2 Tools:
Embedded development makes up a small fraction of total programming. There's
also a large number of embedded architectures, unlike the PC world where 1 instruction
set rules, and the UNIX world where there's only 3 or 4 major ones. This means that the
tools are more expensive. It also means that they're lowering featured, and less developed.
On a major embedded project, at some point you will almost always find a compiler bug
of some sort.

Debugging tools are another issue. Since you can't always run general programs
on your embedded processor, you can't always run a debugger on it. This makes fixing
your program difficult. Special hardware such as JTAG ports can overcome this issue in
part. However, if you stop on a breakpoint when your system is controlling real world
hardware (such as a motor), permanent equipment damage can occur. As a result, people
doing embedded programming quickly become masters at using serial IO channels and
error message style debugging.

2.1.3 Resources:
To save costs, embedded systems frequently have the cheapest processors that can
do the job. This means your programs need to be written as efficiently as possible. When
dealing with large data sets, issues like memory cache misses that never matter in PC
programming can hurt you. Luckily, this won't happen too often- use reasonably efficient
algorithms to start, and optimize only when necessary. Of course, normal profilers won't
work well, due to the same reason debuggers don't work well.
Memory is also an issue. For the same cost savings reasons, embedded systems
usually have the least memory they can get away with. That means their algorithms must
be memory efficient (unlike in PC programs, you will frequently sacrifice processor time

6
for memory, rather than the reverse). It also means you can't afford to leak memory.
Embedded applications generally use deterministic memory techniques and avoid the
default "new" and "malloc" functions, so that leaks can be found and eliminated more
easily. Other resources programmers expect may not even exist. For example, most
embedded processors do not have hardware FPUs (Floating-Point Processing Unit).
These resources either need to be emulated in software, or avoided altogether.

2.1.4 Real Time Issues:


Embedded systems frequently control hardware, and must be able to respond to
them in real time. Failure to do so could cause inaccuracy in measurements, or even
damage hardware such as motors. This is made even more difficult by the lack of
resources available. Almost all embedded systems need to be able to prioritize some tasks
over others, and to be able to put off/skip low priority tasks such as UI in favor of high
priority tasks like hardware control.
2.2 Need For Embedded Systems:
The uses of embedded systems are virtually limitless, because every day new
products are introduced to the market that utilizes embedded computers in novel ways. In
recent years, hardware such as microprocessors, microcontrollers, and FPGA chips have
become much cheaper. So when implementing a new form of control, it's wiser to just
buy the generic chip and write your own custom software for it. Producing a custom-
made chip to handle a particular task or set of tasks costs far more time and money. Many
embedded computers even come with extensive libraries, so that "writing your own
software" becomes a very trivial task indeed. From an implementation viewpoint, there is
a major difference between a computer and an embedded system. Embedded systems are
often required to provide Real-Time response. The main elements that make embedded
systems unique are its reliability and ease in debugging.

2.2.1 Debugging:
Embedded debugging may be performed at different levels, depending on the
facilities available. From simplest to most sophisticate they can be roughly grouped into
the following areas:
Interactive resident debugging, using the simple shell provided by the embedded
operating system (e.g. Forth and Basic)

7
External debugging using logging or serial port output to trace operation using
either a monitor in flash or using a debug server like the Remedy Debugger which
even works for heterogeneous multi core systems.
An in-circuit debugger (ICD), a hardware device that connects to the
microprocessor via a JTAG or Nexus interface. This allows the operation of the
microprocessor to be controlled externally, but is typically restricted to specific
debugging capabilities in the processor.
An in-circuit emulator replaces the microprocessor with a simulated equivalent,
providing full control over all aspects of the microprocessor.
A complete emulator provides a simulation of all aspects of the hardware,
allowing all of it to be controlled and modified and allowing debugging on a
normal PC.
Unless restricted to external debugging, the programmer can typically load and
run software through the tools, view the code running in the processor, and start or
stop its operation. The view of the code may be as assembly code or source-code.

Because an embedded system is often composed of a wide variety of elements, the


debugging strategy may vary. For instance, debugging a software (and microprocessor)
centric embedded system is different from debugging an embedded system where most of
the processing is performed by peripherals (DSP, FPGA, co-processor). An increasing
number of embedded systems today use more than one single processor core. A common
problem with multi-core development is the proper synchronization of software
execution. In such a case, the embedded system design may wish to check the data traffic
on the busses between the processor cores, which requires very low-level debugging, at
signal/bus level, with a logic analyzer, for instance.

2.2.2 Reliability:
Embedded systems often reside in machines that are expected to run continuously
for years without errors and in some cases recover by them if an error occurs. Therefore
the software is usually developed and tested more carefully than that for personal
computers, and unreliable mechanical moving parts such as disk drives, switches or
buttons are avoided.
Specific reliability issues may include:

8
The system cannot safely be shut down for repair, or it is too inaccessible to
repair. Examples include space systems, undersea cables, navigational beacons,
bore-hole systems, and automobiles.
The system must be kept running for safety reasons. "Limp modes" are less
tolerable. Often backup s are selected by an operator. Examples include aircraft
navigation, reactor control systems, safety-critical chemical factory controls, train
signals, engines on single-engine aircraft.
The system will lose large amounts of money when shut down: Telephone
switches, factory controls, bridge and elevator controls, funds transfer and market
making, automated sales and service.

A variety of techniques are used, sometimes in combination, to recover


from errorsboth software bugs such as memory leaks, and also soft errors in the
hardware:
Watchdog timer that resets the computer unless the software periodically notifies
the watchdog
Subsystems with redundant spares that can be switched over to
software "limp modes" that provide partial function
Designing with a Trusted Computing Base (TCB) architecture[6] ensures a highly
secure & reliable system environment
An Embedded Hypervisor is able to provide secure encapsulation for any
subsystem component, so that a compromised software component cannot
interfere with other subsystems, or privileged-level system software. This
encapsulation keeps faults from propagating from one subsystem to another,
improving reliability. This may also allow a subsystem to be automatically shut
down and restarted on fault detection.
Immunity Aware Programming

2.3 Explanation of Embedded Systems:


2.3.1 Software Architecture:
There are several different types of software architecture in common use.
Simple Control Loop:

9
In this design, the software simply has a loop. The loop calls subroutines, each of
which manages a part of the hardware or software.
Interrupt Controlled System:

Some embedded systems are predominantly interrupt controlled. This means that
tasks performed by the system are triggered by different kinds of events. An interrupt
could be generated for example by a timer in a predefined frequency, or by a serial port
controller receiving a byte. These kinds of systems are used if event handlers need low
latency and the event handlers are short and simple.
Usually these kinds of systems run a simple task in a main loop also, but this task
is not very sensitive to unexpected delays. Sometimes the interrupt handler will add
longer tasks to a queue structure. Later, after the interrupt handler has finished, these
tasks are executed by the main loop. This method brings the system close to a
multitasking kernel with discrete processes.
Cooperative Multitasking:

A non-preemptive multitasking system is very similar to the simple control loop


scheme, except that the loop is hidden in an API. The programmer defines a series of
tasks, and each task gets its own environment to run in. When a task is idle, it calls an
idle routineare very similar to the control loop, except that adding new software is easier,
by simply writing a new task, or adding to the queue-interpreter.
Primitive Multitasking:

In this type of system, a low-level piece of code switches between tasks or threads
based on a timer (connected to an interrupt). This is the level at which the system is
generally considered to have an "operating system" kernel. Depending on how much
functionality is required, it introduces more or less of the complexities of managing
multiple tasks running conceptually in parallel.
As any code can potentially damage the data of another task (except in larger
systems using an MMU) programs must be carefully designed and tested, and access to
shared data must be controlled by some synchronization strategy, such as message
queues, semaphores or a non-blocking synchronization scheme.
Because of these complexities, it is common for organizations to buy a real-time
operating system, allowing the application programmers to concentrate on device

10
functionality rather than operating system services, at least for large systems; smaller
systems often cannot afford the overhead associated with a generic real time system, due
to limitations regarding memory size, performance, and/or battery life.
Microkernels And Exokernels:

A microkernel is a logical step up from a real-time OS. The usual arrangement is


that the operating system kernel allocates memory and switches the CPU to different
threads of execution. User mode processes implement major functions such as file
systems, network interfaces, etc.
In general, microkernels succeed when the task switching and intertask
communication is fast, and fail when they are slow. Exokernels communicate efficiently
by normal subroutine calls. The hardware and all the software in the system are available
to, and extensible by application programmers. Based on performance, functionality,
requirement the embedded systems are divided into three categories:
2.3.2 Stand Alone Embedded System:
These systems takes the input in the form of electrical signals from transducers or
commands from human beings such as pressing of a button etc.., process them and
produces desired output. This entire process of taking input, processing it and giving
output is done in standalone mode. Such embedded systems comes under stand alone
embedded systems
Eg: microwave oven, air conditioner etc..
2.3.3 Real-time embedded systems:
Embedded systems which are used to perform a specific task or operation in a
specific time period those systems are called as real-time embedded systems. There are
two types of real-time embedded systems.
Hard Real-time embedded systems:

These embedded systems follow an absolute dead line time period i.e.., if the
tasking is not done in a particular time period then there is a cause of damage to the entire
equipment.
Eg: consider a system in which we have to open a valve within 30 milliseconds. If this
valve is not opened in 30 ms this may cause damage to the entire equipment. So in such
cases we use embedded systems for doing automatic operations.
Soft Real Time embedded systems:

11
Eg: Consider a TV remote control system, if the remote control takes a few
milliseconds delay it will not cause damage either to the TV or to the remote control.
These systems which will not cause damage when they are not operated at considerable
time period those systems comes under soft real-time embedded systems.
2.3.4 Network communication embedded systems:
A wide range network interfacing communication is provided by using embedded
systems.
Eg:
Consider a web camera that is connected to the computer with internet can be
used to spread communication like sending pictures, images, videos etc.., to
another computer with internet connection throughout anywhere in the world.

Consider a web camera that is connected at the door lock.

Whenever a person comes near the door, it captures the image of a person and
sends to the desktop of your computer which is connected to internet. This gives an
alerting message with image on to the desktop of your computer, and then you can open
the door lock just by clicking the mouse. Fig: 2.2 show the network communications in
embedded systems.

Fig 2.2: Network communication embedded systems

2.3.5 Different types of processing units:

12
The central processing unit (c.p.u) can be any one of the following
microprocessor, microcontroller, digital signal processing.
Among these Microcontroller is of low cost processor and one of the main
advantage of microcontrollers is, the components such as memory, serial
communication interfaces, analog to digital converters etc.., all these are built on a
single chip. The numbers of external components that are connected to it are very
less according to the application.

Microprocessors are more powerful than microcontrollers. They are used in major
applications with a number of tasking requirements. But the microprocessor
requires many external components like memory, serial communication, hard
disk, input output ports etc.., so the power consumption is also very high when
compared to microcontrollers.

Digital signal processing is used mainly for the applications that particularly
involved with processing of signals

2.4 APPLICATIONS OF EMBEDDED SYSTEMS:


2.4.1 Consumer applications:
At home we use a number of embedded systems which include microwave oven,
remote control, vcd players, dvd players, camera etc.

Fig2.3: Automatic coffee makes equipment

2.4.2 Office automation:


We use systems like fax machine, modem, printer etc

13
Fig2.4: Fax machine Fig2.5: Printing machine

2.4.3. Industrial automation:


Today a lot of industries are using embedded systems for process control. In
industries we design the embedded systems to perform a specific operation like
monitoring temperature, pressure, humidity ,voltage, current etc.., and basing on these
monitored levels we do control other devices, we can send information to a centralized
monitoring station.

Fig2.6: Robot
In critical industries where human presence is avoided there we can use robots
which are programmed to do a specific operation.

2.4.5 Computer networking:


Embedded systems are used as bridges routers etc..

14
Fig2.7: Computer networking
2.4.6 Tele communications:
Cell phones, web cameras etc.

Fig2.8: Cell Phone Fig2.9: Web camera

15
CHAPTER 2: SYSTEM ENVIRONMENT AND DESIGN ELEMENTS

The Block diagram of the process flow is shown in Figure 1.1. The power
transmitted from the sweep generator is flowing through the strip line dual directional
coupler and the output voltage corresponding to the incident power level is detected by
the logarithmic detector 1 coming from port 1of the coupler and the reflection of the
through line power due to the mis-matchment of the antenna with the system causes the
reflected power and is detected by the logarithmic detector 2 coming from port 4 of the
coupler. The remaining ports of the strip line dual directional coupler are matched
terminated.
The detected output voltage levels are fed to the ADC of the logic Analyzer which in
turn applied to the micro controller AT 89C55 and are analyzed and various parameters
such as incident power Pi, reflected power Pr, corresponding to the voltage levels detected
by the detector, reflection coefficient K, Voltage standing wave ratio S and return loss rl
are displayed on to the LCD display according to the key press from the key pad.

Log detector 1
AD
8313
1 2
RF
Directional Coupler O
Source I Tx. Antenna

3 4
AD
8313 Log detector 2
ADC

Display Micro Controller Key Pad

Figure 2.1: Block diagram of through line power parameter measurement and display

16
2.1 DUAL DIRECTIONAL COUPLERS:
In any microwave measurements and measuring equipment, the directional coupler
has become a virtually indispensable measurement tool. Directional couplers and power
dividers are passive microwave components used for power division or combining. In
power division, an input signal is divided by the coupler into two or more signals of less
power. The coupler may be three-port component, with or without losses, or may be a
four-port component. Three-port networks take the form of T-injunctions and other
power dividers while the four-port networks take the form of directional couplers and
hybrids. Power dividers are generally of equal division (3dB) type, but unequal power
divisions are also possible. Directional couplers can be designed for arbitrary power
division, while hybrid junctions usually have equal power division. Hybrid junctions
have either a 90O (quadrature) or a 180O (magic-T) phase shift between their output ports.
2.1.1 Definition of the Coupler:
An ideal coupler is a device which is used to couple power from one network or
device to the other network or device in a desired manner without any loss of the energy.
These couplers can be realized using transmission lines.
2.1.2 Properties:
Dual directional coupler comprises of two directional couplers connected back-to-back
to monitor both forward and reflected power with minimal perturbation to the main line
signal. A Directional coupler is a four port passive and reciprocal network in which two
transmission lines are coupled in such a way that the output at a port of one transmission
line depends on the direction of propagation on the other. The two transmission lines are
called main and auxiliary lines (secondary line).

Primary Line
Port 1 ( Pi )
Port 2 ( Pt )
Coupling
Device

Port 4 ( Pb) Port 3 ( Pf )


Secondary Line

Figure 2.2 Representation of Forward wave directional coupler

17
Where Pi is incident power
Pt is power in the through port
Pb is power in the isolated port
Pf is power coupled
The ideal directional coupler has the following properties:
1. A wave incident in port 1 couples power into ports 2 and 3 but not into port 4.
2. Similarly power incident in port 4 couples into port 2 and 3 but and into port 1.
Thus ports 1 and 4 are uncoupled.
3. For waves incident in port 2 or 3 the power will be coupled into port1 and 4 only,
so that ports 2 and 3 are uncoupled.
4. All four ports are matched. That is, if three ports are terminated in matched loads,
the fourth port appears to terminate in a matched load, and an incident wave in
this port suffers no reflection.
The backward wave directional coupler also have the same properties as the forward
wave directional coupler but the only difference is that, in a backward wave directional
coupler both the coupled port and the isolated port are interchanged. The backward wave
directional coupler is used in this project.
The two commonly used symbols for directional couplers, and power flow conventions
are as follows.

Input (1) Through (2)

Isolated (4) Coupled (3)

Input (1) Through (2)

Isolated (4) Coupled (3)

Fig 2.3. Power flow conventions of the directional coupler

18
2.1.3 Need for directional couplers:
It provides a simple, convenient and accurate means of sampling microwave
energy without moving parts and without the need for adjustments.
Unlike older methods of power sampling involving probes or couplings, the
directional coupler also provides the important capability of separating forward
signal from reflected power.
By selecting energy traveling only in one direction, accurate VSWR
measurements can be made automatically, eliminating the mechanical
motion needed with a slotted line.
Attenuation measurements become accurate when directional couplers are used
since reflection errors are eliminated.
2.1.4 Coupler parameters:

The performance and suitability of a directional coupler for a particular application is


determined by the following parameters.

Coupling Co-efficient (C):


The coupling co-efficient C is the ratio expressed in decibels of the power incident or
power fed into the main port, to the coupled port power when all ports are terminated by
matched terminations. Mathematically,
C = 10 log10 (Pi / Pt) dB -------------- (2.1)
The parameter C defines the degree of coupling; the smaller is C, the greater is the
power coupled. It also indicates the amount of attenuation with in the coupler.
The choice of the specific value of coupling coefficient will usually depend upon the
power levels involved. When an auxiliary port is used to feed a measuring device, the
coupling must provide adequate signal levels without overloading the equipment. It must
also be remembered that any coupler takes power out of main line, the magnitude of this
drain being depend upon the coupling between the main and the auxiliary lines. In
specifying coupling coefficient, it may be necessary to consider the amount of power loss
in the portion of the system following the coupler.
Directivity (D):
The power coupled by a directional coupler is measured in terms of directivity. The
directivity D of a coupler is defined as the measure of the couplers ability to isolate

19
forward and backward waves. Reflection less terminations are connected to all ports.
Mathematically,
D = 10 log10 (Pf / Pb) dB ---------------- (2.2)
D is measure of the discrimination of a directional coupler between the forward and
backward waves in the main line. In power measuring applications, where absolute value
of the sample is of significant value, reverse coupling into the auxiliary line will alter this
magnitude, which results measurement errors. Errors from reflected power can be severe
when the directivity is not adequate.
Isolation (I):
The capacity of the directional coupler to isolate coupled port from main port is
expressed in terms of the parameter isolation, I. It is defined as the ratio, expressed in
decibels, of the power incident in the main arm to the backward power coupled in the
auxiliary arm, while all other ports are terminated with matched terminations.
Mathematically,
I = 10 log10 (Pi / Pb) dB ------------------ (2.3)
The above three parameters are related as follows
I = D + C dB ------------------ (2.4)
Insertion loss (L):
Insertion loss, L, measures the power loss arising in a line when a directional coupler
is inserted in a transmission system. It is defined as the ratio, expressed in decibels, of the
power incident to the power transmitted in the main line of the coupler when the auxiliary
arms are matched terminated. Mathematically,
L = 10 log10 (Pi / Pt) dB -------------------- (2.5)
For an ideal coupler D and I are infinite and C and L are zero. If the coupler is not
absolutely symmetric there may be as many parameters at the port such as C1, C2, C3,
C4, D1, D2, D3, D4 etc.
The above four are the basic parameters of the coupler. For designing purposes other
parameters of the coupler have to be specified which are given below.
VSWR (Voltage Standing Wave Ratio):
The standing wave ratio measured by a reflectometer coupler terminated by a
reflection less termination, and fed from a non-reflecting generator.
In waveguide couplers, where the coupling between main and auxiliary lines
accomplished through holes and slots, VSWR can be held at very low levels.

20
Bandwidth:
The range of frequencies with in which performance, with respect to some
characteristics falls with in specific limits is specified as bandwidth.
For laboratory applications, it is customary to select couplers with multi octave
bandwidth as possible, simply because broad bandwidth affords greater flexibility in
handling changing day-to-day measurement tasks. Where bandwidth is under
consideration, it should be noted that broad frequency range is usually accompanied by
reduced directivity and increased VSWR.
Frequency Sensitivity (Flatness):
The maximum peak-to-peak variation in coupling coefficient that may be expected
over a specified frequency band, when where a band of frequencies must be sampled, as
in swept frequency measurements, the flatness or frequency sensitivity of the coupler is of
major importance. Manufacturers differ in the method of specifying frequency
sensitivity. In some instances, variation of coupling with frequency is expressed as the
deviation from the nominal value, in others as the excursion around the mean value of
coupling over the range. When the couplers are to be used over a band of frequencies,
manufactures may provide a calibration chart showing the actual coupling at specified
frequencies across the band.
Power rating:
Power ratings for directional couplers are usually specified for both CW power and
peak pulse power, in both forward and reverse directions. These ratings represent the
maximum levels at which the unit can operate without altering its characteristics.
2.1.5 Classification of couplers:
The classification of couplers is not unique. This may be based on one of any sets of
conditions and particular sets in one scheme rarely coincide with those in another.
Examples of such schemes are
Co or Contra directional coupling between parallel wave-guides or transmission
lines:
In a co directional coupler the coupled wave travels in the same direction as that of
the wave in the main line. This is also called as Forward wave coupler. In the contra
directional coupler, the coupled wave travels in the opposite direction as that of the wave
in the main line, i.e., wave is coupled backwards. This is also called as Backward Wave
Coupler.

21
Tight Couplers and Loose Couplers:
This type of classification depends upon the amount of coupling, for tight couplers
(for example 3 dB) and for loose couplers (for example 20 dB). In tight couplers, the
spacing between the strips is very small and in loose couplers, the spacing between the
strips is more when compared with tight couplers.
Interference or Intrinsic Coupling:
This applies to coupling between wave-guides or transmission lines by means of a
longitudinal coupling (discrete or continuous). In interference coupler, the individual
apertures, or elemental parts of continuous aperture are not themselves directional in their
coupling, but the individual coupled waves tend to reinforce in one direction of
propagation and to interfere destructively in the other. In the case of intrinsic coupling,
the individual apertures are themselves directional in their coupling properties. In this
case the apertures may be cascaded to give an additional interference effect, which
enhances the directivity.
Classification by phase division:
Most types of directional couplers are classified as either 90O (Quadrature) couplers
or as 180O (magic T type) couplers, at least at their mid band frequency. They usually
retain their 90O or 180O property with some tolerance over the operating band, but some
types (asymmetric) do not.
Rectangular Wave-guide:
In the case of rectangular wave-guide directional couplers, the coupling is often
classified as either narrow-to-narrow wall, broad to broad wall, or as narrow-to-broad
wall. The first two methods are most common, and are called simple broad-wall or
narrow-wall couplers respectively.
Classification by the Guiding system:
This merely states the types of guiding system, in which the directional couplers are
designed, e.g., rectangular, or circular wave guides, coaxial and strip transmission lines,
quasi-optical guides, etc.,
Coaxial directional couplers are offered for use at frequencies from 100 KHz to 50 GHz
and can be obtained with any of the standard or precision miniature coaxial connectors.
Dual directional couplers, which permit simultaneous sampling of both forward and
reflected energy, are available for both wave guide and coaxial systems.

22
2.3 ANALOG TO DIGITAL CONVERTER
The ADC0808, ADC0809 data acquisition component is a monolithic CMOS device
with an 8-bit analog-to-digital converter, 8-channel multiplexer and microprocessor
compatible control logic. The 8-bit A/D converter uses successive approximation as the
conversion technique. The converter features a high impedance chopper stabilized
comparator, a 256R voltage divider with analog switch tree and a successive
approximation register. The 8-channel multiplexer can directly access any of 8-single-
ended analog signals. The device eliminates the need for external zero and full-scale
adjustments. Easy interfacing to microprocessors is provided by the latched and decoded
multiplexer address inputs and latched TTL TRI-STATE outputs. The design of the
ADC0808, ADC0809 has been optimized by incorporating the most desirable aspects of
several A/D conversion techniques. The ADC0808, ADC0809 offers high speed, high
accuracy, minimal temperature dependence, excellent long-term accuracy and
repeatability, and consumes minimal power. These features make this device ideally
suited to applications from process and machine control to consumer and automotive
applications. For 16-channel multiplexer with common output (sample/hold port) see
ADC0816 data sheet. (See AN-247 for more information.)
2.3.1 Features:
1) Easy interface to all microprocessors
2) Operates ratio metrically or with 5 VDC or analog span adjusted voltage reference
3) No zero or full-scale adjust required
4) 8-channel multiplexer with address logic
5) 0V to 5V input range with single 5V power supply
6) Outputs meet TTL voltage level specifications

2.3.2 Key Specifications:


1) Resolution 8 Bits
2) Total Unadjusted Error 12 LSB and 1 LSB
3) Single Supply 5 VDC
4) Low Power 15 mW
5) Conversion Time 100 s

23
Fig 2.26 Internal Block Diagram of ADC0808
PIN DIAGRAM OF ADC0808

Fig 2.27 Pin diagram of ADC 0808

2.3.3 Functional Description:


Multiplexer: The device contains an 8-channel single-ended analog signal multiplexer. A
particular input channel is selected by using the address decoder. Table 1 shows the input
states for the address lines to select any channel. The address is latched into the decoder
on the low-to-high transition of the address latch enable signal.
Selected Analog ADDRESS LINE
Channel C B A
IN0 L L L

24
IN1 L L H
IN2 L H L
IN3 L H H
IN4 H L L
IN5 H L H
IN6 H H L
IN7 H H H

TABLE 2.8:Selection of ADC Channels

CONVERTER CHARACTERISTICS
The Converter: The heart of this single chip data acquisition system is its 8-bit analog-
to-digital converter. The converter is designed to give fast, accurate, and repeatable
conversions over a wide range of temperatures. The converter is partitioned into 3 major
sections: the 256R ladder network, the successive approximation register, and the
comparator. The converters digital outputs are positive true. The 256R ladder network
approach (Figure 1) was chosen over the conventional R/2R ladder because of its
inherent monotonicity, which guarantees no missing digital codes. Monotonic is
particularly important in closed loop feedback control systems. A non-monotonic
relationship can cause oscillations that will be catastrophic for the system. Additionally,
the 256R network does not cause load variations on the reference voltage. The bottom
resistor and the top resistor of the ladder network in Figure 1 are not the same value as
the remainder of the network. The difference in these resistors causes the output
characteristic to be symmetrical with the zero and full-scale points of the transfer curve.
The first output transition occurs when the analog signal has reached +12 LSB and
succeeding output transitions occur every 1 LSB later up to full-scale. The successive
approximation register (SAR) performs 8 iterations to approximate the input voltage. For
any SAR type converter, n-iterations are required for an n-bit converter. In the ADC0808,
ADC0809, the approximation technique is extended to 8 bits using the 256R network.
The A/D converters successive approximation register (SAR) is reset on the positive
edge of the start conversion start pulse. The conversion is begun on the falling edge of the
start conversion pulse. A conversion in process will be interrupted by receipt of a new
start conversion pulse. Continuous conversion may be accomplished by tying the end-of-
conversion (EOC) output to the SC input. If used in this mode, an external start
conversion pulse should be applied after power up. End-of-conversion will go low
between 0 and 8 clock pulses after the rising edge of start conversion. The most important

25
section of the A/D converter is the comparator. It is this section which is responsible for
the ultimate accuracy of the entire converter. It is also the comparator drift which has the
greatest influence on the repeatability of the device. A chopper-stabilized comparator
provides the most effective method of satisfying all the converter requirements. The
chopper-stabilized comparator converts the DC input signal into an AC signal. This signal
is then fed through a high gain AC amplifier and has the DC level restored. This
technique limits the drift component of the amplifier since the drift is a DC component
which is not passed by the AC amplifier. This makes the entire A/D converter extremely
insensitive to temperature, long term drift and input offset errors.
2.4 MICRO CONTROLLER:
AT89C55 family is the industrys most popular and most widely used 8-bit micro
controller in 8051 family, with the following features:
2.4.1 Features:
i) 8-bit CPU optimized for control applications
ii) 64K Program Memory address space
iii) 64K Data Memory address space
iv) 20K bytes of Reprogrammable Flash programmable memory
v) 256 bytes of on-chip Data RAM
vi) 32 Programmable I/O lines
vii) Three 16-bit timer/counters
viii) Programmable full duplex serial port
ix) 6-vector two-level interrupt structure
x) On-chip clock oscillator
The basic architectural structure of this 8052 core is shown in the following figure. The
entire device features such as on-chip timers and counters, port assignments, UART, and
interrupts are controlled using a special set of registers called Special Function Registers
(SFRs).
2.4.2 Memory Organization:
All AT89C55 devices have separate address space for Program and Data Memory.
The logical separation of Program and Data Memory allows the Data Memory to be
accessed by 8-bit addresses, which can be more quickly stored and manipulated by an 8-
bit CPU. Nevertheless, 16-bit Data Memory addresses can also be generated through the
DPTR register. Program Memory can only be read, not written to. There can be up to 64K

26
bytes of Program Memory. The read strobe for external Program Memory is the signal
PSEN (Program Store Enable).Up to 64K bytes of external RAM can be addressed
in the external Data Memory. The CPU generates read and write signals RD and WR, as
needed during external Data Memory accesses. External Program Memory and external
Data Memory can be combined if-desired by applying the RD, PSEN signals to the inputs
of an AND gate and using the output of the gate as the read strobe to the external Program
/ Data memory.

FFFFH

60KB
External
Code
Memory

3FFFH
4KB Internal
Code
Memory
0000H

Table 2.1 8052 Code Memory organization

PROGRAM MEMORY:
The Program memory can be up to 64k bytes long. The lower 4k can reside on-
chip. Figure 2.3 shows a map of the 80C52 program memory. The 8052 has 4Kbyte
internal program memory. If the EA pin is strapped to VCC, then program fetches to
addresses 0000H through 03FFFH are directed to the internal program memory. Program
fetches to addresses 1000H through FFFFH are directed to external program memory. If
the EA pin is strapped to Vss, then all program fetches are directed to external program
Memory. After reset the CPU begins execution from location 0000.
DATA MEMORY:
The AT89C55WD implements 256 bytes of on-chip RAM. The upper 128 bytes
occupy a parallel address space to the special function registers. That means the upper
128 bytes have the same addresses as the SFR space but are physically separate from SFR
space. When an instruction accesses an internal location above address 7FH,the address
mode used in the instruction specifies whether the CPU accesses the upper 128 bytes of
RAM or the SFR space. Instructions that use direct addressing access SFR space.

27
2.4.3 I/O ports:
Port0: Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin
can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as
high impedance inputs. Port0 can also be configured to be the multiplexed lower order
address/data bus during accesses to external program and data memory. In this mode,P0
has internal pull-ups. Port0 also receives the code bytes during Flash programming and
outputs the code Bytes during program verification. External pull-ups are required during
program verification.
Port1: Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The port1
output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they
are pulled high by the internal pull-ups and can be used as inputs. As inputs, port1 pins
that are externally being pulled low source current (IIL ) because of the internal pull-ups.
In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count
input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown
in the following table. Port 1 also receives the low-order address bytes during Flash
programming and verification.

Port Pin Alternate Functions


P1.0 T2(external count input to Timer/counter2),clock-out
P1.1 T2Ex(Timer/counter2 capture/reload trigger and direction
control)

Table 2.2 : Port1 Pins


Port 2: Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The port 2 output
buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are
pulled high by the internal pull-ups and can be used as inputs. As inputs, port2 pins that
are externally being pulled low source current (IIL) because of the internal pull-ups. Port2
emits the high-order address byte during fetches from external program memory and
during accesses to external data memory that use 16-bit addresses. In this application,
port2 uses strong internal pull-ups when emitting 1s.During accesses to external data
memory that use 8-bit addresses, port2 emits the contents of the P2 special Function
Register. Port2 also receives the high-order addresses bits and some control signals
during Flash Programming Verification.

28
Port3: Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The port1 output
buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are
pulled high by the internal pull-ups and can be used as inputs. As inputs, Port3 pins that
are externally being pulled low source current (IIL )because of the internal pull-ups.
Port3 also serves the functions of various special features of the AT89C51, as shown in
the following table. Port3 also receives some control signals Flash Programming and
Verification.
Port Pin Alternate Functions
P3.0 RXD(Serial input Port)
P3.1 TXD(Serial Output Port)
P3.2 INT0(External interrupt 0)
P3.3 INT1(External interrupt 1)
P3.4 T0(Timer 0 external input)
P3.5 T1(Timer 1 external input)
P3.6 WR(external data memory write strobe)
P3.7 RD(external data memory read strobe)

Table 2. 3: Port3 Pin functionality

2.4.4 Timers:
Timer 0&1: Timer 0 and Timer 1 in the AT89C55WD operate the same way as Timer
0&Timer 1in the AT 89C51.
Timer2: Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event
counter. The type of operation is selected by bit C/T2 in the SFR T2CON (Shown in
table2). Timer2 has three operating modes: capture, auto-reload (up or down counting),
and baud rate generator. The modes are selected by bits in TCON2 as shown in Table
3.Timer2 consists of two 8-bit registers, TH2, TL2.in the Timer function, TL2 register is
incremented every machine cycle. Since a machine cycle consists of 12 oscillator periods,

29
the count rate is 1/12 of the oscillator frequency. In the Counter function, the register is
incremented in response to a 1-to-0 transition at its corresponding external input pin, T2.
In this function, the external input is sampled during S5P2 of every machine cycle. When
the samples show a high in one cycle and a low in the next cycle, the count is
incremented. The new count value appears in the register during S3P1 of the cycle
following the one in which the transition was detected. Since two machine cycles (24
oscillator periods) are required to recognize a 1-to-0 transition, the maximum count rate is
1/24 of the oscillator frequency. To ensure that a given level is sampled at least once
before it changes, the level should be held for at least one full machine cycle.

Capture Mode:
In the capture mode, two options are selected by bit EXEN2 in T2CON. If EXEN2 =
0, Timer 2 is a 16-bit timer or counter which upon overflow sets bit TF2 in T2CON. This
bit can then be used to generate an interrupt. If EXEN2 = 1, Timer 2 performs the same
operation, but a 1-to-0 transition at external input T2EX also causes the current value in
TH2 and TL2 to be captured into RCAP2H and RCAP2L, respectively. In addition, the
transition at T2EX causes bit EXF2 in T2CON to be set. The EXF2 bit, like TF2, can
generate an interrupt. The capture mode is shown below fig 2.28.

Fig. 2.28 Timer2 in capture Mode


Auto-reload (Up or Down Counter):
Timer 2 can be programmed to count up or down when configured in its 16-bit auto-
reload mode. This feature is invoked by the DCEN (Down Counter Enable) bit located in
the SFR T2MOD (see Table 4). Upon reset, the DCEN bit is set to 0 so that timer 2 will
default to count up. When DCEN is set, Timer 2 can count up or down, depending on the
value of the T2EX pin. Figure 2 shows Timer 2 automatically counting up when DCEN =
0. In this mode, two options are selected by bit EXEN2 in T2CON.If EXEN2 = 0, Timer

30
2 counts up to 0FFFFH and then sets the TF2 bit upon overflow. The overflow also
causes the timer registers to be reloaded with the 16-bit value in RCAP2H and RCAP2L.
The values in Timer in Capture ModeRCAP2H and RCAP2L are preset by software. If
EXEN2 = 1, a 16-bit reload can be triggered either by an overflow or by a 1-to-0
transition at external input T2EX. This transition also sets the EXF2 bit. Both the TF2 and
EXF2 bits can generate an interrupt if enabled. Setting the DCEN bit enables Timer 2 to
count up or down, as shown in Figure 2.6. In this mode, the T2EX pin controls the
direction of the count. A logic 1 at T2EX makes Timer 2 count up. The timer will
overflow at 0FFFFH and set the TF2 bit. This overflow also causes the 16-bit value in
RCAP2H and RCAP2L to be reloaded into the timer registers, TH2 and TL2,
respectively. Logic 0 at T2EX makes Timer 2 count down. The timer underflows when
TH2 and TL2 equal the values stored in RCAP2H and RCAP2L. The underflow sets the
TF2 bit and causes 0FFFFH to be reloaded into the timer registers. The EXF2 bit toggles
whenever Timer 2 overflows or underflows and can be used as a 17th bit of resolution. In
this operating mode, EXF2does not flag an Interrupt.

Fig 2.29 Time2 in auto reload mode if DCEN=0

31
Fig 2.30 Time2 in auto reload mode if DCEN=1

2.2.5 Baud Rate Generator:


Timer 2 is selected as the baud rate generator by setting TCLK and/or RCLK in
T2CON (Table 2). Note that the baud rates for transmit and receive can be different if
Timer 2 is used for the receiver or transmitter and Timer 1 is used for the other function.
Setting RCLK and/or TCLK puts Timer 2 into its baud rate generator mode, as shown in
Figure. The baud rate generator mode is similar to the auto-reload mode, in that a rollover
in TH2 causes the Timer 2 registers to be reloaded with the 16-bit value in registers
RCAP2H and RCAP2L, which are preset by software. The baud rates in Modes 1 and 3
are determined by Timer 2s overflow rate according to the following equation. The
Timer can be configured for either timer or counter operation. In most applications, it is
configured for timer operation (CP/T2 = 0). The timer operation is different for Timer 2
when it is used as a baud rate generator. Normally a timer increments every machine

32
cycle (at 1/12 the oscillator frequency). As a baud rate generator, however, it increments
every state time (at 1/2 the oscillator frequency).The baud rate formula is given below.
Where (RCAP2H, RCAP2L) is the content of RCAP2H and RCAP2L taken as a 16-bit
unsigned integer. Timer 2 as a baud rate generator is shown in Figure 4. This figure is
valid only if RCLK or TCLK = 1 in T2CON. Note that a rollover in TH2 does not set TF2
and will not generate an interrupt. Note too, that if EXEN2 is set, a 1-to-0 transition in
T2EX will set EXF2 but will not cause a reload from (RCAP2H, RCAP2L) to (TH2,
TL2). Thus when Timer 2 is in use as a baud rate generator, T2EX can be used as an extra
external interrupt. Note that when Timer 2 is running (TR2 = 1) as a timer in the baud rate
generator mode, TH2 or TL2 should not be read from or written to. Under these
conditions, the Timer is incremented every state time, and the results of a read or write
may not be accurate. The RCAP2 registers may be read but should not be written to,
because a write might overlap a reload and cause write and/or reload errors. The timer
should be turned off (clear TR2) before accessing the Timer2 or RCAP2 registers.

Fig 2.31 Time2 in Baud Rate generator Mode

TABLE: TCON Timer/counter2 control register.


TCON Address=0C8H
Bit Addressable

33
TF2 EXF2 RCLK TCLK EXEN2 TR2 C/T2 CP/RL2
7 6 5 4 3 2 1 0

Symbol Function
TF2 Timer2 overflow flag set by hardware and cleared by software.TF2 cannot
be set when either RCLK=1 or CLK=1.
EXF2 Timer2 external flag set when either a capture or reload caused by a
negative transition on T2EX, and EXEN2=1.When Timer2 interrupt is
enabled, EXF2=1 will cause the CPU to vector to the timer2 interrupt
routine.EXF2 must be cleared by software.
RCLK Receive Clock Flag. When set, causes the serial port to use Timer2
overflow pulses for its receive clock in modes 1&3.RCLK=0 causes Timer1
overflow to be used for the receive clock.
TCLK Transmit clock Flag. When set, causes the serial port to use Timer2
overflow pulses for its transmit receive clock in modes 1&3.TCLK=0
causes Timer1 overflow to be used for the transmit clock.
EXEN2 Timer2 external enable flag. When set allows a capture or reload to occur as
a result of negative transition on T2EX if Timer2 is not being used to clock
the serial port.EXEN2 =0 causes timer2 to ignore events at T2EX.

TR2 Software START/STOP control for Timer2.A logic 1 starts the Timer.
C/T2 Timer or counter select. 0=Internal Timer. 1=External Event Counter.
CP/RL2 Capture/Reload flag. When set, capture will occur on negative transitions at
T2EX if EXEN2=1.When cleared, Auto-Reloads will occur either with
Timer2 overflow or negative transitions at T2ex when EXEN2=1.When
either RCLK=1 or TCLK=1 this bit is ignored and the timer is forced to
auto-reload on Timer2 overflow.

Table 2.5 : Timer 2 Operating Modes

RCLK+TCLK CP/RL2 TR2 MODE


0 0 1 16-bit Auto-reload

34
0 1 1 16-bit Capture
1 X 1 Baud Rate Generator
X X 0 OFF

2.2.6 UART:
The 8052 micro controller has one Universal Asynchronous Receiver Transmitter
(UART) also called as serial port. Serial port is full duplex, meaning it can transmit and
receive simultaneously. It is also receive buffered, meaning it can commence reception of
a second byte before a previously received byte has been read from the receive register.
(However, if the first byte still hasnt been read by the time reception of the second byte
is completed one of the bytes will be lost). The serial port receive end transmit registers
are both accessed as Special Function Register SBUF. Writing to SBUF load the transmit
register, and reading SBUF accesses a physically separate receive register. The serial port
operates in four operating modes, and the mode control is done by using SCON special
function register. The four operating modes are
Mode Description Baud rate
0 Shift register fosc/12
1 8-bit UART Variable
2 9-bit UART fosc/64 or fosc/32
3 9-bit UART Variable
Table2.6: UART operating modes.
2.2.7 Interrupts:
The AT89C55WD has a total of six interrupt vectors: two external interrupts (INT0
and INT1), three timer interrupts (Timers 0, 1, and 2), and the serial port interrupt. These
interrupts are all shown in Figure 6. Each of these interrupt sources can be individually
enabled or disabled by setting or clearing a bit in Special Function Register IE. IE also
contains a global disable bit, EA, which disables all interrupts at once. Note that Table
shows that bit position IE.6 is unimplemented. In the AT89C55WD, bit position IE.5 is
also unimplemented. User software should not write 1s to these bit positions, since they
may be used in future AT89 products. Timer 2 interrupt is generated by the logical OR of
bits TF2and EXF2 in register T2CON. Neither of these flags is cleared by hardware when
the service routine is vectored to. In fact, the service routine may have to determine
whether it was TF2 or EXF2 that generated the interrupt, and that bit will have to be
cleared in software. The Timer 0 and Timer 1 flags, TF0 and TF1, are set at S5P2 of the

35
cycle in which the timers overflow. The values are then polled by the circuitry in the next
cycle. However, the Timer 2 flag, TF2, is set at S2P2 and is polled in the same cycle in
which the timer overflows.
Interrupt Enable (IE) Register

(MSB) (LSB)
EA ---- ET2 ES ET1 EX1 ET0 EX0

Enable Bit =1 enables the interrupt


Enable Bit =0 disables the interrupt
Symbol Position Function
EA IE.7 Disables all interrupts .If EA=0,no interrupt is
acknowledged, If EA=1,each interrupt source
is individually enabled or disabled by setting
or clearing its enable bit.
----- IE.6 Not implemented, reserved for future
purpose*
ET2 IE.5 Enables or disables timer 2 overflow or
capture interrupt
ES IE.4 Enables or disables the serial port interrupt
ET1 IE.3 Enables or disables timer 1 overflow interrupt
EX1 IE.2 Enables or disables external interrupt1
ET0 IE.1 Enables or disables timer 0 overflow interrupt
EX0 IE.0 Enables or disables external interrupt 0.
* User software should never not write 1s to unimplemented bits, because they
be used in future AT89C55WD micro controllers.

Table 2. 7: Interrupt Register

2.2.8 crystal oscillator:


A crystal oscillator is an electronic oscillator circuit that uses the
mechanical resonance of a vibrating crystal of piezoelectric material to create an
electrical signal with a very precise frequency.[1][2][3] This frequency is commonly
used to keep track of time (as in quartz wristwatches), to provide a stable clock
signal for digital integrated circuits, and to stabilize frequencies for radio
transmitters and receivers. The most common type of piezoelectric resonator used
is the quartz crystal, so oscillator circuits incorporating them became known as
crystal oscillators,[1] but other piezoelectric materials including polycrystalline
ceramics are used in similar circuits.

36
Quartz crystals are manufactured for frequencies from a few tens of kilohertz to hundreds
of megahertz. More than two billion crystals are manufactured annually. Most are used for
consumer devices such as wristwatches, clocks, radios, computers, andcellphones. Quartz
crystals are also found inside test and measurement equipment, such as counters, signal
generators, andoscilloscopes.

Piezoelectricity was discovered by Jacques and Pierre Curie in 1880. Paul Langevin first
investigated quartz resonators for use in sonarduring World War I. The first crystal-
controlled oscillator, using a crystal of Rochelle salt, was built in 1917 and patented[4] in 1918
by Alexander M. Nicholson at Bell Telephone Laboratories, although his priority was disputed
by Walter Guyton Cady.[5] Cady built the first quartz crystal oscillator in 1921.[6] Other early
innovators in quartz crystal oscillators include G. W. Pierce and Louis Essen.

Quartz crystal oscillators were developed for high-stability frequency references during the
1920s and 1930s. Prior to crystals, radio stations controlled their frequency with tuned
circuits, which could easily drift off frequency by 3-4 kHz.[7] Since broadcast stations were
assigned frequencies only 10 kHz apart, interference between adjacent stations due to
frequency drift was a common problem.[7] In 1925 Westinghouse installed a crystal oscillator
in its flagship station KDKA,[7] and by 1926 quartz crystals were used to control the frequency
of many broadcasting stations and were popular with amateur radio operators.[8] In 1928,
Warren Marrison (of Bell Telephone Laboratories) developed the first quartz crystal clock.
With accuracies of up to 1 sec in 30 years (30 ms/year or 107),[6] quartz clocks replaced
precision pendulum clocks as the world's most accurate timekeepers until atomic clocks were
developed in the 1950s. Utilizing the early work at Bell Labs, AT&T eventually established
their Frequency Control Products division, later spun off and known today as Vectron
International.[9]

A number of firms started producing quartz crystals for electronic use during this time. Using
what are now considered primitive methods, about 100,000 crystal units were produced in
the United States during 1939. Through World War II crystals were made from natural quartz

37
crystal, virtually all from Brazil. Shortages of crystals during the war caused by the demand
for accurate frequency control of military and naval radios and radars spurred postwar
research into culturing synthetic quartz, and by 1950 a hydrothermal process for growing
quartz crystals on a commercial scale was developed at Bell Laboratories. By the 1970s
virtually all crystals used in electronics were synthetic.

In 1968, Juergen Staudte invented a photolithographic process for manufacturing quartz


crystal oscillators while working at North American Aviation (now Rockwell) that allowed them
to be made small enough for portable products like watches.[10]

Although crystal oscillators still most commonly use quartz crystals, devices using other
materials are becoming more common, such asceramic resonators.

Operation
A crystal is a solid in which the constituent atoms, molecules, or ions are packed in a
regularly ordered, repeating pattern extending in all three spatial dimensions.

Almost any object made of an elastic material could be used like a crystal, with
appropriate transducers, since all objects have natural resonantfrequencies of vibration. For
example, steel is very elastic and has a high speed of sound. It was often used in mechanical
filters before quartz. The resonant frequency depends on size, shape, elasticity, and
the speed of sound in the material. High-frequency crystals are typically cut in the shape of a
simple, rectangular plate. Low-frequency crystals, such as those used in digital watches, are
typically cut in the shape of a tuning fork. For applications not needing very precise timing, a
low-cost ceramic resonator is often used in place of a quartz crystal.

When a crystal of quartz is properly cut and mounted, it can be made to distort in an electric
field by applying a voltage to an electrode near or on the crystal. This property is known
as electrostriction or inverse piezoelectricity. When the field is removed, the quartz will
generate an electric field as it returns to its previous shape, and this can generate a voltage.
The result is that a quartz crystal behaves like a circuit composed of
an inductor,capacitor and resistor, with a precise resonant frequency. (See RLC circuit.)

Quartz has the further advantage that its elastic constants and its size change in such a way
that the frequency dependence on temperature can be very low. The specific characteristics
will depend on the mode of vibration and the angle at which the quartz is cut (relative to its
crystallographic axes).[11] Therefore, the resonant frequency of the plate, which depends on
its size, will not change much, either. This means that a quartz clock, filter or oscillator will
remain accurate. For critical applications the quartz oscillator is mounted in a temperature-
controlled container, called a crystal oven, and can also be mounted on shock absorbers to
prevent perturbation by external mechanical vibrations.

38
Modeling
Electrical model[edit]

A quartz crystal can be modelled as an electrical network with a low-impedance (series)


and a high-impedance (parallel) resonance points spaced closely together. Mathematically
(using the Laplace transform), the impedance of this network can be written as:

or

Adding additional capacitance across a crystal will cause the parallel resonance to shift
downward. Adding additional inductance across a crystal will cause the resonance to shift
upward. This can be used to adjust the frequency at which a crystal oscillates. Crystal
manufacturers normally cut and trim their crystals to have a specified resonance frequency
with a known "load" capacitance added to the crystal. For example, a crystal intended for a
6 pF load has its specified parallel resonance frequency when a 6.0 pF capacitor is placed
across it. Without this capacitance, the resonance frequency is higher.

Resonance modes[edit]
A quartz crystal provides both series and parallel resonance. The series resonance is a few
kilohertz lower than the parallel one. Crystals below 30 MHz are generally operated between
series and parallel resonance, which means that the crystal appears as an inductive
reactance in operation, this inductance forming a parallel resonant circuit with externally
connected parallel capacitance. Any small additional capacitance in parallel with the crystal
will thus pull the frequency downwards. Moreover, the effective inductive reactance of the
crystal can be reduced by adding a capacitor in series with the crystal. This latter technique
can provide a useful method of trimming the oscillatory frequency within a narrow range; in
this case inserting a capacitor in series with the crystal will raise the frequency of oscillation.
For a crystal to operate at its specified frequency, the electronic circuit has to be exactly that
specified by the crystal manufacturer. Note that these points imply a subtlety concerning

39
crystal oscillators in this frequency range: the crystal does not usually oscillate at precisely
either of its resonant frequencies.

Crystals above 30 MHz (up to >200 MHz) are generally operated at series resonance where
the impedance appears at its minimum and equal to the series resistance. For these crystals
the series resistance is specified (<100 ) instead of the parallel capacitance. To reach
higher frequencies, a crystal can be made to vibrate at one of its overtone modes, which
occur near multiples of the fundamental resonant frequency. Only odd numbered overtones
are used. Such a crystal is referred to as a 3rd, 5th, or even 7th overtone crystal. To
accomplish this, the oscillator circuit usually includes additional LC circuits to select the
desired overtone.

Temperature effects[edit]
A crystal's frequency characteristic depends on the shape or 'cut' of the crystal. A tuning fork
crystal is usually cut such that its frequency over temperature is a parabolic curve centered
around 25 C. This means that a tuning fork crystal oscillator will resonate close to its target
frequency at room temperature, but will slow down when the temperature either increases or
decreases from room temperature. A common parabolic coefficient for a 32 kHz tuning fork
crystal is 0.04 ppm/C.

In a real application, this means that a clock built using a regular 32 kHz tuning fork
crystal will keep good time at room temperature, lose 2 minutes per year at 10 degrees
Celsius above (or below) room temperature and lose 8 minutes per year at 20 degrees
Celsius above (or below) room temperature due to the quartz crystal.

Electrical oscillators[edit]
The crystal oscillator circuit sustains oscillation by taking a voltage signal from the
quartz resonator, amplifying it, and feeding it back to the resonator. The rate of expansion
and contraction of the quartz is the resonant frequency, and is determined by the cut and
size of the crystal. When the energy of the generated output frequencies matches the losses
in the circuit, an oscillation can be sustained.

An oscillator crystal has two electrically conductive plates, with a slice or tuning fork of quartz
crystal sandwiched between them. During startup, the controlling circuit places the crystal
into an unstable equilibrium, and due to the positive feedback in the system, any tiny fraction
of noise will start to get amplified, ramping up the oscillation. The crystal resonator can also
be seen as a highly frequency-selective filter in this system: it will only pass a very narrow
subband of frequencies around the resonant one, attenuating everything else. Eventually,
only the resonant frequency will be active. As the oscillator amplifies the signals coming out
of the crystal, the signals in the crystal's frequency band will become stronger, eventually

40
dominating the output of the oscillator. The narrow resonance band of the quartz
crystal filters out all the unwanted frequencies.

The output frequency of a quartz oscillator can be either that of the fundamental resonance
or of a multiple of that resonance, called aharmonic frequency. Harmonics are an exact
integer multiple of the fundamental frequency. But, like many other mechanical resonators,
crystals exhibit several modes of oscillation, usually at approximately odd integer multiples of
the fundamental frequency. These are termed "overtone modes", and oscillator circuits can
be designed to excite them. The overtone modes are at frequencies which are approximate,
but not exact odd integer multiples of that of the fundamental mode, and overtone
frequencies are therefore not exact harmonics of the fundamental.

High frequency crystals are often designed to operate at third, fifth, or seventh overtones.
Manufacturers have difficulty producing crystals thin enough to produce fundamental
frequencies over 30 MHz. To produce higher frequencies, manufacturers make overtone
crystals tuned to put the 3rd, 5th, or 7th overtone at the desired frequency, because they are
thicker and therefore easier to manufacture than a fundamental crystal that would produce
the same frequencyalthough exciting the desired overtone frequency requires a slightly
more complicated oscillator circuit.[12][13][14][15][16] A fundamental crystal oscillator circuit is simpler
and more efficient and has more pullability than a third overtone circuit. Depending on the
manufacturer, the highest available fundamental frequency may be 25 MHz to 66 MHz.[17][18]

A major reason for the wide use of crystal oscillators is their high Q factor. A typical Q value
for a quartz oscillator ranges from 104 to 106, compared to perhaps 102 for an LC oscillator.
The maximum Q for a high stability quartz oscillator can be estimated as Q = 1.6 107/f,
where f is the resonance frequency in megahertz.

One of the most important traits of quartz crystal oscillators is that they can exhibit very
low phase noise. In many oscillators, any spectral energy at the resonant frequency will be
amplified by the oscillator, resulting in a collection of tones at different phases. In a crystal
oscillator, the crystal mostly vibrates in one axis, therefore only one phase is dominant. This
property of low phase noise makes them particularly useful in telecommunications where
stable signals are needed, and in scientific equipment where very precise time references
are needed.

Environmental changes of temperature, humidity, pressure, and vibration can change the
resonant frequency of a quartz crystal, but there are several designs that reduce these
environmental effects. These include the TCXO, MCXO, and OCXO (defined below). These
designs (particularly the OCXO) often produce devices with excellent short-term stability. The
limitations in short-term stability are due mainly to noise from electronic components in the
oscillator circuits. Long term stability is limited by aging of the crystal.

Due to aging and environmental factors (such as temperature and vibration), it is difficult to
keep even the best quartz oscillators within one part in 1010 of their nominal frequency without

41
constant adjustment. For this reason, atomic oscillators are used for applications requiring
better long-term stability and accuracy.

Spurious frequencies[edit]
For crystals operated at series resonance or pulled away from the main mode by the
inclusion of a series inductor or capacitor, significant (and temperature-dependent) spurious
responses may be experienced. Though most spurious modes are typically some tens of
kilohertz above the wanted series resonance their temperature coefficient will be different
from the main mode and the spurious response may move through the main mode at certain
temperatures. Even if the series resistances at the spurious resonances appear higher than
the one at wanted frequency a rapid change in the main mode series resistance can occur at
specific temperatures when the two frequencies are coincidental. A consequence of these
activity dips is that the oscillator may lock at a spurious frequency (at specific temperatures).
This is generally minimized by ensuring that the maintaining circuit has insufficient gain to
activate unwanted modes

Spurious frequencies are also generated by subjecting the crystal to vibration. This
modulates the resonance frequency to a small degree by the frequency of the vibrations. SC-
cut crystals are designed to minimize the frequency effect of mounting stress and they are
therefore less sensitive to vibration. Acceleration effects including gravity are also reduced
with SC cut crystals as is frequency change with time due to long term mounting stress
variation. There are disadvantages with SC cut shear mode crystals, such as the need for the
maintaining oscillator to discriminate against other closely related unwanted modes and
increased frequency change due to temperature when subject to a full ambient range. SC cut
crystals are most advantageous where temperature control at their temperature of zero
temperature coefficient (turnover) is possible, under these circumstances an overall stability
performance from premium units can approach the stability of Rubidium frequency
standards.

Commonly used crystal frequencies[edit]


Main article: Crystal oscillator frequencies

Crystals can be manufactured for oscillation over a wide range of frequencies, from a few
kilohertz up to several hundred megahertz. Many applications call for a crystal oscillator
frequency conveniently related to some other desired frequency, so hundreds of standard
crystal frequencies are made in large quantities and stocked by electronics distributors. For

42
example, many (non-television) applications use 3.579545 MHz crystals since they are made
in large quantities for NTSC color television receivers. Using frequency dividers,frequency
multipliers and phase locked loop circuits, it is practical to derive a wide range of frequencies
from one reference frequency.

Crystal structures and materials[edit]

Common package types for quartz crystal products

Cluster of natural quartz crystals

A synthetic quartz crystal grown by the hydrothermal synthesis, about19 cm long and weighing
about127 grams

43
Tuning fork crystal used in a modern quartz watch.

Simple quartz crystal

Inside construction of a modern high performance HC-49 package quartz crystal

44
Flexural and thickness shear crystals

The most common material for oscillator crystals is quartz. At the beginning of the
technology, natural quartz crystals were used; now synthetic crystalline quartz grown
by hydrothermal synthesis is predominant due to higher purity, lower cost, and more
convenient handling. One of the few remaining uses of natural crystals is for pressure
transducers in deep wells. During World War II and for some time afterwards, natural quartz
was considered a strategic material by the USA. Large crystals were imported from Brazil.
Raw "lascas", the source material quartz for hydrothermal synthesis, are imported to USA or
mined locally by Coleman Quartz. The average value of as-grown synthetic quartz in 1994
was 60 USD/kg.[19]

Two types of quartz crystals exist: left-handed and right-handed, differing in the optical
rotation but identical in other physical properties. Both left and right-handed crystals can be
used for oscillators, if the cut angle is correct. In manufacture, right-handed quartz is
generally used.[20] The SiO4 tetrahedrons form parallel helices; the direction of twist of the
helix determines the left- or right-hand orientation. The helixes are aligned along the z-axis
and merged, sharing atoms. The mass of the helixes forms a mesh of small and large
channels parallel to the z-axis; the large ones are large enough to allow some mobility of
smaller ions and molecules through the crystal.[21]

Quartz exists in several phases. At 573 C at 1 atmosphere (and at higher temperatures and
higher pressures) the -quartz undergoesquartz inversion, transforms reversibly to -quartz.
The reverse process however is not entirely homogeneous and crystal twinning occurs. Care
has to be taken during manufacture and processing to avoid the phase transformation. Other
phases, e.g. the higher-temperature phases tridymite and cristobalite, are not significant for
oscillators. All quartz oscillator crystals are the -quartz type.

Infrared spectrophotometry is used as one of the methods for measuring the quality of the
grown crystals. The wavenumbers 3585, 3500, and 3410 cm1 are commonly used. The
measured value is based on the absorption bands of the OH radical and the infrared Q value
is calculated. The electronic grade crystals, grade C, have Q of 1.8 million or above; the

45
premium grade B crystals have Q of 2.2 million, and special premium grade A crystals have
Q of 3.0 million. The Q value is calculated only for the z region; crystals containing other
regions can be adversely affected. Another quality indicator is the etch channel density; when
the crystal is etched, tubular channels are created along linear defects. For processing
involving etching, e.g. the wristwatch tuning fork crystals, low etch channel density is
desirable. The etch channel density for swept quartz is about 10100 and significantly more
for unswept quartz. Presence of etch channels and etch pits degrades the resonator's Q and
introduces nonlinearities.[22]

Quartz crystals can be grown for specific purposes.

Crystals for AT-cut are the most common in mass production of oscillator materials; the
shape and dimensions are optimized for high yield of the required wafers. High-purity quartz
crystals are grown with especially low content of aluminium, alkali metal and other impurities
and minimal defects; the low amount of alkali metals provides increased resistance to
ionizing radiation. Crystals for wrist watches, for cutting the tuning fork 32768 Hz crystals, are
grown with very low etch channel density.

Crystals for SAW devices are grown as flat, with large X-size seed with low etch channel
density.

Special high-Q crystals, for use in highly stable oscillators, are grown at constant slow speed
and have constant low infrared absorption along the entire Z axis. Crystals can be grown as
Y-bar, with a seed crystal in bar shape and elongated along the Y axis, or as Z-plate, grown
from a plate seed with Y-axis direction length and X-axis width.[20] The region around the seed
crystal contains a large number of crystal defects and should not be used for the wafers.

Crystals grow anisotropically; the growth along the Z axis is up to 3 times faster than along
the X axis. The growth direction and rate also influences the rate of uptake of impurities. [23] Y-
bar crystals, or Z-plate crystals with long Y axis, have four growth regions usually called +X, -
X, Z, and S.[24] The distribution of impurities during growth is uneven; different growth areas
contain different levels of contaminants. The z regions are the purest, the small occasionally
present s regions are less pure, the +x region is yet less pure, and the -x region has the
highest level of impurities. The impurities have a negative impact on radiation hardness,
susceptibility to twinning, filter loss, and long and short term stability of the
crystals.[25] Different-cut seeds in different orientations may provide other kinds of growth
regions.[26] The growth speed of the -x direction is slowest due to the effect of adsorption of
water molecules on the crystal surface; aluminium impurities suppress growth in two other
directions. The content of aluminium is lowest in z region, higher in +x, yet higher in -x, and
highest in s; the size of s regions also grows with increased amount of aluminium present.
The content of hydrogen is lowest in z region, higher in +x region, yet higher in s region, and
highest in -x.[27] Aluminium inclusions transform into color centers with gamma ray irradiation,
causing a darkening of the crystal proportional to the dose and level of impurities; the
presence of regions with different darkness reveals the different growth regions.

46
The dominant type of defect of concern in quartz crystals is the substitution of an Al(III) for
a Si(IV) atom in the crystal lattice. The aluminium ion has an associated interstitial charge
compensator present nearby, which can be a H+ ion (attached to the nearby oxygen and
forming a hydroxyl group, called Al-OH defect), Li+ ion, Na+ ion, K+ ion (less common), or
an electron hole trapped in a nearby oxygen atom orbital. The composition of the growth
solution, whether it is based on lithium or sodium alkali compounds, determines the charge
compensating ions for the aluminium defects. The ion impurities are of concern as they are
not firmly bound and can migrate through the crystal, altering the local lattice elasticity and
the resonant frequency of the crystal. Other common impurities of concern are e.g. iron(III)
(interstitial), fluorine, boron(III), phosphorus(V) (substitution), titanium(IV) (substitution,
universally present in magmatic quartz, less common in hydrothermal quartz), and
germanium(IV) (substitution). Sodium and iron ions can
cause inclusions of acnite andelemeusite crystals. Inclusions of water may be present in fast-
grown crystals; interstitial water molecules are abundant near the crystal seed. Another
defect of importance is the hydrogen containing growth defect, when instead of a Si-O-Si
structure, a pair of Si-OH HO-Si groups is formed; essentially a hydrolyzed bond. Fast-grown
crystals contain more hydrogen defects than slow-grown ones. These growth defects source
as supply of hydrogen ions for radiation-induced processes and forming Al-OH defects.
Germanium impurities tend to trap electrons created during irradiation; the alkali metal
cations then migrate towards the negatively charged center and form a stabilizing complex.
Matrix defects can also be present; oxygen vacancies, silicon vacancies (usually
compensated by 4 hydrogens or 3 hydrogens and a hole), peroxy groups, etc. Some of the
defects produce localized levels in the forbidden band, serving as charge traps; Al(III) and
B(III) typically serve as hole traps while electron vacancies, titanium, germanium, and
phosphorus atoms serve as electron traps. The trapped charge carriers can be released by
heating; their recombination is the cause of thermoluminescence.

The mobility of interstitial ions depends strongly on temperature. Hydrogen ions are mobile
down to 10 K, but alkali metal ions become mobile only at temperatures around and above
200 K. The hydroxyl defects can be measured by near-infrared spectroscopy. The trapped
holes can be measured by electron spin resonance. The Al-Na+ defects show as an acoustic
loss peak due to their stress-induced motion; the Al-Li+ defects do not form a potential well so
are not detectable this way.[28] Some of the radiation-induced defects during their thermal
annealing produce thermoluminescence; defects related to aluminium, titanium, and
germanium can be distinguished.[29]

Swept crystals are crystals that have undergone a solid-state electrodiffusion purification
process. Sweeping involves heating the crystal above 500 C in a hydrogen-free
atmosphere, with a voltage gradient of at least 1 kilovolt/cm, for several (usually over 12)
hours. The migration of impurities and the gradual replacement of alkali metal ions with
hydrogen (when swept in air) or electron holes (when swept in vacuum) causes a weak
electric current through the crystal; decay of this current to a constant value signals the end

47
of the process. The crystal is then left to cool, while the electric field is maintained. The
impurities are concentrated at the cathode region of the crystal, which is cut off afterwards
and discarded.[30] Swept crystals have increased resistance to radiation, as the dose effects
are dependent on the level of alkali metal impurities; they are suitable for use in devices
exposed to ionizing radiation, e.g. for nuclear and space technology.[31]Sweeping under
vacuum at higher temperatures and higher field strengths yields yet more radiation-hard
crystals.[32] The level and character of impurities can be measured by infrared
spectroscopy.[33] Quartz can be swept in both and phase; sweeping in phase is faster,
but the phase transition may induce twinning. Twinning can be mitigated by subjecting the
crystal to compression stress in the X direction, or an AC or DC electric field along the X axis
while the crystal cools through the phase transformation temperature region.[32]

Sweeping can be also used to introduce one kind of an impurity into the crystal. Lithium,
sodium, and hydrogen swept crystals are used for e.g. studying quartz behavior.

Very small crystals for high fundamental mode frequencies can be manufactured by
photolithography.[22]

Crystals can be adjusted to exact frequencies by laser trimming. A technique used in the
world of amateur radio for slight decrease of the crystal frequency may be achieved by
exposing crystals with silver electrodes to vapors of iodine, which causes a slight mass
increase on the surface by forming a thin layer of silver iodide; such crystals however had
problematic long-term stability. Another method commonly used is electrochemical increase
or decrease of silver electrode thickness by submerging a resonator in lapis dissolved in
water, citric acid in water, or water with salt, and using the resonator as one electrode, and a
small silver electrode as another.

By choosing the direction of current, one can either increase, or decrease the mass of
electrodes. Details were published in "Radio" magazine (3/1978) by UB5LEV.

Raising frequency by scratching off parts of the electrodes is advised against, as this may
damage the crystal and lower its Q factor. Capacitor trimmers can be also used for frequency
adjustment of the oscillator circuit.

Some other piezoelectric materials than quartz can be employed; e.g. single crystals
of lithium tantalate, lithium niobate, lithium borate,berlinite, gallium arsenide, lithium
tetraborate, aluminium phosphate, bismuth germanium oxide, polycrystalline zirconium
titanate ceramics, high-alumina ceramics, silicon-zinc oxide composite, or dipotassium
tartrate;[34][35] some materials may be more suitable for specific applications. An oscillator
crystal can be also manufactured by depositing the resonator material on the silicon chip
surface.[36] Crystals of gallium phosphate, langasite, langanite and langanate are about 10
times more pullable than the corresponding quartz crystals, and are used in some VCXO
oscillators.[37]

48
Stability and aging[edit]
This section is too long.
Considersplitting it into new
pages, addingsubheadings,
or condensing it.(July 2014)

The frequency stability is determined by the crystal's Q. It is inversely dependent on the


frequency, and on the constant that is dependent on the particular cut. Other factors
influencing Q are the overtone used, the temperature, the level of driving of the crystal, the
quality of the surface finish, the mechanical stresses imposed on the crystal by bonding and
mounting, the geometry of the crystal and the attached electrodes, the material purity and
defects in the crystal, type and pressure of the gas in the enclosure, interfering modes, and
presence and absorbed dose of ionizing and neutron radiation.

Temperature influences the operating frequency; various forms of compensation are used,
from analog compensation (TCXO) and microcontroller compensation (MCXO) to
stabilization of the temperature with a crystal oven (OCXO). The crystals possess
temperature hysteresis; the frequency at a given temperature achieved by increasing the
temperature is not equal to the frequency on the same temperature achieved by decreasing
the temperature. The temperature sensitivity depends primarily on the cut; the temperature
compensated cuts are chosen as to minimize frequency/temperature dependence. Special
cuts can be made with linear temperature characteristics; the LC cut is used in quartz
thermometers. Other influencing factors are the overtone used, the mounting and electrodes,
impurities in the crystal, mechanical strain, crystal geometry, rate of temperature change,
thermal history (due to hysteresis), ionizing radiation, and drive level.

Crystals tend to suffer anomalies in their frequency/temperature and resistance/temperature


characteristics, known as activity dips. These are small downward (in frequency) or upward
(in resistance) excursions localized at certain temperatures, with their temperature position
dependent on the value of the load capacitors.

Mechanical stresses also influence the frequency. The stresses can be induced by mounting,
bonding, and application of the electrodes, by differential thermal expansion of the mounting,
electrodes, and the crystal itself, by differential thermal stresses when there is a temperature
gradient present, by expansion or shrinkage of the bonding materials during curing, by the air
pressure that is transferred to the ambient pressure within the crystal enclosure, by the
stresses of the crystal lattice itself (nonuniform growth, impurities, dislocations), by the
surface imperfections and damage caused during manufacture, and by the action of gravity
on the mass of the crystal; the frequency can therefore be influenced by position of the
crystal. Other dynamic stress inducing factors are shocks, vibrations, and acoustic noise.
Some cuts are less sensitive to stresses; the SC (Stress Compensated) cut is an example.

49
Atmospheric pressure changes can also introduce deformations to the housing, influencing
the frequency by changing stray capacitances.

Atmospheric humidity influences the thermal transfer properties of air, and can change
electrical properties of plastics by diffusion of water molecules into their structure, altering
the dielectric constants and electrical conductivity.[38]

Other factors influencing the frequency are the power supply voltage, load impedance,
magnetic fields, electric fields (in case of cuts that are sensitive to them, e.g. SC), the
presence and absorbed dose of -particles and ionizing radiation, and the age of the crystal.

Crystals undergo slow gradual change of frequency with time, known as aging. There are
many mechanisms involved. The mounting and contacts may undergo relief of the built-in
stresses. Molecules of contamination either from the residual atmosphere, outgassed from
the crystal, electrodes or packaging materials, or introduced during sealing the housing can
be adsorbed on the crystal surface, changing its mass; this effect is exploited in quartz
crystal microbalances. The composition of the crystal can be gradually altered by outgassing,
diffusion of atoms of impurities or migrating from the electrodes, or the lattice can be
damaged by radiation. Slow chemical reactions may occur on or in the crystal, or on the inner
surfaces of the enclosure. Electrode material, e.g. chromium or aluminium, can react with the
crystal, creating layers of metal oxide and silicon; these interface layers can undergo
changes in time. The pressure in the enclosure can change due to varying atmospheric
pressure, temperature, leaks, or outgassing of the materials inside. Factors outside of the
crystal itself are e.g. aging of the oscillator circuitry (and e.g. change of capacitances), and
drift of parameters of the crystal oven. External atmosphere composition can also influence
the aging; hydrogen can diffuse through nickel housing. Helium can cause similar issues
when it diffuses through glass enclosures ofrubidium standards.[39]

Gold is a favored electrode material for low-aging resonators; its adhesion to quartz is strong
enough to maintain contact even at strong mechanical shocks, but weak enough to not
support significant strain gradients (unlike chromium, aluminium, and nickel). Gold also does
not form oxides; it adsorbs organic contaminants from the air, but these are easy to remove.
However, gold alone can undergo delamination; a layer of chromium is therefore sometimes
used for improved binding strength. Silver and aluminium are often used as electrodes;
however both form oxide layers with time that increases the crystal mass and lowers
frequency. Silver can be passivated by exposition to iodine vapors, forming a layer of silver
iodide. Aluminium oxidizes readily but slowly, until about 5 nm thickness is reached;
increased temperature during artificial aging does not significantly increase the oxide forming
speed; a thick oxide layer can be formed during manufacture by anodizing.[40] Exposition of
silver-plated crystal to iodine vapors can be also used in amateur conditions for lowering the
crystal frequency slightly; the frequency can be also increased by scratching off parts of the
electrodes, but that carries risk of damage to the crystal and loss of Q.

50
A DC voltage bias between the electrodes can accelerate the initial aging, probably by
induced diffusion of impurities through the crystal. Placing a capacitor in series with the
crystal and a several-megohm resistor in parallel can minimize such voltages.

Crystals suffer from minor short-term frequency fluctuations as well. The main causes of
such noise are e.g. thermal noise (which limits the noise floor), phonon scattering(influenced
by lattice defects), adsorption/desorption of molecules on the surface of the crystal, noise of
the oscillator circuits, mechanical shocks and vibrations, acceleration and orientation
changes, temperature fluctuations, and relief of mechanical stresses. The short-term stability
is measured by four main parameters: Allan variance (the most common one specified in
oscillator data sheets), phase noise, spectral density of phase deviations, and spectral
density of fractional frequency deviations. The effects of acceleration and vibration tend to
dominate the other noise sources; surface acoustic wave devices tend to be more sensitive
than bulk acoustic wave (BAW) ones, and the stress-compensated cuts are even less
sensitive. The relative orientation of the acceleration vector to the crystal dramatically
influences the crystal's vibration sensitivity. Mechanical vibration isolation mountings can be
used for high-stability crystals.

Crystals are sensitive to shock. The mechanical stress causes a short-term change in the
oscillator frequency due to the stress-sensitivity of the crystal, and can introduce a
permanent change of frequency due to shock-induced changes of mounting and internal
stresses (if the elastic limits of the mechanical parts are exceeded), desorption of
contamination from the crystal surfaces, or change in parameters of the oscillator circuit.
High magnitudes of shocks may tear the crystals off their mountings (especially in the case of
large low-frequency crystals suspended on thin wires), or cause cracking of the crystal.
Crystals free of surface imperfections are highly shock-resistant; chemical polishing can
produce crystals able to survive tens of thousands g.[41]

Phase noise plays significant role in frequency synthesis systems using frequency
multiplication; a multiplication of a frequency by N increases the phase noise power by N 2. A
frequency multiplication by 10 times multiplies the magnitude of the phase error by 10 times.
This can be disastrous for systems employing e.g. PLL or FSK technologies.

Crystals are somewhat sensitive to radiation damage. Natural quartz is much more sensitive
than artificially grown crystals, and sensitivity can be further reduced by sweeping the crystal
heating the crystal to at least 400 C in a hydrogen-free atmosphere in an electric field of at
least 500 V/cm for at least 12 hours. Such swept crystals have a very low response to steady
ionizing radiation. Some Si(IV) atoms are replaced with Al(III) impurities, each having a
compensating Li+ or Na+ cation nearby. Ionization produces electron-hole pairs; the holes are
trapped in the lattice near the Al atom, the resulting Li and Na atoms are loosely trapped
along the Z axis; the change of the lattice near the Al atom and the corresponding elastic
constant then causes a corresponding change in frequency. Sweeping removes the Li+ and
Na+ ions from the lattice, reducing this effect. The Al3+ site can also trap hydrogen atoms. All

51
crystals have a transient negative frequency shift after exposure to an X-ray pulse; the
frequency then shifts gradually back; natural quartz reaches stable frequency after 101000
seconds, with a negative offset to pre-irradiation frequency, artificial crystals return to a
frequency slightly lower or higher than pre-irradiation, swept crystals anneal virtually back to
original frequency. The annealing is faster at higher temperatures. Sweeping under vacuum
at higher temperatures and field strength can further reduce the crystal's response to X-ray
pulses.[32] Series resistance of unswept crystals increases after an X-ray dose, and anneals
back to a somewhat higher value for a natural quartz (requiring a corresponding gain reserve
in the circuit) and back to pre-irradiation value for synthetic crystals. Series resistance of
swept crystals is unaffected. Increase of series resistance degrades Q; too high increase can
stop the oscillations. Neutron radiation induces frequency changes by introducing
dislocations into the lattice by knocking out atoms, a single fast neutron can produce many
defects; the SC and AT cut frequency increases roughly linearly with absorbed neutron dose,
while the frequency of the BT cuts decreases.[42] Neutrons also alter the temperature-
frequency characteristics. Frequency change at low ionizing radiation doses is proportionally
higher than for higher doses. High-intensity radiation can stop the oscillator by
inducing photoconductivity in the crystal and transistors; with a swept crystal and properly
designed circuit the oscillations can restart within 15 microseconds after the radiation burst.
Quartz crystals with high levels of alkali metal impurities lose Q with irradiation; Q of swept
artificial crystals is unaffected. Irradiation with higher doses (over 105 rad) lowers sensitivity to
subsequent doses. Very low radiation doses (below 300 rad) have disproportionately higher
effect, but this nonlinearity saturates at higher doses. At very high doses, the radiation
response of the crystal saturates as well, due to the finite number of impurity sites that can
be affected.[31]

Magnetic fields have little effect on the crystal itself, as quartz is diamagnetic; eddy
currents or AC voltages can however be induced into the circuits, and magnetic parts of the
mounting and housing may be influenced.

After the power-up, the crystals take several seconds to minutes to "warm up" and stabilize
their frequency. The oven-controlled OCXOs require usually 310 minutes for heating up to
reach thermal equilibrium; the oven-less oscillators stabilize in several seconds as the few
milliwatts dissipated in the crystal cause a small but noticeable level of internal heating.[43]

Crystals have no inherent failure mechanisms; some have operated in devices for decades.
Failures may be, however, introduced by faults in bonding, leaky enclosures, corrosion,
frequency shift by aging, breaking the crystal by too high mechanical shock, or radiation-
induced damage when nonswept quartz is used.[44] Crystals can be also damaged by
overdriving.

The crystals have to be driven at the appropriate drive level. While AT cuts tend to be fairly
forgiving, with only their electrical parameters, stability and aging characteristics being
degraded when overdriven, low-frequency crystals, especially flexural-mode ones, may

52
fracture at too high drive levels. The drive level is specified as the amount of power
dissipated in the crystal. The appropriate drive levels are about 5 microwatts for flexural
modes up to 100 kHz, 1 microwatt for fundamental modes at 14 MHz, 0.5 microwatts for
fundamental modes 420 MHz, and 0.5 microwatts for overtone modes at 20
200 MHz.[45] Too low drive level may cause problems with starting the oscillator. Low drive
levels are better for higher stability and lower power consumption of the oscillator. Higher
drive levels, in turn, reduce the impact of noise by increasing the signal-to-noise ratio.[46]

The stability of AT cut crystals decreases with increasing frequency. For more accurate
higher frequencies it is better to use a crystal with lower fundamental frequency, operating at
an overtone.

Aging decreases logarithmically with time, the largest changes occurring shortly after
manufacture. Artificially aging a crystal by prolonged storage at 85 to 125 C can increase its
long-term stability.

A badly designed oscillator circuit may suddenly begin oscillating on an overtone. In 1972, a
train in Fremont, California crashed due to a faulty oscillator. An inappropriate value of the
tank capacitor caused the crystal in a control board to be overdriven, jumping to an overtone,
and causing the train to speed up instead of slow down.[4

2.2.9. LCD DISPLAY:


The LCD display used in this application is 16X2 character dot matrix LCD and it has
the following specifications.
5 x 8 dots includes cursor
Built - in controller (KS 0066 or Equivalent)
+ 5V power supply (Also available for + 3V)
1/16 duty cycle
LED can be driven by pin 1, pin 2, pin 15 or A and K
N.V. optional for + 3V power supply

53
LCD Background:

One of the most common devices attached to a micro controller is an LCD display. Some
of the most common LCDs connected to the many microcontrollers are 16x2 and 20x2
displays. This means 16 characters per line by 2 lines and 20 characters per line by 2
lines, respectively.

Basic 16x 2 Characters LCD

Figure 1: LCD Pin diagram

Pin description:

54
Pin No. Name Description
Pin no. 1 VSS Power supply (GND)
Pin no. 2 VCC Power supply (+5V)
Pin no. 3 VEE Contrast adjust
0 = Instruction input
Pin no. 4 RS
1 = Data input
0 = Write to LCD module
Pin no. 5 R/W
1 = Read from LCD module
Pin no. 6 EN Enable signal
Pin no. 7 D0 Data bus line 0 (LSB)
Pin no. 8 D1 Data bus line 1
Pin no. 9 D2 Data bus line 2
Pin no. 10 D3 Data bus line 3
Pin no. 11 D4 Data bus line 4
Pin no. 12 D5 Data bus line 5
Pin no. 13 D6 Data bus line 6
Pin no. 14 D7 Data bus line 7 (MSB)

Table 1: Character LCD pins with Microcontroller

The LCD requires 3 control lines as well as either 4 or 8 I/O lines for the data bus.
The user may select whether the LCD is to operate with a 4-bit data bus or an 8-bit data
bus. If a 4-bit data bus is used the LCD will require a total of 7 data lines (3 control lines
plus the 4 lines for the data bus). If an 8-bit data bus is used the LCD will require a total
of 11 data lines (3 control lines plus the 8 lines for the data bus).

The three control lines are referred to as EN, RS, and RW.

The EN line is called "Enable." This control line is used to tell the LCD that we are
sending it data. To send data to the LCD, our program should make sure this line is low
(0) and then set the other two control lines and/or put data on the data bus. When the
other lines are completely ready, bring EN high (1) and wait for the minimum amount of

55
time required by the LCD datasheet (this varies from LCD to LCD), and end by bringing
it low (0) again.

The RS line is the "Register Select" line. When RS is low (0), the data is to be
treated as a command or special instruction (such as clear screen, position cursor, etc.).
When RS is high (1), the data being sent is text data which should be displayed on the
screen. For example, to display the letter "T" on the screen we would set RS high.

The RW line is the "Read/Write" control line. When RW is low (0), the
information on the data bus is being written to the LCD. When RW is high (1), the
program is effectively querying (or reading) the LCD. Only one instruction ("Get LCD
status") is a read command. All others are write commands--so RW will almost always be
low.

Finally, the data bus consists of 4 or 8 lines (depending on the mode of operation
selected by the user). In the case of an 8-bit data bus, the lines are referred to as DB0,
DB1, DB2, DB3, DB4, DB5, DB6, and DB7.

Schematic:

Circuit Description:

Above is the quite simple schematic. The LCD panel's Enable and Register Select
is connected to the Control Port. The Control Port is an open collector / open drain output.

56
While most Parallel Ports have internal pull-up resistors, there is a few which don't.
Therefore by incorporating the two 10K external pull up resistors, the circuit is more
portable for a wider range of computers, some of which may have no internal pull up
resistors.

We make no effort to place the Data bus into reverse direction. Therefore we
hard wire the R/W line of the LCD panel, into write mode. This will cause no bus
conflicts on the data lines. As a result we cannot read back the LCD's internal Busy Flag
which tells us if the LCD has accepted and finished processing the last instruction. This
problem is overcome by inserting known delays into our program.

The 10k Potentiometer controls the contrast of the LCD panel. Nothing fancy
here. As with all the examples, I've left the power supply out. We can use a bench power
supply set to 5v or use an onboard +5 regulator. Remember a few de-coupling capacitors,
especially if we have trouble with the circuit working properly.

SETB RW

Handling the EN control line:

As we mentioned above, the EN line is used to tell the LCD that we are ready for
it to execute an instruction that we've prepared on the data bus and on the other control
lines. Note that the EN line must be raised/ lowered before/after each instruction sent to
the LCD regardless of whether that instruction is read or write text or instruction. In short,
we must always manipulate EN when communicating with the LCD. EN is the LCD's
way of knowing that we are talking to it. If we don't raise/lower EN, the LCD doesn't
know we're talking to it on the other lines.

Thus, before we interact in any way with the LCD we will always bring the EN line
low with the following instruction:

CLR EN

And once we've finished setting up our instruction with the other control lines and
data bus lines, we'll always bring this line high:

57
SETB EN

The line must be left high for the amount of time required by the LCD as specified
in its datasheet. This is normally on the order of about 250 nanoseconds, but checks the
datasheet. In the case of a typical microcontroller running at 12 MHz, an instruction
requires 1.08 microseconds to execute so the EN line can be brought low the very next
instruction. However, faster microcontrollers (such as the DS89C420 which executes an
instruction in 90 nanoseconds given an 11.0592 MHz crystal) will require a number of
NOPs to create a delay while EN is held high. The number of NOPs that must be inserted
depends on the microcontroller we are using and the crystal we have selected.

The instruction is executed by the LCD at the moment the EN line is brought low
with a final CLR EN instruction.

Checking the busy status of the LCD:

As previously mentioned, it takes a certain amount of time for each instruction to


be executed by the LCD. The delay varies depending on the frequency of the crystal
attached to the oscillator input of the LCD as well as the instruction which is being
executed.

While it is possible to write code that waits for a specific amount of time to allow the
LCD to execute instructions, this method of "waiting" is not very flexible. If the crystal
frequency is changed, the software will need to be modified. A more robust method of
programming is to use the "Get LCD Status" command to determine whether the LCD is
still busy executing the last instruction received.

The "Get LCD Status" command will return to us two tidbits of information; the
information that is useful to us right now is found in DB7. In summary, when we issue
the "Get LCD Status" command the LCD will immediately raise DB7 if it's still busy
executing a command or lower DB7 to indicate that the LCD is no longer occupied. Thus
our program can query the LCD until DB7 goes low, indicating the LCD is no longer
busy. At that point we are free to continue and send the next command.

Applications:

58
Medical equipment
Electronic test equipment
Industrial machinery Interface
Serial terminal
Advertising system
EPOS
Restaurant ordering systems
Gaming box
Security systems
R&D Test units
Climatizing units
PLC Interface
Simulators
Environmental monitoring
Lab development
Student projects
Home automation
PC external display

Table 2.9: LCD Display pins functionality

Pin Symbol Function


Number
1 Vss Ground
2 Vcc +5V power supply
3 VEE Power supply to control contrast
4 RS High to Low Register select signal, if
0command Register and 1 data Register
5 R/W R/W=0 for write,R/W=1 for Read
6 E H-L Enable signal
7 DB0 H-L Data Bus Line
8 DB1 H
9 DB2 H
10 DB3 H
11 DB4 H
12 DB5 H

59
13 DB6 H
14 DB7 H
15 A/Vee +4.2V for LED(RA=0)/Negative Voltage
Output
16 K Power supply for B/L(0V)

3: THEORITICAL ANALYSIS

Vout = V slope ( Pin + 100 dBm) volts. --------- (3.20)


And provided V slope = 18 mV = 0.018V.

60
In this project, requirement of two logarithmic detectors for the detection of
transmitted power and reflected power at the transmitting end and the reflecting end
respectively and the detected transmitted power and reflected power then be calculated
by using the formulae
v in
p i ( dBm) 100dBm
0.018
--------- (3.21)
v
p r ( dBm) out 100dBm
0.018
And adding the coupling factor (-30dB) of the directional coupler, these equations
becomes
v in
p i ( dBm) 70dBm
0.018
--------- (3.22)
v
p r ( dBm) out 70dBm
0.018
From this detected power levels, the corresponding return loss rl is calculated and the
reflection coefficient K and the voltage standing wave ratio S can be found from that
corresponding value of return loss. The formulae for calculating return loss rl, reflection
coefficient K, Voltage Standing wave Ratio S is given below.

rl = Pref - pinc Db --------- (3.23)


and from the equation rl = 20 log |K|, corresponding K and S values are given by
rl

K 10 20

1 | K | --------- (3.24)
S 1 | K |

All these values will be calculated from the detected out voltage by the logarithmic
detector and this calculations part is done in the RF Analyzer circuit i.e. in the
microcontroller circuitry.
3.6 RF ANALYZER CIRCUITRY:
The RF Analyzer circuitry basically consists of Analog to digital converter to convert
the detected output analog voltage into digital form and then the signal is given to the
controller. The microcontroller then analyzes the signals and calculates the remaining
required quantities stores and displays in accordance with the key pressed from the
keypad on to the LCD display.

61
The Analog to digital converter used here is ADC 0808. It supports 8 channel
multiplexer The 8-channel multiplexer can directly access any of 8-single-ended analog
signals but we supply only two analog signal to the ADC i.e incident voltage and
reflected voltage and these signals takes digital form using successive approximation
technique and the resolution used here is 8 bits.
The microcontroller is the heart of the RF analyzer circuitry as it calculates the
incident and reflected powers by taking the digital signals from the ADC and also
evaluates the required parameters like reflection coefficient, VSWR, return loss etc and
displays on to the LCD display in accordance with the key press from the keypad. The
microcontroller from ATMEL AT 89C55 is used. This controller best suited for this
project because of the code memory requirement as it supports 20 KB of reprogrammable
flash memory and is compatible with MCS-51 products.
The LCD display used in this application is 16X2 character dot matrix LCD as the
values can be conveniently shown with their units, and the key pad used here is the 5
button micro key pad switches.

CHAPTER 4: HARDWARE DESIGN

This chapter deals with the layout preparation for the directional coupler and
hardware element design for the RF analyzer circuitry. The layout design for the coupler

62
and the logarithmic detector are done by using Auto-CAD and the preparation of the
circuit schematic for RF analyzer circuitry is by using Or CAD.
The accuracy in developing the schematic and layout design decides the efficient
functioning of the hardware element fabricated. By considering the specifications
calculated theoretically and with the optimized values calculated from the simulation are
used in preparation of the layout design of the coupler and the logarithmic detector and
are shown.

4.3 ADC INTERFACING WITH 89C55WD:


ADC 0808 is a monolithic CMOS device with an 8-bit A/D converter 8-channel
multiplexer and micro controller compatible control logic. As per our design we require
four channels. So four channels can select by using two selection lines. So ADC 0808
pins 24(A0) and 25(A1) are connected to microcontroller pin nos P3.2&P3.3 resp. ADC
0808 pin 26 selection pin is connected to ground.
A2 A1 A0 SELECTED CHANNEL
0 0 0 CHANNEL 0
0 0 1 CHANNEL 1
0 1 0 CHANNEL 2
0 1 1 CHANNEL 3
In ADC 0808 Vref(+) & vref(-) set the reference voltages. In our design Vref(+)=5v and
vref(-)=GND. so the step size is 5v/256=19.53 mv. Steps to program the ADC0808
a) Select the analog channel by providing the bits A0, A1, A2 according the above table.
b) Activate the ALE (address Latch enable) pin. It needs a Low-to-High pulse to latch in
the address.
c) Activate SC (start of Conversion) by a High to Low pulse to initiate action.
d) Monitor the EOC (End of conversion) to see whether conversion is finished. High to
Low output indicates that the data is converted and is ready to pick up.
e) Activate OE (output enable) to read the data out of the ADC chip. A High to Low pulse
to the OE pin will bring digital data out of the chip.

63
SW1
SW TACT-SPST VCC
1 2
VCC
R19

CC5

R
RRRRRRRR
U5
1 39 R/S
2 P1.0 P0.0 38 EN
3 P1.1 P0.1 37 Lkey1
4 P1.2
P1.3
A P0.2
P0.3
36 key2
U1 5 35 key3
26 17 6 P1.4 T P0.4 34 key4
vi 27 IN0 D0 14 7 P1.5 P0.5 33 key5
vr 28 IN1 D1 15 8 P1.6 8 P0.6 32
1 IN2 D2 8 P1.7 P0.7
2 IN3 A D3 18 9 31 R15 VCC
IN4 D4 EA/VP
+5V
3
4 IN5 D D5
19
20
9
RESET C ALE/P
30
29
R
IN6 D6 PSEN
5
IN7 C D7
21 RX
TX
10
11 RXD 5
TXD
12
16 REF+ 0 A0
25
24
12
13 INT0 5 P2.7
28
27
REF- A1 INT1 P2.6
10
8 A2
23 14
15 T0 P2.5
26
25
CLK
0 START
6 16 T1
WR
P2.4
P2.3
24
9 22 17 23
7 OE
EOC
8 ALE 18 RD
X2
P2.2
P2.1
22
19 21
X1 P2.0
Y1

C3 CRYSTAL
C4
22uF 22uF

Fig 3.2: ADC 0808 INTERFACING WITH AT 89C55WD.

The output data of ADC 0808 is sending to Port 0 & LCD display.

4.4 LCD DISPLAY INTERFACING WITH AT 89C55WD


The RS pin is used for selection of two registers in LCD. If RS=0, the instruction
command register is selected, allowing the user to send a command such as clear display.
If RS=1, the data register is selected, allowing the user to send data to be displayed on the
LCD. The enable pin is used by the LCD to latch information presented to its data pins.
Where data is supplied to data pins, a High to Low pulse must be applied to this pin in
order for the LCD to latch in the data present at the data pins. The 8 bit data pins are used
to send information to the LCD or read the contents of the LCDs internal registers. ADC
0808 output data is sending to the LCD display.

Pin Number Symbol Function


1 Vss Ground
2 Vcc +5V power supply
3 VEE Power supply to control contrast
4 RS High to Low Register select signal, if
0command Register and 1 data Register
5 R/W R/W=0 for write,R/W=1 for Read

64
6 E H-L Enable signal
7 DB0 H-L Data Bus Line
8 DB1 H
9 DB2 H
10 DB3 H
11 DB4 H
12 DB5 H
13 DB6 H
14 DB7 H
15 A/Vee +4.2V for LED(RA=0)/Negative Voltage
Output
16 K Power supply for B/L(0V)

65
16 X 2 LCD DISPLAY
GND

GND
VCC

VCC
R/W
Vref
RS

EN
D0
D1
D2
D3
D4
D5
D6
D7
10
11
12
13
14
15
16
1
2
3
4
5
6
7
8
9
GND
VCC
GND

GND

VCC
GND
R/S

EN

SW1
SW TACT-SPST VCC
1 2
VCC
R19

CC5

R
RRRRRRRR
U5
1 39 R/S
2 P1.0 P0.0 38 EN
3 P1.1 P0.1 37 LEVEL
4 P1.2 P0.2 36 MOTOR_CTRL
5 P1.3 P0.3 35 DAC_CTRL
6 P1.4 P0.4 34 SEL1
7 P1.5 P0.5 33 SEL2
8 P1.6 P0.6 32
P1.7 P0.7
31 R15 VCC
EA/VP
89C52

9 30 R
RESET ALE/P 29
10 PSEN
11 RXD
12 TXD 28
13 INT0 P2.7 27
14 INT1 P2.6 26
15 T0 P2.5 25
16 T1 P2.4 24
17 WR P2.3 23
18 RD P2.2 22
19 X2 P2.1 21
X1 P2.0
Y1

C3 CRY STAL
C4
22uF 22uF

Figure3.4: LCD Display interfacing with 89C55WD

66
CHAPTER 5: FIRMWARE DEVELOPMENT
This chapter is completely dedicated for the RF Analyzer circuitry and explains the
process flow and the Flowcharts & Code. The basic block diagram of the RF Analyzer
circuitry is shown in fig.

LCD DISPLAY

A
Vi D
C
0 AT
Vr 8 89C55 Key pad
0 WD
8

Block Diagram of RF Analyzer

The functionality of the block diagram as explained, the analog detected transmitted
voltage from the logarithmic detector is supplied to the ADC 0808 and it works with the
principle of Successive Approximation principle and internally it essentially consists of
DAC which stores the voltage and counts up to the voltage threshold, after that the count
stops and in our design it takes average of many samples to give the accurate reading,
similarly the reflected voltage. And it works in accordance with the clock

67
5.1 Initialization of LCD:

START

Write command:
Select LCD size

Write command:
Cursor On, No blink

Write Command:
Shift Cursor Right

Write Command:
Clear Memory and Home
Cursor

Write Command: Move


Cursor to First Position of
the Row

5.2 Writing Command to LCD

START

Select command
Register

Write command
character
On Port 1

Enable=1;

Delay by some time

Enable=0;
68
5.3 Writing Data to LCD Display

START

Select Data Register


using RS=1;

Write Data character


on Port 1

Enable=1;

Delay by 1msec

Enable=0;

69
5.4 Analog to Digital Conversion

STAR
T

Selection of ADC Channel and


initialization of ADC;

While(Proces
s)

Enable the output;


Send to the Port;
Stop Conversion;

Close

5.5 CODE:

#include<reg51.h>
#include<math.h>
#define lcd P1;
#define adc P1;

float vr,vi,pi,pr,k,s,rl;

sbit a0=P3^2;//a0& a1 selection of adc channels


sbit a1=P3^3;
sbit start=P3^7;//start of conversion
sbit intr=P3^6;//interrupt for adc
sbit oe=P3^5;//output enable

70
sbit clk=P3^4;//clk signal for adc
sbit rs=P0^0;//reset for LCD
sbit en=P0^1;//Enable signal for LCD
sbit k1=P0^2;//Pi switch
sbit k2=P0^3;//Pr switch
sbit k3=P0^4;//K switch
sbit k4=P0^5;//S switch
sbit k5=P0^6;//Pl switch

void dat(unsigned char);//data to LCD


void cmd(unsigned char);// command to LCD
void delay(int);// delay
void init(void);//intilization for LCD
void dis(short);//display corresponding parameters
void adcconv(void);//to get adc readings

main()
{
short key;
start=0;oe=0;
EA=1;ET0=1;ES=1;IP=0X10;TMOD=0X22;
TH1=0XFD;TL1=0XFD;
TL0=0XFE;TH0=0XFE;TR1=1;
key=1;
init();
cmd(0x82);
dat('R');dat('F');dat(' ');
dat('A');dat('n');dat('a');dat('l');dat('y');dat('s');dat('e');dat('r');
while(1)
{
adcconv();
delay(1);

71
pi=(vi/.018)-70;
pr=(vr/.018)-70;

rl=pi-pr;
k=pow(10,(-rl/20.0));
s=(1+k)/(1-k);
if(!k1){key=1;}
if(!k2){key=2;}
if(!k3){key=3;}
if(!k4){key=4;}
if(!k5){key=5;}

if(pi<-42.0){ dis(6); }
else if(pi>24.0){dis(7);}
else dis(key);
delay(300);
}
}

void dis(short di)


{ float des;unsigned long int deci;

init();
cmd(0x82);
dat('R');dat('F');dat(' ');
dat('A');dat('n');dat('a');dat('l');dat('y');dat('s');dat('e');dat('r');
cmd(0xc0);
if(di==6)
{ dat(' ');dat(' ');dat(' ');
dat('L');dat('O');dat('W');dat(' ');
dat('P');dat('O');dat('W');dat('E');dat('R');
}

72
else if(di==7)
{ dat(' ');dat(' ');dat(' ');
dat('H');dat('I');dat('G');dat('H');dat(' ');
dat('P');dat('O');dat('W');dat('E');dat('R');
}

else if(di==4)
{ dat(' ');dat('S');dat('=');des=s;deci=des*10;
dat(48+(deci/10000));dat(48+((deci%10000)/1000));
dat(48+(((deci%10000)%1000)/100));
dat(48+((((deci%10000)%1000)%100)/10));
dat('.');
dat(48+((((deci%10000)%1000)%100)%10));

}
else
{
if(di==1)
{dat('P');dat('i');dat('='); des=pi;
if(pi>0){dat('+');deci=des*100;}
else {dat('-'); deci=des*-100;}}
else if(di==2)
{dat('P');dat('r');dat('=');des=pr;
if(pr>0){dat('+');deci=des*100;}
else {dat('-');deci=des*-100;}}
else if(di==3)
{dat(' ');dat('K');dat('=');des=k;deci=des*100;}
else if(di==5)
{dat('R');dat('l');dat('=');des=rl;deci=des*100;}

dat(48+(deci/1000));
dat(48+((deci%1000)/100));
dat('.');

73
dat(48+((((deci%1000)%100)%100)/10));
dat(48+(((((deci%10000)%1000)%100)%10)%10));

if(di<3){dat('d');dat('B');dat('m');}
if(di==5){dat('d');dat('B');}
}
}
void adcconv(void)
{ unsigned int ad1=0;short ai,temp;
temp=0;
for(ai=0;ai<100;ai++)
{a0=0;a1=0;P1=0xff;
TR0=1;start=1;start=0;
while(intr); oe=1;
delay(1);temp=P1;TR0=0;
oe=0; ad1+=temp;
}
ad1/=100;vi=ad1*0.0196;
temp=0;
for(ai=0;ai<100;ai++)
{a0=1;a1=0;P1=0xff;
TR0=1;start=1;start=0;
while(intr); oe=1;delay(1);
temp=P1;TR0=0;
oe=0; ad1+=temp;
}
ad1/=100;vr=ad1*0.0196;
}
void timer() interrupt 1
{ clk=!clk;
}
void dat(unsigned char c)
{ rs=1;

74
P1=c;
en=1;delay(1);en=0;}
void cmd(unsigned char d)
{ rs=0;
P1=d;
en=1;delay(1);en=0;}
void delay(int k)
{ int i,j;
for(j=0;j<k;j++)
{for(i=0;i<115;i++);}
}
void init(void)
{ cmd(0x3c);
cmd(0x0e);
cmd(0x06);
cmd(0x01);
cmd(0x80);
}
CHAPTER 6: FABRICATING, ASSEMBLING AND TESTING
INTRODUCTION:

6.4 HARDWARE PREPERATION FOR THE RF ANALYZER CIRCUITRY:

Mounting the components on the general purpose board in accordance to the


schematic prepared in Or CAD and the position of the ADC0808, Microcontroller, LCD
display and keypad suitably located for proper soldering of the components and can be
seen that suitable length of the connecting wires for proper connections

6.5 TESTING:

Testing of the individual modules is done separately and working condition of these
modules and can be ensured for the proper power supply, ground connections, also
leakages and any redundant responses can be suppressed out and discarded if there is no
harm to the main circuit.

75
CHAPTER 7: EXPERIMENTAL INVESTIGATIONS & RESULTS
INTRODUCTION:

RF ANALYZER CIRCUIT
LCD
ADC AND
MICROCONTROLLER

T
E
R
AD8313(1) TERMINATION M
I
N
A
DUAL DIRECTIONAL T
INPUT
COUPLER I
O
N
TERMINATION AD 8313 (2)

APPLICATION OF DUAL DIRECTIONAL COUPLER

From the forward power and reflected power we can directly get Incident power from
the Source Pi, and the reflected power from the terminating end Pr the reflection
coefficient K, VSWR, S and return loss rl on to the LCD display.
The forward and reflected powers for various terminations at 0.5 GHz frequency are
given in the following tables.
TABLE : The detected values for 50 Termination (Matched Termination)

76
Data Sheets:

77
APPENDIX

Timing Diagram1: ADC0808.

Timing Diagram2:DAC7524

78
79

You might also like