You are on page 1of 89

[Type the document title]

ESTD 1990

PRIYADARSHINI
COLLEGE OF COMPUTER SCIENCES
APPROVED BY
ALL INDIA COUNCIL FOR TECHNICAL EDUCATION

FINAL YEAR PROJECT REPORT


INDUSTRIAL FAULT MONITORING
(YEAR -2012-2013)
SUBMITTED BY:
DHANANJAY VARSHNEY
GAURAV KUMAR UPADHYAY
SWATI VERMA
NEELAM

UNDER THE

GUIDANCE
MR NASEEM
RAO
(H.O.D,EC
DEPARTMENT)

DECLARATION

[Type the document title]

We , here by declare that this submission is our own work and it


contains no
material previously published or written by another person, to
the best of our
knowledge and belief.
The text and data has been handpicked from a variety of source
and compiled
exclusively in form of a file , for partial fulfilment of the
requirement of the
awarding degree.

SIGN-..
.

SIGN-

Name:Dhananjay Varshney
Name:Gaurav Upadhyay
Rollno:0909231035
Rollno:0909231039

SIGN-.

Name:Swati Verma
Name:Neelam
Rollno:0909231105
Rollno:0909231063

SIGN-

[Type the document title]

ACKNOWLEDGMENT
In order to achieve something concrete, there is a need
of guidance, inspiration and help. We express our dense
sense of gratitude to all those who contributed to this
endeavour in any form.
We take the privilege to express our thankfulness and
regards to
Mr naseem rao, (h.o.d,ece), PRIYADARSHINI COLLEGE
OF COMPUTER SCIENCES, for permitting and guiding us
at every step of our project and giving us the
opportunityto freely interact and discuss the minor
details of the project so that we can accomplish it in the
form of a compiled report.

DHANANJAY VARHSNEY
GAURAV UPADHYAY
SWATI
VERMA

[Type the document title]

NEELAM
(ELECTRONICS AND
COMM. ENG.)

INDEX
ABSTRACT.PG-7
INTRODUCTION...PG-8
BLOCK DIAGRAMPG-9
AT89C528-bit Microcontroller with 8K Bytes
Flash
.PG-11
OPERATIONAL AMPLIFIER
AND
INTRODUCTION.............................................P
G-26
ELECTRONIC
THERMOSTAT..PG-31
TRANSISTOR
PG-36

[Type the document title]

TRANSFORMER.
.PG-41
CAPACITORS
.PG-44
DIODE
PG-45
POWER
SUPPLY..PG-48
RELAY
.....PG-57
RESISTANCE
....PG-61
UNDER/OVER VOLTAGE PROTECTION FOR
DEVICES
.PG-64
MAKING PRINTED CIRCUIT BOARD (P.C.B.)
PG-66
SOFTWARE
PROGRAM,,,,,.PG-70

[Type the document title]

CERTIFICATE

This is certifying that the MINI PROJECT Report entitled


INDUSTRIAL
FAULT
MONITORING which is
submitted
by
GAURAV
KUMAR
UPADHYAY,

[Type the document title]

DHANANJAY VARSHNEY, NEELAM, SWATI VERMA


for partial fulfillment of the requirement for the award
of degree B.Tech. in department of Electronics And
Communication of U.P. Technical University Lucknow.
It is a record of the candidate own work carried out by
his under my/our supervision.
The matter embodied in this seminar is original and has
not been submitted for the award of any other degree.

Mr. Naseem Rao


(HOD,EC
Department)

[Type the document title]

INDUSTRIAL FAULT MONITORING

ABSTRACT
The project proposes an innovative design to develop a system
based on
AT89c52 microcontroller which is used to monitor voltage,
current and

[Type the document title]

temperature of a distributed machinery in an industry. This


project is being
compiled with different parameters to protect or provide the
specific
valued needs. Providing the protection to the distribution
transformer can
be accomplished by providing the termination or varying of the
power
supply. Voltage ,current and temperature are continuously
montiored by
the AT89c51 microcontroller. An RF transmitter is used to
tranmit the
signals that are obtained.
In general, this project is an ease structure to give the details
for any open
or short circuit and temperature suffered by the distribution
frame.
The main objective is to guard the distribution frame from
burning while
monitoring the electrical parameters.

The evolution in industrial monitoring was introduced since


1882. A simple
metering system was introduced whose main principle was a
balancing act.
The evolution of industrial monitoring has come far ahead
providing

[Type the document title]

10

Remote readability and many more advancements. A number


of real
functional requirements have driven the development of
Industrial
monitoring and control system and utility use.

INTRODUCTION
The proposed project consist of four options to choose from i.e.
to detect (1) Over voltage, (2) Over temperature, (3) Over
current and (4) Power Failure warning system. Whenever any of
the function create indication,
The controller gets input and provide output to drive relay for
buzzer or any other alarming device.

The Microcontroller is working here as logic OR gate decoder


that is being used for the project has latched outputs.

The entire project is split into sections and each section is


explained in sufficient detail to enable you not only to fabricate

[Type the document title]

11

the present design but also exploit these principles for evolving
your own design with added functions/features.

BLOCK DIAGRAM

[Type the document title]

12

[Type the document title]

13

[Type the document title]

14

AT89C52
8-bit Microcontroller with 8K Bytes Flash

Features

Compatible with MCS-51 Products


8K Bytes
Memory

of

In-System

Reprogrammable

Flash

Endurance: 1,000 Write/Erase Cycles


Fully Static Operation: 0 Hz to 24 MHz
Three-level Program Memory Lock
256 x 8-bit Internal RAM
32 Programmable I/O Lines
Three 16-bit Timer/Counters
Eight Interrupt Sources
Programmable Serial Channel
Low-power Idle and Power-down Modes

Description

The AT89C52 is a low-power, high-performance


CMOS 8-bit microcomputer with 8K bytes of Flash

[Type the document title]

15

programmable and erasable read only memory


(PEROM). The device is manufactured using Atmels
high-density nonvolatile memory technology and is
compatible with the industry-standard 80C51 and
80C52 instruction set and pinout.

The on-chip Flash allows the program memory to


be reprogrammed in-system or by a conventional
nonvolatile memory programmer. By combining a
versatile 8-bit CPU with Flash on a monolithic chip, the
Atmel AT89C52 is a powerful microcomputer which
provides a highly-flexible and cost-effective solution to
many embedded control applications.

[Type the document title]

16

[Type the document title]

17

The AT89C52 provides the following standard features:


8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, three
16-bit timer/counters, a six-vector two-level interrupt
architecture, full-duplex serial port, on-chip oscillator,
and clock circuitry. In addition, the AT89C52 is designed
with static logic for operation down to zero frequency
and supports two software selectable power saving

[Type the document title]

18

modes. The Idle Mode stops the CPU while allowing the
RAM, timer/counters, serial port, and interrupt system
to continue functioning. The Power-down mode saves
the RAM contents but freezes the oscillator, disabling all
other chip functions until the next hardware reset.
Pin Description
VCC
Supply voltage.

GND
Ground.

Port 0

Port 0 is an 8-bit open drain bi-directional 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 highimpedance inputs.

Port 0 can also be configured to be the multiplexed


loworder address/data bus during accesses to external
program and data memory. In this mode, P0 has
internal pullups.

[Type the document title]

19

Port 0 also receives the code bytes during Flash


programming and outputs the code bytes during
program verification. External pullups are required
during program verification.

Port 1

Port 1 is an 8-bit bi-directional I/O port with internal


pullups. The Port 1 output buffers can sink/source four
TTL inputs. When 1s are written to Port 1 pins, they
are pulled high by the internal pullups and can be
used as inputs. As inputs, Port 1 pins that are
externally being pulled low will source current (IIL)
because of the internal pullups.

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 2

[Type the document title]

20

Port 2 is an 8-bit bi-directional I/O port with internal


pullups. 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 pullups and can be used as
inputs. As inputs, Port 2 pins that are externally being
pulled low will source current (IIL) because of the
internal pullups.
Port 2 emits the high-order address byte during
fetches from external program memory and during
accesses to external data memory that use 16-bit
addresses (MOVX @ DPTR). In this application, Port 2
uses strong internal pullups when emitting 1s. During
accesses to external data memory that use 8-bit
addresses (MOVX @ RI), Port 2 emits the contents of
the P2 Special Function Register.
Port 2 also receives the high-order address bits and
some control signals during Flash programming and
verification.

Port 3

Port 3 is an 8-bit bi-directional I/O port with internal


pullups. The Port 3 output buffers can sink/source four
TTL inputs. When 1s are written to Port 3 pins, they are
pulled high by the internal pullups and can be used as
inputs. As inputs, Port 3 pins that are externally being

[Type the document title]

21

pulled low will source current (IIL) because of the


pullups.

Port 3 also serves the functions of various special


features of the AT89C51, as shown in the following
table.

Port 3 also receives some control signals for Flash


programming and verification.

RST

Reset input. A high on this pin for two machine cycles


while the oscillator is running resets the device.

ALE/PROG
Address Latch Enable is an output pulse for latching the
low byte of the address during accesses to external
memory.

This pin is also the program pulse input (PROG) during


Flash programming. In normal operation, ALE is
emitted at a constant rate of 1/6 the oscillator

[Type the document title]

22

frequency and may be used for external timing or


clocking purposes. Note, however, that one ALE pulse
is skipped during each access to external data
memory.

If desired, ALE operation can be disabled by setting


bit 0 of SFR location 8EH. With the bit set, ALE is active
only during a MOVX or MOVC instruction. Otherwise,
the pin is weakly pulled high. Setting the ALE-disable
bit has no effect if the microcontroller is in external
execution mode.

PSEN
Program Store Enable is the read strobe to external
program memory. When the AT89C52 is executing code
from external program memory, PSEN is activated twice
each machine cycle, except that two PSEN activations
are skipped during each access to external data
memory.

EA/VPP
External Access Enable. EA must be strapped to GND in
order to enable the device to fetch code from external
program memory locations starting at 0000H up to
FFFFH.

[Type the document title]

23

Note, however, that if lock bit 1 is programmed, EA


will be internally latched on reset. EA should be
strapped to VCC for internal program executions.

This pin also receives the 12-volt programming


enable voltage (VPP) during Flash programming when
12-volt programming is selected.

XTAL1
Input to the inverting oscillator amplifier and input to
the internal clock operating circuit.

XTAL2
Output from the inverting oscillator amplifier.

Oscillator Characteristics
XTAL1 and XTAL2 are the input and output,
respectively, of an inverting amplifier that can be
configured for use as an on-chip oscillator, as shown in
Figure 7. Either a quartz crystal or ceramic resonator
may be used. To drive the device from an external clock
source, XTAL2 should be left unconnected while XTAL1
is driven, as shown in Figure 8. There are no

[Type the document title]

24

requirements on the duty cycle of the external clock


signal, since the input to the internal clocking circuitry
is through a divide-by-two flip-flop, but minimum and
maximum voltage high and low time specifications
must be observed.

Idle Mode
In idle mode, the CPU puts itself to sleep while all
the onchip peripherals remain active. The mode is
invoked by software. The content of the on-chip RAM
and all the special functions registers remain
unchanged during this mode. The idle mode can be
terminated by any enabled interrupt or by a hardware
reset.

Note that when idle mode is terminated by a


hardware reset, the device normally resumes program
execution from where it left off, up to two machine
cycles before the internal reset algorithm takes control.
On-chip hardware inhibits access to internal RAM in this
event, but access to the port pins is not inhibited. To
eliminate the possibility of an unexpected write to a
port pin when idle mode is terminated by a reset, the
instruction following the one that invokes idle mode
should not write to a port pin or to external memory.

[Type the document title]

25

Power-down Mode
In the power-down mode, the oscillator is stopped,
and the instruction that invokes power-down is the
last instruction executed. The on-chip RAM and
Special Function Registers retain their values until the
power-down mode is terminated. The only exit from
power-down is a hardware reset. Reset redefines the
SFRs but does not change the on-chip RAM. The reset
should not be activated before VCC is restored to its
normal operating level and must be held active long
enough to allow the oscillator to restart and stabilize.

[Type the document title]

26

Program Memory Lock Bits


The AT89C52 has three lock bits that can be left
unprogrammed (U) or can be programmed (P) to obtain
the additional features listed in the following table.

When lock bit 1 is programmed, the logic level at


the EA pin is sampled and latched during reset. If the
device is powered up without a reset, the latch
initializes to a random value and holds that value until
reset is activated. The latched value of EA must agree
with the current logic level at that pin in order for the
device to function properly.

Programming the Flash

The AT89C52 is normally shipped with the on-chip


Flash memory array in the erased state (that is,
contents = FFH) and ready to be programmed. The
programming interface accepts either a high-voltage
(12-volt) or a low-voltage (VCC) program enable signal.
The Low-voltage programming mode provides a
convenient way to program the AT89C52 inside the
users system, while the high-voltage programming
mode is compatible with conventional thirdparty

[Type the document title]

27

Flash or EPROM programmers.

The AT89C52 is shipped with either the highvoltage or low-voltage programming mode enabled.
The respective top-side marking and device signature
codes are listed in the following table.

The AT89C52 code memory array is programmed bytebybyte in either programming mode. To program any
nonblank byte in the on-chip Flash Memory, the entire
memory must be erased using the Chip Erase Mode.

Programming Algorithm Before programming the


T89C52, the address, data and control signals should
be set up according to the Flash programming mode
table and Figure 9 and Figure 10. To program the
AT89C52, take the following steps.

1. Input the desired memory location on the address


lines.

2. Input the appropriate data byte on the data lines.

3. Activate the correct combination of control signals.

[Type the document title]

4. Raise EA/VPP to
programming mode.

12V

for

the

28

high-voltage

5. Pulse ALE/PROG once to program a byte in the Flash


array or the lock bits. The byte-write cycle is self-timed
and typically takes no more than 1.5 ms. Repeat steps
1 through 5, changing the address
and data for the entire array or until the end of the
object file is reached.

Data Polling The AT89C52 features Data Polling to


indicate the end of a write cycle. During a write cycle,
an attempted read of the last byte written will result in
the complement of the written data on PO.7. Once the
write cycle has been completed, true data is valid on all
outputs, and the next cycle may begin. Data Polling
may begin any time after a write cycle has been
initiated.

Ready/Busy The progress of byte programming can


also be monitored by the RDY/BSY output signal. P3.4 is
pulled low after ALE goes high during programming to
indicate BUSY. P3.4 is pulled high again when
programming is done to indicate READY.

[Type the document title]

29

Program Verify If lock bits LB1 and LB2 have not been
programmed, the programmed code data can be read
back via the address and data lines for verification. The
lock bits cannot be verified directly. Verification of the
lock bits is achieved by observing that their features
are enabled.

Chip Erase The entire Flash array is erased electrically


by using the proper combination of control signals and
by holding ALE/PROG low for 10 ms. The code array is
written with all 1s. The chip erase operation must be
executed
before
the
code
memory
can
be
reprogrammed.

Reading the Signature Bytes The signature bytes


are read by the same procedure as a normal
verification of locations 030H, 031H, and 032H, except
that P3.6 and P3.7 must be pulled to a logic low. The
values returned are as follows.

(030H) = 1EH indicates manufactured by Atmel


(031H) = 52H indicates 89C52
(032H) = FFH indicates 12V programming
(032H) = 05H indicates 5V programming

[Type the document title]

30

Programming Interface

Every code byte in the Flash array can be written, and


the entire array can be erased, by using the
appropriate combination of control signals. The write
operation cycle is selftimed and once initiated, will
automatically time itself to completion.
All major programming vendors offer worldwide
support for the Atmel microcontroller series. Please
contact your local programming vendor for the
appropriate software revision.

OPERATIONAL AMPLIFIER
AN INTRODUCTION
An op amp is a high-gain, direct-coupled differential
linear amplifier whose response characteristics are

[Type the document title]

31

externally controlled by negative feedback from the


output to the input. OP amps, widely used in
computers, can perform mathematical operations such
as summing, integration, and differentiation. OP amps
are also used as video and audio amplifiers, oscillators,
etc. in the communication electronics. Because of their
versatility op amps are widely used in all branches of
electronics both in digital and linear circuits.
OP amps lend themselves readily to IC manufacturing
techniques. Improved IC manufacturing techniques, the
op amp's adaptability, and extensive use in the design
of new equipment have brought the price of IC ops
amps from very high to very reasonable levels. These
facts ensure a very substantial role for the IC op amp in
electronics.
Fig shows the symbol for an op amp. Note that the
operational amplifier has two inputs marked (-) and (+).
The minus input is the inverting input. A signal applied
to the minus terminal will be shifted in phase 180 at
the output. The
plus input is the
non-inverting
input.
A
signal
applied to the plus
terminal will appear in the same phase at the output as
at the input. Because of the complexity of the internal
circuitry of an op amp, the op amp symbol is used
exclusively in circuit diagrams.
IC-741

[Type the document title]

32

An operational amplifier often referred to as op Amp, is


a very high gain high performance amplifier designed
to amplify ac and dc signal voltages. Modern integrated
circuit
technology
and
large-scale
production
techniques have brought down the prices of such
amplifiers within reach of all amateurs, experimenters
and hobbyists. The Op Amp is now used as a basic gain
element, like an elegant transistor, in electronic
circuits.

A symbol used to represent an operational amplifier in


schematics is shown in fig. The operational amplifier
has two inputs and only one output. One input is called
the inverting input and is denoted by a minus sign. A
signal applied to this input appears as an amplified but
phase inverted the signal output. The second input is
called a non-inverting input and is denoted by a plus
sign. A signal applied to this input appears at the
output as an amplified signal, which has the same
phase as that of the input signal.

The availability of two input terminals simplifies


feedback circuitry and makes the operational amplifier
a highly versatile device. If a feedback is applied from
the output to the inverting input terminal, the result is a
negative feedback, which gives a stable amplifier with
precisely controlled gain characteristics. On the other
hand, if the feedback is applied to the non-inverting
input, the result is positive feedback, which gives

[Type the document title]

33

oscillators and multivibrator. Special effects are


obtained by combination of both types of feedback.

NEGATIVE FEEDBACK CONTROL

OP-AMP SPECIFICATIONS

The manufacturer provides a circuit diagram, a basic


diagram and specifications for each op amp type,
including performance graphs. The 741 is available in
two grades, the military (M) and commercial (C). It also
comes in different packages. The manufacturer lists the
following maximum ratings for the 741HC:

Supply voltage
Internal power dissipation

18 V
500 mW

[Type the document title]

34

Differential input voltage

30 V

Operating temperature

0 to 70 C

The following characteristics are also of interest to the


technician and designer.

Input bias current

800nA

Input resistance

0.3 to 2 M

Input voltage range

13 V, typical

Common-mode rejection ratio for


RS 10 K
Output resistance

75

Output short-circuit current

25 mA

Supply current

2.8 mA, typical

Power consumption

85 mW, typical

Large-signal voltage gain, RL 2 K


and Vout = 10 V
Output voltage swing, RL 2K

15,000
13 V, typical

[Type the document title]

(a) CIRCUIT DIAGRAM;

(b) TERMINAL DIAGRAM OF 741C.

35

[Type the document title]

36

ELECTRONIC THERMOSTAT

This simple thermostat will stabilize


temperatures to within a fraction of one degree
Centigrade. It covers a range which extends from a few
degrees C to over 35 degrees C and is therefore
suitable for use as a room thermostat, a thermostat for
photographic solutions, etc.

CIRCUIT DESCRIPTION & WORKING

The circuit uses operational amplifier IC1 as a


voltage comparator, if the voltage at the non-inverting
input is higher than that at the inverting input, the
output goes to almost the full positive supply voltage. If
the comparative input states are reversed, the output
assumes a very low voltage.

The inverting input is fed with a reference


voltage which is taken from the slider of RV1, acting as

[Type the document title]

37

the temperature control. The non-inverting input is fed


from a potential divider which consists of R1 and Th1.

Th1 is a negative temperature coefficient


thermistor; its resistance varies according to
temperature with increased temperature causing
decreased resistance. If the voltage produced by Th1
and R1 is less than that set by RV1 slider, IC1's output
will go high, switching on the relay via an emitter
follower buffer stage, Q1. Power is then connected to
the heater and the room temperature (or whatever)
starts to rise. This causes a reduction in the resistance
of Th1, and the voltage fed to IC1's non-inverting input.
This voltage soon falls below that fed to the inverting
input, causing IC1 output to go low, the relay to deenergise, and the heater to be switched off.

COMPONENTS USED

1. IC1..................LM741

2. Q1...................BC108 Transistor

3. R1...................4.7k

[Type the document title]

4. R2...................1.2k

5. R3...................10k

6. RV1.................1k Variable Resistance

7. C1...................1000

8. C2...................2.2

9. C3...................4.7

10. D1, D2.............IN4002

11. D3...................IN4148

12. TH1.................1k Thermistor

13. RLA.................6V Relay

14. T1...................Transformer 6-0-6V 500mA

38

[Type the document title]

15. ON/OFF Switch

CIRCUIT DIAGRAM

39

[Type the document title]

40

[Type the document title]

41

TRANSISTOR

The name is transistor derived from transfer


resistors indicating a solid state Semiconductor device.
In addition to conductor and insulators, there is a third
class of material that exhibits proportion of both. Under
some conditions, it acts as an insulator, and under
other conditions its a conductor. This phenomenon is
called Semi-conducting and allows a variable control
over electron flow. So, the transistor is semi conductor
device used in electronics for amplitude. Transistor has
three terminals, one is the collector, one is the base
and other is the emitter, (each lead must be connected
in the circuit correctly and only then the transistor will
function). Electrons are emitted via one terminal and
collected on another terminal, while the third terminal
acts as a control element. Each transistor has a number
marked on its body. Every number has its own
specifications.

There are mainly two types of transistor (i) NPN &


(ii) PNP

NPN Transistors:

[Type the document title]

42

When a positive voltage is applied to the base, the


transistor begins to conduct by allowing current to flow
through the collector to emitter circuit. The relatively
small current flowing through the base circuit causes a
much greater current to pass through the emitter /
collector circuit. The phenomenon is called current
gain and it is measure in beta.

PNP Transistor:
It also does exactly same thing as above except that it
has a negative voltage on its collector and a positive
voltage on its emitter.

Transistor is a combination of semi-conductor


elements allowing a controlled current flow. Germanium
and Silicon is the two semi-conductor elements used for
making it. There are two types of transistors such as
POINT CONTACT and JUNCTION TRANSISTORS. Point
contact construction is defective so is now out of use.
Junction triode transistors are in many respects
analogous to triode electron tube.

[Type the document title]

43

A junction transistor can function as an amplifier or


oscillator as can a triode tube, but has the additional
advantage of long life, small size, ruggedness and
absence of cathode heating power.
Junction transistors are of two types which can be
obtained while manufacturing.
The two types are: -

1) PNP TYPE: This is formed by joining a layer of P


type of germanium to an N-P Junction

2) NPN TYPE: This is formed


by joining a layer of N type
germanium to a P-N Junction.

Both types are shown in


figure, with their symbols for representation. The centre
section is called the base, one of the outside sections-

[Type the document title]

44

the emitter and the other outside section-the collector.


The direction of the arrowhead gives the direction of
the conventional current with the forward bias on the
emitter. The conventional flow is opposite in direction to
the electron flow.

OPERATION OF PNP TRANSISTOR:A PNP transistor is made by sand witching two PN


germanium or silicon diodes, placed back to back. The
centre of N-type portion is extremely thin in comparison
to P region. The P region of the left is connected to the
positive terminal and N-region to the negative terminal
i.e. PN is biased in the forward direction while P region
of right is biased negatively i.e. in the reverse direction
as shown in Fig. The P region in the forward biased
circuit is called the emitter and P region on the right,
biased negatively is called collector. The centre is called
base.

[Type the document title]

45

The majority carriers (holes) of P region (known as


emitter) move to N region as they are repelled by the
positive terminal of battery while the electrons of N
region are attracted by the positive terminal. The holes
overcome the barrier and cross the emitter junction
into N region. As the width of base region is extremely
thin, two to five percent of holes recombine with the
free electrons of N-region which result in a small base
current while the remaining holes (95% to 98%) reach
the collector junction. The collector is biased negatively
and the negative collector voltage aids in sweeping the
hole into collector region.
As the P region at the right is biased negatively, a very
small current should flow but the following facts are
observed:1) A substantial current flows through it when the
emitter junction is biased in a forward direction.
2) The current flowing across the collector is slightly
less than that of the emitter, and
3) The collector current is a function of emitter
current i.e. with the decrease or increase in the
emitter current a corresponding
change
in
the
collector current is observed.

[Type the document title]

46

TRANSFORMER
PRINCIPLE OF THE TRANSFORMER:Two coils are wound over a Core such that they are

magnetically coupled. The two coils are known as the


primary and secondary windings.
In a Transformer, an iron core is used. The coupling
between the coils is source of making a path for the
magnetic flux to link both the coils. A core as in fig.2 is
used and the coils are wound on the limbs of the core.
Because of high permeability of iron, the flux path for
the flux is only in the iron and hence the flux links both
windings. Hence there is very little leakage flux. This
term leakage flux denotes the part of the flux, which
does not link both the coils, i.e., when coupling is not
perfect. In the high frequency transformers, ferrite core
is used. The transformers may be step-up, step-down,
frequency matching, sound output, amplifier driver etc.
The basic principles of all the transformers are same.

[Type the document title]

47

MINIATURE TRANSFORMER

CONVENTIONAL POWER TRANSFORMER

[Type the document title]

48

What are crystal oscillators?

Crystal oscillators are oscillators where the primary


frequency determining element is a quartz crystal.
Because of the inherent characteristics of the quartz
crystal the crystal oscillator may be held to extreme
accuracy
of
frequency
stability.
Temperature
compensation may be applied to crystal oscillators to
improve thermal stability of the crystal oscillator.
Crystal oscillators are usually, fixed frequency
oscillators where stability and accuracy are the primary
considerations. For example it is almost impossible to
design a stable and accurate LC oscillator for the upper
HF and higher frequencies without resorting to some
sort of crystal control. Hence the reason for crystal
oscillators.
The frequency of older FT-243 crystals can be moved
upward by crystal grinding.

A practical example of a Crystal Oscillator


This is a typical example of the type of crystal
oscillators which may be used for say converters. Some

[Type the document title]

49

points of interest on crystal oscillators in relation to


figure 1.

Figure 1 - schematic of a crystal oscillator

The transistor could be a general purpose type with an


Ft of at least 150 Mhz for HF use. A typical example
would be a 2N2222A.
The turns ratio on the tuned circuit depicts an
anticipated nominal load of 50 ohms. This allows a
theoretical 2K5 ohms on the collector. If it is followed by
a buffer amplifier (highly recommended) I would simply
maintain the typical 7:1 turns ratio. I have included a
formula for determining L and C in the tuned circuits of
crystal oscillators in case you have forgotten earlier
tutorials. Personally I would make L a reactance of
around 250 ohms. In this case I'd make C a smaller
trimmer in parallel with a standard fixed value.

[Type the document title]

50

CAPACITORS
It is an electronic component
whose function is to accumulate charges and then
release it.

To understand the
concept of capacitance, consider a pair of metal plates
which all are placed near to each other without
touching. If a battery is connected to these plates the
positive pole to one and the negative pole to the other,
electrons from the battery will be attracted from the
plate connected to the positive terminal of the battery.
If the battery is then disconnected, one plate will be left
with an excess of electrons, the other with a shortage,
and a potential or voltage difference will exists between
them. These plates will be acting as capacitors.
Capacitors are of two types: - (1) fixed type like
ceramic, polyester, electrolytic capacitors-these names
refer to the material they are made of aluminium foil.

[Type the document title]

51

(2) Variable type like gang condenser in radio or


trimmer. In fixed type capacitors, it has two leads and
its value is written over its body and variable type has
three leads. Unit of measurement of a capacitor is farad
denoted by the symbol F. It is a very big unit of
capacitance. Small unit capacitor are pico-farad
denoted by pf (Ipf=1/1000,000,000,000 f) Above all, in
case of electrolytic capacitors, it's two terminal are
marked as (-) and (+) so check it while using capacitors
in the circuit in right direction. Mistake can destroy the
capacitor or entire circuit in operational.

DIODE
The simplest semiconductor device is made up of a
sandwich of P-type semiconducting material, with
contacts provided to connect the p-and n-type layers to
an external circuit. This is a junction Diode. If the
positive terminal of the battery is connected to the ptype material (cathode) and the negative terminal to
the N-type material (Anode), a large current will flow.
This is called forward current or forward biased.

If the connections are reversed, a very little current will


flow. This is because under this condition, the p-type
material will accept the electrons from the negative
terminal of the battery and the N-type material will give
up its free electrons to the battery, resulting in the

[Type the document title]

52

state of electrical equilibrium since the N-type material


has no more electrons. Thus there will be a small
current to flow and the diode is called Reverse biased.

Thus the Diode allows direct current to pass only in one


direction while blocking it in the other direction. Power
diodes are used in concerting AC into DC. In this,
current will flow freely during the first half cycle
(forward biased) and practically not at all during the
other half cycle (reverse biased). This makes the diode
an effective rectifier, which convert ac into pulsating
dc. Signal diodes are used in radio circuits for
detection. Zener diodes are used in the circuit to
control the voltage.

Some common diodes are:-

[Type the document title]

53

1. Zener diode.
2. Photo diode.
3. Light Emitting diode.

1.

ZENER DIODE:-

A zener diode is specially designed junction diode,


which can operate continuously without being damaged
in the region of reverse break down voltage. One of the
most important applications of zener diode is the
design of constant voltage power supply. The zener
diode is joined in reverse bias to d.c. through a
resistance R of suitable value.

2.

PHOTO DIODE:-

A photo diode is a junction diode made from photosensitive semiconductor or material. In such a diode,
there is a provision to allow the light of suitable
frequency to fall on the p-n junction. It is reverse
biased, but the voltage applied is less than the break
down voltage. As the intensity of incident light is

[Type the document title]

54

increased, current goes on increasing till it becomes


maximum. The maximum current is called saturation
current.

3.

LIGHT EMITTING DIODE (LED):-

When a junction diode is forward biased, energy is


released at the junction diode is forward biased, energy
is released at the junction due to recombination of
electrons and holes. In case of silicon and germanium
diodes, the energy released is in infrared region. In the
junction diode made of gallium arsenate or indium
phosphide, the energy is released in visible region.
Such a junction diode is called a light emitting diode or
LED.

POWER SUPPLY
In alternating current the electron flow is alternate, i.e.
the electron flow increases to maximum in one
direction, decreases back to zero. It then increases in
the other direction and then decreases to zero again.
Direct current flows in one direction only. Rectifier
converts alternating current to flow in one direction
only. When the anode of the diode is positive with
respect to its cathode, it is forward biased, allowing
current to flow. But when its anode is negative with
respect to the cathode, it is reverse biased and does

[Type the document title]

55

not allow current to flow. This unidirectional property of


the diode is useful for rectification. A single diode
arranged back-to-back might allow the electrons to flow
during positive half cycles only and suppress the
negative half cycles. Double diodes arranged back-toback might act as full wave rectifiers as they may allow
the electron flow during both positive and negative half
cycles. Four diodes can be arranged to make a full
wave bridge rectifier. Different types of filter circuits are
used to smooth out the pulsations in amplitude of the
output voltage from a rectifier. The property of
capacitor to oppose any change in the voltage applied
across them by storing energy in the electric field of the
capacitor and of inductors to oppose any change in the
current flowing through them by storing energy in the
magnetic field of coil may be utilized. To remove
pulsation of the direct current obtained from the
rectifier, different types of combination of capacitor,
inductors and resistors may be also be used to increase
to action of filtering.

NEED OF POWER SUPPLY


Perhaps all of you are aware that a power supply is a
primary requirement for the Test Bench of a home
experimenters mini lab. A battery eliminator can
eliminate or replace the batteries of solid-state
electronic equipment and the equipment thus can be
operated by 230v A.C. mains instead of the batteries or

[Type the document title]

56

dry cells. Nowadays, the use of commercial battery


eliminator or power supply unit has become
increasingly popular as power source for household
appliances like transreceivers, record player, cassette
players, digital clock etc.

USE OF DIODES IN RECTIFIERS:

Electric energy is available in homes and industries in


India, in the form of alternating voltage. The supply has
a voltage of 220V (rms) at a frequency of 50 Hz. In the
USA, it is 110V at 60 Hz. For the operation of most of
the devices in electronic equipment, a dc voltage is
needed. For instance, a transistor radio requires a dc
supply for its operation. Usually, this supply is provided
by dry cells. But sometime we use a battery eliminator
in place of dry cells. The battery eliminator converts the
ac voltage into dc voltage and thus eliminates the need
for dry cells. Nowadays, almost all-electronic equipment
includes a circuit that converts ac voltage of mains
supply into dc voltage. This part of the equipment is
called Power Supply. In general, at the input of the
power supply, there is a power transformer. It is
followed by a diode circuit called Rectifier. The output
of the rectifier goes to a smoothing filter, and then to a
voltage regulator circuit. The rectifier circuit is the heart
of a power supply.

[Type the document title]

57

RECTIFICATION
Rectification is a process of rendering an alternating
current or voltage into a unidirectional one. The
component used for rectification is called Rectifier. A
rectifier permits current to flow only during the positive
half cycles of the applied AC voltage by eliminating the
negative half cycles or alternations of the applied AC
voltage. Thus pulsating DC is obtained. To obtain
smooth DC power, additional filter circuits are required.

A diode can be used as rectifier. There are various


types of diodes. But, semiconductor diodes are very
popularly used as rectifiers. A semiconductor diode is a
solid-state device consisting of two elements is being
an electron emitter or cathode, the other an electron
collector or anode. Since electrons in a semiconductor
diode can flow in one direction only-from emitter to
collector- the diode provides the unilateral conduction
necessary for rectification. Out of the semiconductor
diodes, copper oxide and selenium rectifier are also
commonly used.

FULL WAVE RECTIFIER


It is possible to rectify both alternations of the input
voltage by using two diodes in the circuit arrangement.
Assume 6.3 V rms (18 V p-p) is applied to the circuit.
Assume further that two equal-valued series-connected

[Type the document title]

58

resistors R are placed in parallel with the ac source. The


18 V p-p appears across the two resistors connected
between points AC and CB, and point C is the electrical
midpoint between A and B. Hence 9 V p-p appears
across each resistor. At any moment during a cycle of
vin, if point A is positive relative to C, point B is
negative relative to C. When A is negative to C, point B
is positive relative to C. The effective voltage in proper
time phase which each diode "sees" is in Fig. The
voltage applied to the anode of each diode is equal but
opposite in polarity at any given instant.

When A is positive relative to C, the anode of D 1 is


positive with respect to its cathode. Hence D 1 will
conduct but D2 will not. During the second alternation,
B is positive relative to C. The anode of D 2 is therefore
positive with respect to its cathode, and D2 conducts
while D1 is cut off.

There is conduction then by either D1 or D2 during the


entire input-voltage cycle.

Since the two diodes have a common-cathode load


resistor RL, the output voltage across R L will result from
the alternate conduction of D1 and D2. The output

[Type the document title]

59

waveform vout across RL, therefore has no gaps as in


the case of the half-wave rectifier.

The output of a full-wave rectifier is also pulsating


direct current. In the diagram, the two equal resistors R
across the input voltage are necessary to provide a
voltage midpoint C for circuit connection and zero
reference. Note that the load resistor RL is connected
from the cathodes to this center reference point C.

An interesting fact about the output waveform v out is


that its peak amplitude is not 9 V as in the case of the
half-wave rectifier using the same power source, but is
less than 4 V. The reason, of course, is that the peak
positive voltage of A relative to C is 4 V, not 9 V, and
part of the 4 V is lost across R.

Though the full wave rectifier fills in the conduction


gaps, it delivers less than half the peak output voltage
that results from half-wave rectification.

BRIDGE RECTIFIER
A more widely used full-wave rectifier circuit is the
bridge rectifier. It requires four diodes instead of two,
but avoids the need for a centre-tapped transformer.

[Type the document title]

60

During the positive half-cycle of the secondary voltage,


diodes D2 and D4 are conducting and diodes D1 and
D3 are non-conducting. Therefore, current flows
through the secondary winding, diode D2, load resistor
RL and diode D4. During negative half-cycles of the
secondary voltage, diodes D1 and D3 conduct, and the
diodes D2 and D4 do not conduct. The current therefore
flows through the secondary winding, diode D1, load
resistor RL and diode D3. In both cases, the current
passes through the load resistor in the same direction.
Therefore, a fluctuating, unidirectional voltage is
developed across the load.
Filtration
The rectifier circuits we have discussed above deliver
an output voltage that always has the same polarity:
but however, this output is not suitable as DC power
supply for solid-state circuits. This is due to the
pulsation or ripples of the output voltage. This should
be removed out before the output voltage can be
supplied to any circuit. This smoothing is done by
incorporating filter networks. The filter network consists
of inductors and capacitors. The inductors or choke
coils are generally connected in series with the rectifier
output and the load. The inductors oppose any change
in the magnitude of a current flowing through them by
storing up energy in a magnetic field. An inductor offers
very low resistance for DC whereas; it offers very high
resistance to AC. Thus, a series connected choke coil in

[Type the document title]

61

a rectifier circuit helps to reduce the pulsations or


ripples to a great extent in the output voltage. The
fitter capacitors are usually connected in parallel with
the rectifier output and the load. As, AC can pass
through a capacitor but DC cannot, the ripples are thus
limited and the output becomes smoothed. When the
voltage across its plates tends to rise, it stores up
energy back into voltage and current. Thus, the
fluctuations in the output voltage are reduced
considerable. Filter network circuits may be of two
types in general:
CHOKE INPUT FILTER
If a choke coil or an inductor is used as the firstcomponents in the filter network, the filter is called
choke input filter. The D.C. along with AC pulsation
from the rectifier circuit at first passes through the
choke (L). It opposes the AC pulsations but allows the
DC to pass through it freely. Thus AC pulsations are
largely reduced. The further ripples are by passed
through the parallel capacitor C. But, however, a little
nipple remains unaffected, which are considered
negligible. This little ripple may be reduced by
incorporating a series a choke input filters.
CAPACITOR INPUT FILTER
If a capacitor is placed before the inductors of a chokeinput filter network, the filter is called capacitor input
filter. The D.C. along with AC ripples from the rectifier
circuit starts charging the capacitor C. to about peak
value. The AC ripples are then diminished slightly. Now
the capacitor C, discharges through the inductor or

[Type the document title]

62

choke coil, which opposes the AC ripples, except the


DC. The second capacitor C by passes the further AC
ripples. A small ripple is still present in the output of
DC, which may be reduced by adding additional filter
network in series.

CIRCUIT DIAGRAM

[Type the document title]

63

[Type the document title]

64

RELAY
Relay
is
a
common,
simple
application
of
electromagnetism. It uses an electromagnet made from
an iron rod wound with hundreds of fine copper wire.
When electricity is applied to the wire, the rod becomes
magnetic. A movable contact arm above the rod is then
pulled toward the rod until it closes a switch contact.
When the electricity is removed, a small spring pulls
the contract arm away from the rod until it closes a
second switch contact. By means of relay, a current
circuit can be broken or closed in one circuit as a result
of a current in another circuit.

Relays can have several poles and contacts. The types


of contacts could be normally open and normally
closed. One closure of the relay can turn on the same
normally open contacts; can turn off the other normally
closed contacts.

Relay requires a current through their coils, for which a


voltage is applied. This voltage for a relay can be D.C.
low voltages upto 24V or could be 240V a.c.

[Type the document title]

65

A relay is an These contacts can be either Normally


Open (NO), Normally Closed (NC), or change-over
contacts.
Normally-open contacts connect the circuit when
the relay is activated; the circuit is disconnected
when the relay is inactive. It is also called Form A
contact or "make" contact. Form A contact is ideal
for applications that require to switch a highcurrent power source from a remote device.
Normally-closed contacts disconnect the circuit
when the relay is activated; the circuit is connected
when the relay is inactive. It is also called Form B
contact or "break" contact. Form B contact is ideal
for applications that require the circuit to remain
closed until the relay is activated.
Change-over contacts control two circuits: one
normally-open contact and one normally-closed
contact with a common terminal. It is also called
Form C contact.
Operation
When

[Type the document title]

66

Relays are used:to control a


to control a high-current circuit with a low-current
signal, as in the starter solenoid of an automobile,
to detect and isolate faults on transmission and
distribution lines by opening and closing circuit
breakers (protection relays),
to isolate the controlling circuit from the controlled
circuit when the two are at different potentials, for
example when controlling a mains-powered device
from a low-voltage switch. The latter is often
applied to control office lighting as the low voltage
wires are easily installed in partitions, which may
be often moved as needs change. They may also
be controlled by room occupancy detectors in an
effort to conserve energy,
to perform logic functions. For example, the
boolean AND function is realised by connecting NO
relay contacts in series, the OR function by
connecting NO contacts in parallel. The changeover or Form C contacts perform the XOR
(exclusive or) function. Similar functions for NAND
and NOR are accomplished using NC contacts. Due
to the failure modes of a relay compared with a
semiconductor, they are widely used in safety
critical logic, such as the control panels of
radioactive waste handling machinery.
to perform time delay functions. Relays can be
modified to delay opening or delay closing a set of
contacts. A very short (a fraction of a second)
delay would use a copper disk between the
armature and moving blade assembly. Current

[Type the document title]

67

flowing in the disk maintains magnetic field for a


short time, lengthening release time. For a slightly
longer (up to a minute) delay, a dashpot is used. A
dashpot is a piston filled with fluid that is allowed
to escape slowly. The time period can be varied by
increasing or decreasing the flow rate. For longer
time periods, a mechanical clockwork timer is
installed.

RESISTANCE

[Type the document title]

68

Resistance is the opposition of a material to the


current. It is measured in Ohms (). All conductors
represent a certain amount of resistance, since no
conductor is 100% efficient. To control the electron flow
(current) in a predictable manner, we use resistors.
Electronic circuits use calibrated lumped resistance to
control the flow of current. Broadly speaking, resistor
can be divided into two groups viz. fixed & adjustable
(variable) resistors. In fixed resistors, the value is fixed
& cannot be varied. In variable resistors, the resistance
value can be varied by an adjuster knob. It can be
divided into (a) Carbon composition (b) Wire wound (c)
Special type. The most common type of resistors used
in our projects is carbon type. The resistance value is
normally indicated by colour bands. Each resistance
has four colours, one of the band on either side will be
gold or silver, this is called fourth band and indicates
the tolerance, others three band will give the value of
resistance (see table). For example if a resistor has the
following marking on it say red, violet, gold. Comparing
these coloured rings with the colour code, its value is
27000 ohms or 27 kilo ohms and its tolerance is 5%.
Resistor comes in various sizes (Power rating). The
bigger, the size, the more power rating of 1/4 watts.
The four colour rings on its body tells us the value of
resistor value as given below.
COLOURS

CODE

[Type the document title]

69

Black----------------------------------0
Brown---------------------------------1
Red------------------------------------2
Orange-------------------------------3
Yellow---------------------------------4
Green---------------------------------5
Blue-----------------------------------6
Violet----------------------------------7
Grey-----------------------------------8
White---------------------------------9

The first rings give the first digit. The second ring
gives the second digit. The third ring indicates the

[Type the document title]

70

number of zeroes to be placed after the digits. The


fourth ring gives tolerance (gold 5%, silver 10%, No
colour 20%).

In variable resistors, we have the dial type of


resistance boxes. There is a knob with a metal pointer.
This presses over brass pieces placed along a circle
with some space b/w each of them.

Resistance coils of different values are connected


b/w the gaps. When the knob is rotated, the pointer
also moves over the brass pieces. If a gap is skipped
over, its resistance is included in the circuit. If two gaps
are skipped over, the resistances of both together are
included in the circuit and so on.

A dial type of resistance box contains many dials


depending upon the range, which it has to cover. If a
resistance box has to read upto 10,000, it will have
three dials each having ten gaps i.e. ten resistance
coils each of resistance 10. The third dial will have
ten resistances each of 100.

The dial type of resistance boxes is better because


the contact resistance in this case is small & constant.

[Type the document title]

71

UNDER/OVER VOLTAGE
PROTECTION FOR DEVICES

Here is a simple solidstate circuit which provides both


under-voltage and over voltage protection to a
household device. Various types of commercial
stabilizers available in the market do not normally
provide the cut-off at the extreme voltage limits, which
is very important for devices.

If the supply voltage varies within +10V, there is no


harm done to a device. But protection is absolutely
essential if the supply varies beyond these limits. The
circuit described here cuts off the supply whenever it
goes beyond the set limits.

The base voltage of transistor T1 should be adjusted to


just over 6V with preset VR1 so that the under-voltage
relay RL1 just gets energized at the normal voltage.
This relay should get released at the lower voltage
limit. At normal voltage, RL1 should remain energized.

[Type the document title]

72

Similarly, the base voltage of T2 should be adjusted to


just under 6V by the corresponding preset VR2 such
that RL2 just gets energized at the upper voltage limit
and is released at the normal voltage.

Normally open contact (N/O) of RL1 normally-closed


contact (N/C) of RL2 are connected in series with the
supply.

This circuit can be used to protect power control


stations for overload protection and the same can be
interfaced with the PC or any microcontroller based
automation circuits.

[Type the document title]

73

MAKING PRINTED CIRCUIT BOARD


(P.C.B.)
INTRODUCTION-Making a Printed Circuit Board is the first step towards
building electronic equipment by any electronic
industry. A number of methods are available for making
P.C.B., the simplest method is of drawing pattern on a
copper clad board with acid resistant (etchants) ink or
paint or simple nail polish on a copper clad board and
do the etching process for dissolving the rest of copper
pattern in acid liquid.

[Type the document title]

74

MATERIAL REQUIRED
The apparatus needs for making a P.C.B. is :*

Copper Clad Sheet

Nail Polish or Paint

Ferric Chloride Powder. (Fecl)

Plastic Tray

Tap Water etc.

PROCEDURE
The first and foremost in the process is to clean all dirt
from copper sheet with say spirit or trichloro ethylene
to remove traces grease or oil etc. and then wash the
board under running tap water. Dry the surface with
forced warm air or just leave the board to dry naturally
for some time.

Making of the P.C.B. drawing involves some preliminary


consideration

such

as

thickness

of

lines/

holes

according to the components. Now draw the sketch of


P.C.B. design (tracks, rows, square) as per circuit
diagram with the help of nail polish or enamel paint or
any other acid resistant liquid. Dry the point surface in

[Type the document title]

75

open air, when it is completely dried, the marked holes


in P.C.B. may be drilled using 1Mm drill bits. In case
there is any shorting of lines due to spilling of paint,
these may be removed by scraping with a blade or a
knife, after the paint has dried.

After drying, 22-30 grams of ferric chloride in 75 ml of


water may be heated to about 60 degree and poured
over the P.C.B. , placed with its copper side upwards in
a plastic tray of about 15*20 cm. Stirring the solution
helps speedy etching. The dissolution of unwanted
copper would take about 45 minutes. If etching takes
longer, the solution may be heated again and the
process repeated. The paint on the pattern can be
removed P.C.B. may then be washed and dried. Put a
coat of varnish to retain the shine. Your P.C.B. is ready.
REACTION
Fecl3 + Cu ----- CuCl3 + Fe
Fecl3 + 3H2O --------- Fe (OH)3 + 3HCL

PRECAUTION

[Type the document title]

1.

76

Add Ferric Chloride (Fecl3) carefully, without any


splashing. Fecl3 is irritating to the skin and will
stain the clothes.

2.

Place the board in solution with copper side up.

3.

Try not to breathe the vapours. Stir the solution by


giving see-saw motion to the dish and solution in it.

4.

Occasionally warm if the solution over a heater-not


to boiling. After some time

the

unshaded

parts

change their colour continue to etch. Gradually the


base material will become visible. Etch for two
minutes more to get a neat pattern.
5.

Don't throw away the remaining Fecl3 solution. It


can be used again for next Printed Circuit Board
P.C.B.
USES

Printed Circuit Board are used for housing components


to make a circuit for compactness, simplicity of
servicing and case of interconnection. Thus we can
define the P.C.B. as : Prinked Circuit Boards is actually a
sheet of bakelite (an insulating material) on the one
side of which copper patterns are made with holes and
from another side, leads of electronic components are
inserted in the proper holes and soldered to the copper
points

on

the

back.

Thus

leads

of

electronic

[Type the document title]

77

components terminals are joined to make electronic


circuit.
In the boards copper cladding is done by pasting thin
copper foil on the boards during curing. The copper on
the board is about 2 mm thick and weights an ounce
per square foot.
The process of making a Printed Circuit for any
application

has

the

following

steps

(opted

professionally):

Preparing the layout of the track.

Transferring this layout photographically M the

copper.
*

Removing the copper in places which are not

needed, by the process of etching (chemical process)


*

Drilling holes for components mounting.

[Type the document title]

78

SOFTWARE PROGRAM
Written

in

language,

the

software

program

(Embed.c) for the microcontroller is simple and easy to


understand. You dont have to write long Assembly
language program for this operation. The program is
converted into Intel-Hex format for loading to the
microcontroller. Here, weve used cross-compiler C51
version 7.10 from Keil software fro conversion. The
demo version of this compiler is available for free on
the Website www.keil.com.
The C program includes < Regx51.h> file, which
defines pseudo-variables to interact with memorymapped devices and I/O ports fo the microcontroller.
The I/O ports P1.0 through P2.7 of AT89C51 are defined
in the program. The program line { if (t0 = = 0) { 14
= 1: instructs the microcontroller that if its input port
P2.2 should be high. Otherwise, P2.0 must be low.
The listing file (Embed.lst ) generated by keil compiler
is given at the end of this article. Note that this listing
file cannot be recompiled in any other assembler.

[Type the document title]

79

PROGRAM COMPILATION
After installing keil C51 in your system, you can compile
C program and generate hex file in either DOS or
Windows mode. Every time you create a new program
in keil C51 version 7.10, you must create a project file

[Type the document title]

80

with .uv2 extension. Then write the program in Edit


window, compile it and link it.
If you want to create your own program, the steps for
Windows mode are:
Install Keil software in C drive. After installation,
Keil uVision2 icon is automatically created on the
desktop.
Double-click Keil uVision2 on the desktop.
Suppose

you

have

C:\Window\Desktop\

kept

Embed.c

Embedded

folder.

under
Open

Ebed.c from File menu.


From Project menu bar, select New Project.
Name the new project and save it with .uv2
extension.
Select CPU as Atmel/AT89C51.
Choose Yes in the option Copy standard 8051
code to current project folder.

[Type the document title]

81

From View menu, select Project Window. Window


appears on the left-hand side of the PC screen.
Double-click Target 1.
Right-click Source Group1 and select Add files to
Group Source Group1. A window appears.
Add Embed.c and close this window.
Double-click Source Group1 in Project Workspace
window to get Embed.c (see the screenshot).
Right-click Embed.c in Project window, select
Options for File Embed.c and choose File Type as
C source file under Properties.
Again from Project menu, select Options for
Target 1. An Option screen appears.
Choose Output and tick Hex File for generating
the hex file. Again choose Listing option and tick
Conditional and Assembly code.

[Type the document title]

82

Open Project menu and select Build Target or


press F7 key.
For any syntax error, the window with contain a list of
errors with the line numbers. Double-clicking an error
message will cause the corresponding line in the source
edit window to be highlighted. Correct errors, if any,
and press F7 key again.

If compilation is successful, an object file with .obj


extension is created
for the source file. The compiler shows Embed- 0
Errors(s), 0 Warning
(s) in the output window just below the project window.
It also produces
a listing file with .Ist extension for the source file. Then
the system links
all the generated files into a combined hex file (with
.hex extension)
suitable for loading into the chip. In this example, the
files created are
startup. Obj, startup. Ist, Embed.obj, Embed.Ist
and Embed.hex.

[Type the document title]

83

1 Close the screen and go to Emebdded folder to


see the generated hex and listing files.
2 Load the hex file into the microcontroller chip using
a programmer.

Weve used Atmel Flash Programmer V.1 from Frontline


Electronics. It is a serial

port programmer. The

procedure for loading the hex file into Atmel Flash


programmer is given below:
1 Double-click the icon of the programmer.
2 Select the appropriate COM port from Setting
menu bar.
3 Select 89C51 from Selection option in Device
menu bar.
4 Load the hex file from File menu.
5 Choose Auto in Device menu bar. This will
automatically erase the previous program, if any,
and load the new program into the chip.

[Type the document title]

84

[Type the document title]

85

[Type the document title]

86

[Type the document title]

87

[Type the document title]

88

[Type the document title]

89

You might also like