Вы находитесь на странице: 1из 58

HOME APPLIANCE CONTROL

THROUGH

DTMF

[1]

CHAPTER 1.Introduction
What can be automated?
Earlier, we are looking into the face of future when we talked about automated
devices, which could do anything on instigation of a controller, but today it
has become a reality.
1. An automated device can replace good amount of human working force, moreover
humans are more prone to errors and in intensive conditions the probability of error
increases. Whereas an automated device can work with diligence, versatility and with
almost zero error.
2. This is why this project looks into construction and implementation of a system
involving hardware to control a variety of electrical and electronics instruments.

How is the system controlled in this project?


This circuit enables one to utilize a mobile for remote switching on and off of
any electrically operated device.. The circuit is only acoustically coupled to the
mobile instrument. Consequently, we do not have to pay a single extra paise to the
mobile department except call charges. The switching operation is performed by
making use of call + switch operations. While designing it has been ensured that
the circuit is free from any false triggering by normal mobile ring signals.
With the help of this project, it is possible to control any electrical appliances from
any distance. So its a very wonderful project for the future automation.
In this project we can control any electrical appliances through mobile or landline
from any part of the country. In this project one base unit is connected to the basic
landline in parallel with the existing mobile , but in the case of mobile phone we use
handsfree enhancement kit option logic.. When we want to control any electrical
appliances through outer phone then first we dial the home number, bell is ringing
and after few bell phone is automatic on answering mode and ready for further
operations . Now we press the eight digit excess code, one by one and if the excess
code is ok then unit give a ack in the form of beep sound . Now we press the switch
on/off code to on/off any electrical appliances. When we press a proper single digit
number for

on/off operation then connected unit is on/off. We use the

phone

keyboard for on/off the switches as per requirement. There is total 10 operations are
[2]

available. When the unit is on then circuit provide a reverse beep sound as a
acknowledgement. This beep sound is different in on and off cases. In the on
operation circuit feedback a two sound and in the off option circuit provide a single
beep sound.

[3]

CHAPTER 2.CIRCUIT USED


Complete circuit is divided into three parts.
1.

DTMF DECODER

2.

MICROCONTROLLER

3.

EXCESS CON

4.

TROL CIRCUIT

5.

AUTOMATIC ON THROUGH OUTER PHONE

DTMF DECODER.
Our project is based on the dtmf signaling logic. When we press any digit from any
phone then particular frequency is generated in the tone form. These frequencys are
DTMF frequency. We receive this frequency in the form of sound at the receiver
phone. At the receiver end we decode this type of frequency

with the help of

handsfree enhancement setting option. In every phone there is a option of auto answer
mode. On this mode phone is
Automatic transfer into answering mode after few bells. When the phone is automatic
on after few bell then if press any key from transmitter then same key sound is
available on the receiver end. We decode this sound with the help of the handsfree kit.
Output of handsfree kit is further connected to the DTMF decoder circuit
In DTMF decoder circuit we use 8870 IC. IC . 8870 converts the DTMF tones in
to corresponding binary outputs.
DTMF SIGNALLING.

Ac register signaling is used in dtmf mobiles, here

tones rather than make/break pulse are used fro dialing, each dialed digit is uniquely
represented by a pair of sine waves tones. These tones ( one from low group for row
and another from high group fro column) are sent to the exchange when a digit is
dialed by pushing the key, these tone lies within the speech band of 300 to 3400 hz,
and are chosen so as to minimize the possibility of any valid frequency pair existing
in normal speech simultaneously. Actually, this minimisator is made possible by
forming pairs with one tone from the higher group and the other from the lower of
frequencies. A valid dtmf signal is the sum of two tones, one from a lower group
( 697-940 Hz) and the other from a a higher group ( 1209-1663 Hz). Each group
contains four individual tones. This scheme allows 10 unique combinations. Ten of
these code represent digits 1 through 9 and 0. . tones in DTMF dialing are so chose
[4]

that none of the tones is harmonic of are other tone. Therefore is no change of
distortion caused by harmonics. Each tone is sent as along as the key remains pressed.
The dtmf signal contains only one component from each of the high and low group.
This significaly simplifies decoding because the composite dtmf signal may be
separated with band pass filters into single frequency components, each of which may
be handled individually.
MT8870 OUTPUT TRUTH TABLE.
F low

F high

KEY

BCD

697

1209

0001

697

1336

0010

697

1477

0011

770

1209

0100

770

1336

0101

770

1477

0110

852

1209

0111

852

1336

1000

852

1477

1001

941

1209

1010

[5]

CHAPTER 3.CIRCUIT WORKING.


IN this project our first part is DTMF decoder. DTMF ic receive the DTMF pulse and
then converted into binary coded decimal . Pin no 18 of the ic is connected to
positive supply, In this circuit we use 5 volt regulated power supply for the smooth
working.DTMF signal is applied to the pin no 2 and 3 of the ic through resistor and
capacitor network. Capacitor .1 microfarad work as a DC blocking capacitor. Pin no
5,6,9 is connected to the ground pin. Pin n0 7 and 8 is connected to the 3.57945 Mhz
crystal. Pin no 16 and 17 is connected to RC network work to provide a auto reset
option, when the supply is on .
Binary output is available on the pin no 11,12,13,1,4, and this output is further
connected to the Micro-controller 89c51 Our next part of the circuit is ic 89c51.
89c51 is 40 pin ic. Pin no 40 of the ic is connected to the 5 volt positive supply. Pin
no 40 and pin no 31 , both connected to the positive power supply. Pin no 20 of the
ic is connected to the common ground pin. Pin no 9 is a reset pin. One capacitor and
resistor network is connected to pin no 9. IN this IC there is total 4 ports are
available. So total 32 pins are available for input and output from the DTMF decoder
is connected to microcontroller and as well as connected to the password section.
Output from the Decoder is connected in parallel to the controller and as well as ic
74154. Here IC 74154 converts the bcd signal into decimal signal.
So signal from the decoder is first pass by the password section and when password
section pass the password then password section provide a signal to the controller.

[6]

3.1 BLOCK DIAGRAM

In this section we use two ic one is 74154 and second is IC 4017 . Both IC generate a
combination sequence by which we enable the micro-controller.
When we want to switch on the base unit by outer phone then phone is automatic on
after few bells, this is achive by another circuit. But after few bells when phone is on
and unit require a code of 8 DIGITS numbers. When we press a proper code , then
only micrcontroller allow us to switch on the circuit.
First IC of this section is IC 74154. IC 74154 is A bcd to decimal decoder. 74154 is
active low ic. Pin no 20,21,22,23 is connected to dtmf decoder ic.
Pin no 18 and 19 of this IC is connected to the collector of one NPN transistor Base of
the NPN transistor is connected to the pin no 15 of the ic 8870. When DTMF decoder
decode the signal at that time pin no 15 is on for a time and acknowledge the signal.
This signal is fed to the base of NPN transistor through 1 k ohm resistor. When this
signal is coming then 74154 is on and gives a output. Pin no 18 and 19 of the 74154 is
[7]

the enable pin of the ic. On this pin we provide a active low signal for activation If
we press the proper code in steps then at every digit of code 74154 is on and gives the
corresponding output as per the digit. Output of the ic 74154 is connected to the pnp
transistor base point through 10 k ohm resistor. Emitter of the all pnp transistor is
connected output of the decade counter circuit. Here we use ic 4017 as a decade
counter circuit. Pin no 16 is the positive supply pin and pin no 8 is the negative pin.
Pin no 14 of the ic is clock input of the ic.. On starting mode when is in on reset
mode then its start from the zero point.. O means first output is available on the pin no
3. Its means pin no 3 is positive in first output. Now ic 4017 receive a clock pulse on
pin no 14 then counter shifts its output from pin no 3 to nest output not 1 , pin no 2.
As we press the proper code then ic 74154 gives a output and this output is available
on the output pin, with the help of this output pnp transistor is on and positive output
is available on the collector point of the pnp transistor. All the pnp transistor collector
point is connected together is and reconnected to the clock input of the ic 4017
through rc network to another npn transistor. By this npn transistor we give a clock
pulse to the pin no 14 of the ic 4017. As the counter move after incoming clock pulse
then last output is available on the pin no 9. As the last output is available on the pin
no 9. After getting a voltage on the pin no 9 we switch on the next pair of npn
transistor. Output of first npn transistor is on collector is connected to the port p3.4 to
give a acknowledge signal that code lock is loaded successfully. Output of the this
npn transistor is again connected to the connected to the base of next npn transistor.
Collector of this npn transistor disable the pin no 18 of the ic to receive any further
code input of the signal
Output o ic 4017 ( with transistor circuit) not only provide a password ok signal to the
controller but at the same time switch off the ic 74154 to get another signal for
password.
Once the password section is ok then Microcontroller gets a signal and provide a
sound feedback in five beeps.
After getting a beep sound from the controller dialer person press a single digit a key
for the operation. As we press the single digit key , controller gets a signal from dtmf
decoder and further microcontroller on/off the corresponding output . All the outputs
are connected to the port P0 and P2. On these output we connect a 8 different l.e.ds.

[8]

As we press the digit code output l.e.d is on and remain on until we press the same
code again. Output is work as a toggle switch.
LED output of the microcontroller is further connected to the Triac circuit through
opto-coupler circuit. Output from the microcontroller is firstly connected to the
optocoupler pin no 1. This optocoupler is a special interface devide to interface the
controller with the triac circuit. The MOC3121( optocoupler) is optically isolated triac
driver devices. These devices contain a infra red emitting diode and a light activated
silicon bilateral switch. They are specially designed for interfacing between
electronics controls and power triac to control resistive and inductive loads for 240
volt Ac operation.
Pin no 1 is anode pin of infra red transmitter
Pin no2 is cathode pin of infra red transmitter
Pin no 4 and 6 is the output pin
Pin no 6 is output pin and connected to the gate of the triac through 100 ohm resistor.
At the output of the triac we control any 220 load. In this project its our choice, how
many optocoupler we interface this circuit. If we use 10 opto coupler then we
interface 10 load output with this circuit.
Now when ic receive any pulse then output led is on and then load is on. Again we
press the same code then led is off and load is also off.

[9]

CHAPTER 4. PROGRAMMING DETAIL OF THE MOBILE CONTROL MOBILE


CONTROL
PROGRAM IS TO BE WRIITEN IN THE ASSEMBLLY LANGUAGE IN THE 8051
ASSEMBLER. ASSEMBLER ASSEMBLE THE SOFTWARE AND THEN THIS
SOFTWARE IS FURTHER CONVERTED INTO THE HEX CODE WITH THE HELP
OF ASSEMBLER ITSELF. We TRANSFER THE HEX CODE IN TO BLANK IC
WITH THE HELP OF THE SERIAL PROGRAMMER KIT
In this program we receive the data from the dtmf decoder i.c and then this bcd input
is processed by the microcontroller.
ORG 0000H IS OUR FIRST OPERATION CODE . WE WRITTEN OUR CODE IN
THE 0000H LOCATION AND THEN START FROM 0000H LOCATION AND
JUMP TO THE MAIN PROGRGRAM BY USING COMMAND SJMP MAIN
Sjmp main
org 30h
main:
mov p3,#0ffh
mov p1,#0ffh
mov p2,#0ffh
mov p0,#0ffh
first of all we get a data on one port and then this is to be compare with the
accumulator for different value

back: mov a,p3


cjne a,#1,l1
cpl sw_1
call sound
s1:

mov a,p3
cjne a,#1,l1
jmp s1

here we use a command mov a, p3 . Here p3 means port 3 , from where we get a data
to the accumulator, We change this location as per the pcb design, If the port position
is change we change the command also, if the input is port p2 then we use mov a,p2
command
[10]

l1:

mov a,p3
anl a,#0fh
cjne a,#2,l2
call sound

s2:

mov a,p3
cjne a,#2,l2
jmp s2

l2:

mov a,p3
cjne a,#3,l3
call sound

s3:

mov a,p3
cjne a,#3,l3
jmp s3

l3:

mov a,p3
cjne a,#4,l4
call sound

s4:

mov a,p3
cjne a,#4,l4
jmp s4

l4:

mov a,p3
cjne a,#5,l5
call sound

s5:

mov a,p3
cjne a,#5,l5
jmp s5

l5:

mov a,p3
anl a,#0fh
cjne a,#6,l6
call sound

s6:

mov a,p3
[11]

cjne a,#6,l6
jmp s6
l6:

mov a,p3
cjne a,#7,l7
call sound

s7:

mov a,p3
cjne a,#7,l7
jmp s7

l7:

mov a,p3
cjne a,#8,l8
call sound

s8:

mov a,p3
cjne a,#8,l8
jmp s8

l8:

mov a,p3
anl a,#0fh
cjne a,#9,l9
call sound

s9:

mov a,p3
cjne a,#9,l9
jmp s9

l9:

mov a,p3
cjne a,#10,l10
call sound

s10: mov a,p3


cjne a,#10,l10
jmp s10
l10:

jmp back

sound:
[12]

mov tick,#2
go_back:call delay100ms
go:

mov tick,#1

jmp go_back
clr buzzer
call delay
setb buzzer
call delay
ret
delay:
mov r0,#20
loop: djnz r0,loop
ret
mov r5,#4
sim_4: call delay100ms
djnz r5,sim_4

[13]

CHAPTER 5.CIRCUIT DIAGRAM

[14]

COMPONENTS USED:
STEP DOWN TRANSFORMER 220 AC TO 12 VOLT AC.
DIODE IN 4007 ( 4)
CAPACITOR 1000MFD (1), 27PF(2), .01 (2)
IC= 7805 ( 5 VOLT REGULATOR), 8870 ( DTMF DECODER)
8870 DTMF DECODER
74154 BCD TO DECIMAL DECODER
89S51 ( 8051 CONTROLLER)
MOC 3021 OPTOCOUPLER(5)
TRIAC BT 136 (5)
NPN TRANSISTOR(3) BC 548
PNP TRANSISTOR (9) BC 558
L.E.D ( 14)
CRYSTAL 3.58 Mhtz for 8870.
12 Mhtz for microcontroller.
BUZZER ( acknowledgement sound)
RESISTOR: 22K,(2), 10K(20), 1K(6), 470 OHM(20),100 OHM (5)

[15]

CHAPTER 6.
HOW TO PROGRAM BLANK CHIP
First of all we select and open the assembler and wrote a program code in the file.
After wrote a software we assemble the software by using internal assembler of the
8051 editor. If there is no error then assembler assemble the software abd 0 error is
show the output window.

now assembler generate a ASM file and HEX file. This hex file is useful for us to
program the blank chip.
Now we transfer the hex code into the blank chip with the help of serial programmer
kit. In the programmer we insert a blank chip 0f 89s51 series . these chips are multi
time programmable chip. This programming kit is seperatally available in the market
and we transfer the hex code into blank chip with the help of the serial programmer
kit

[16]

[17]

[18]

CHAPTER 7.
WHAT IS DTMF: When you press a button in the mobile set
keypad, a connection is made that generates a resultant
signal of two tones at the same time. These two tones are
taken from a row frequency and a column frequency. The
resultant frequency signal is called "Dual Tone Multiple
Frequency". These tones are identical and unique. A DTMF
signal

is

the

algebraic

sum

of

two

different

audio

frequencies, and can be expressed as follows:


f(t)

A0sin(2**fa*t)

------->(1)

Where

fa

and

B0sin(2**fb*t)
fb

are

two

...........

different

audio

frequencies with A and B as their peak amplitudes and f as


the resultant DTMF signal. fa belongs to the low frequency
group and fb belongs to the high frequency group. Each of
the

low

and

high

frequency

groups

comprise

four

frequencies from the various keys present on the mobile


keypad;

two

different

frequencies,

one

from

the

high

frequency group and another from the low frequency group


are used to produce a DTMF signal to represent the pressed
key. The amplitudes of the two sine waves should be such
that
(0.7 < (A/B) < 0.9)V

-------->(2)
[19]

The frequencies are chosen such that they are not the
harmonics of each other. The frequencies associated with
various keys on the keypad are shown in figure (A).
When you send these DTMF signals to the mobile exchange
through cables, the servers in the mobile exchange identifies
these signals and makes the connection to the person you
are calling.

The row and column frequencies are given below:

Fig (A)
When you press the digit 5 in the keypad it generates a
resultant tone signal which is made up of frequencies 770Hz
and 1336Hz. Pressing digit 8 will produce the tone taken
from tones 852Hz and 1336Hz. In both the cases, the column
frequency 1336 Hz is the same. These signals are digital
signals which are symmetrical with the sinusoidal wave.
A Typical frequency is shown in the figure below:

[20]

Figure (B)
Along with these DTMF generator in our mobile set provides
a set of special purpose groups of tones, which is normally
not used in our keypad. These tones are identified as 'A', 'B',
'C', 'D'. These frequencies have the same column frequency
but uses row frequencies given in the table in figure (A).
These tones are used for communication signaling.
The frequency table is as follows:

Figure (C)
Due to its accuracy and uniqueness, these DTMF signals
are used in controlling systems using mobiles. By using some
DTMF generating ICs (UM91214, UM91214, etc) we can
generate DTMF tones without depending on the telepho
[21]

Look around. Notice the smart intelligent systems? Be it the T.V, washing
machines, video games, mobiles, automobiles, aero planes, power systems, or any
application having a LED or a LCD as a user interface, the control is likely to be in
the

Ports,

hands

timers,

of

clock

circuits,

micro

counters,

reset

controller!

functions

etc.

CHAPTER 8. 8051 DESCRIPTION

8051
The 8051 developed and launched in the early 80`s, is one of the most popular micro
controller in use today. It has a reasonably large amount of built in ROM and RAM.
In addition it has the ability to access external memory.
The generic term `8x51` is used to define the device. The value of x defining the kind
of ROM, i.e. x=0, indicates none, x=3, indicates mask ROM, x=7, indicates EPROM
and x=9 indicates EEPROM or Flash.
A note on ROM
The early 8051, namely the 8031 was designed without any ROM. This device could
run only with external memory connected to it. Subsequent developments lead to the
development of the PROM or the programmable ROM. This type had the
disadvantage of being highly unreliable.
The next in line, was the EPROM or Erasable Programmable ROM. These devices
used ultraviolet light erasable memory cells. Thus a program could be loaded, tested
and erased using ultra violet rays. A new program could then be loaded again.
An improved EPROM was the EEPROM or the electrically erasable PROM. This
does not require ultra violet rays, and memory can be cleared using circuits within the
[22]

chip itself.
Finally there is the FLASH, which is an improvement over the EEPROM. While the
terms EEPROM and flash are sometimes used interchangeably, the difference lies in
the fact that flash erases the complete memory at one stroke, and not act on the
individual cells. This results in reducing the time for erasure.
Different microcontrollers in market.
PIC One of the famous microcontrollers used in the industries. It is based on RISC
Architecture which makes the microcontroller process faster than other
microcontroller.
INTEL

These are the first to manufacture microcontrollers. These are not as

sophisticated other microcontrollers but still the easiest one to learn.


ATMEL Atmels AVR microcontrollers are one of the most powerful in the
embedded industry. This is the only microcontroller having 1kb of ram even the entry
stage. But it is unfortunate that in India we are unable to find this kind of
microcontroller.
INTEL 8051 Intel 8051 is CISC architecture which is easy to program in assembly
language and also has a good support for High level languages.The memory of the
microcontroller can be extended up to 64k.This microcontroller is one of the easiest
microcontrollers to learn.The 8051 microcontroller is in the field for more than 20
years. There are lots of books and study materials are readily available for 8051.
Derivatives The best thing done by Intel is to give the designs of the 8051
microcontroller to everyone. So it is not the fact that Intel is the only manufacture for
the 8051 there more than 20 manufactures, with each of minimum 20 models.
Literally there are hundreds of models of 8051 microcontroller available in market to
choose. Some of the major manufactures of 8051 are
Atmel
Philips
Philips The Philipss 8051 derivatives has more number of features than in any
microcontroller. The costs of the Philips microcontrollers are higher than the Atmels
which makes us to choose Atmel more often than Philips
[23]

Dallas Dallas has made many revolutions in the semiconductor market. Dallass 8051
derivative is the fastest one in the market. It works 3 times as fast as a 8051 can
process. But we are unable to get more in India.
Atmel These people were the one to master the flash devices. They are the cheapest
microcontroller available in the market. Atmels even introduced a 20pin variant of
8051 named 2051. The Atmels 8051 derivatives can be got in India less than 70
rupees. There are lots of cheap programmers available in India for Atmel. So it is
always good for students to stick with 8051 when you learn a new microcontroller.

8.1
Architecture :Architecture is must to learn because before learning new machine it is
necessary to learn the capabilities of the machine. This is some thing like before
learning about the car you cannot become a good driver. The architecture of the 8051
is given below.

[24]

The 8051 doesnt have any special feature than other microcontroller. The only
feature is that it is easy to learn. Architecture makes us to know about the hardware
features of the microcontroller. The features of the 8051 are

4K Bytes of Flash Memory

128 x 8-Bit Internal RAM

Fully Static Operation: 1 MHz to 24 MHz

32 Programmable I/O Lines

Two 16-Bit Timer/Counters

Six Interrupt Sources (5 Vectored)

Programmable Serial Channel

Low Power Idle and Power Down Modes

The 8051 has a 8-Bit CPU that means it is able to process 8 bit of data at a time. 8051
has 235 instructions. Lets now move on to a practical example. We shall work on a
simple practical application and using the example as a base, shall explore the various
features

of

the

8051

Consider an electric circuit as follows,

[25]

microcontroller.

The positive side (+ve) of the battery is connected to one side of a switch. The other
side of the switch is connected to a bulb or LED (Light Emitting Diode). The bulb is
then connected to a resistor, and the other end of the resistor is connected to the
negative

(-ve)

side

of

the

battery.

When the switch is closed or switched on the bulb glows. When the switch is open
or switched off the bulb goes off
If you are instructed to put the switch on and off every 30 seconds, how would you do
it? Obviously you would keep looking at your watch and every time the second hand
crosses 30 seconds you would keep turning the switch on and off.
Imagine if you had to do this action consistently for a full day. Do you think you
would be able to do it? Now if you had to do this for a month, a year??
No way, you would say!
The next step would be, then to make it automatic. This is where we use the
Microcontroller.
But if the action has to take place every 30 seconds, how will the microcontroller keep
track of time?
Executiontime
Look at the following instruction,
clr p1.0
This is an assembly language instruction. It means we are instructing the
microcontroller to put a value of zero in bit zero of port one. This instruction is
equivalent to telling the microcontroller to switch on the bulb. The instruction then to
instruct the microcontroller to switch off the bulb is,
Set p1.0
This instructs the microcontroller to put a value of one in bit zero of port one.
Dont worry about what bit zero and port one means. We shall learn it in more detail
[26]

as we proceed.
There are a set of well defined instructions, which are used while communicating with
the microcontroller. Each of these instructions requires a standard number of cycles to
execute. The cycle could be one or more in number.
How is this time then calculated?
The speed with which a microcontroller executes instructions is determined by what is
known as the crystal speed. A crystal is a component connected externally to the
microcontroller. The crystal has different values, and some of the used values are
6MHZ, 10MHZ, and 11.059 MHz etc.
Thus a 10MHZ crystal would pulse at the rate of 10,000,000 times per second.
The time is calculated using the formula
No of cycles per second = Crystal frequency in HZ / 12.
For a 10MHZ crystal the number of cycles would be,
10,000,000/12=833333.33333 cycles. This means that in one second, the
microcontroller would execute 833333.33333 cycles. Therefore for one cycle, what
would be the time? Try it out. The instruction clr p1.0 would use one cycle to execute.
Similarly, the instruction setb p1.0 also uses one cycle.So go ahead and calculate what
would be the number of cycles required to be executed to get a time of 30 seconds!
Getting back to our bulb example, all we would need to do is to instruct the
microcontroller to carry out some instructions equivalent to a period of 30 seconds,
like counting from zero upwards, then switch on the bulb, carry out instructions
equivalent to 30 seconds and switch off the bulb. Just put the whole thing in a loop,
and you have a never ending on-off sequence.Let us now have a look at the features
of the 8051 core, keeping the above example as a reference,
1. 8-bit CPU.( Consisting of the A and B registers)
Most of the transactions within the microcontroller are carried out through the A
register, also known as the Accumulator. In addition all arithmetic functions are
carried out generally in the A register. There is another register known as the B
register, which is used exclusively for multiplication and division.
[27]

Thus an 8-bit notation would indicate that the maximum value that can be input into
these registers is 11111111. Puzzled?
The value is not decimal 111, 11,111! It represents a binary number, having an
equivalent value of FF in Hexadecimal and a value of 255 in decimal.
We shall read in more detail on the different numbering systems namely the Binary
and Hexadecimal system in our next module.
2. 4K on-chip ROM
Once you have written out the instructions for the microcontroller, where do you put
these instructions?
Obviously you would like these instructions to be safe, and not get deleted or changed
during execution. Hence you would load it into the ROMThe size of the program
you write is bound to vary depending on the application, and the number of lines. The
8051 microcontroller gives you space to load up to 4K of program size into the
internal ROM. 4K, thats all? Well just wait. You would be surprised at the amount of
stuff you can load in this 4K of space. Of course you could always extend the space
by connecting to 64K of external ROM if required.
3. 128 bytes on-chip RAM
This is the space provided for executing the program in terms of moving data, storing
data etc.
4. 32 I/O lines. (Four- 8 bit ports, labeled P0, P1, P2, P3)
In our bulb example, we used the notation p1.0. This means bit zero of port one. One
bit controls one bulb.
Thus port one would have 8 bits. There are a total of four ports named p0, p1, p2, p3,
giving a total of 32 lines. These lines can be used both as input or output.
5. Two 16 bit timers / counters.
A microcontroller normally executes one instruction at a time. However certain
applications would require that some event has to be tracked independent of the main
program. The manufacturers have provided a solution, by providing two timers. These
timers execute in the background independent of the main program. Once the require
time has been reached, (remember the time calculations described above?), they can
trigger a branch in the main program. These timers can also be used as counters, so
that they can count the number of events, and on reaching the required count, can
cause a branch in the main program.
6. Full Duplex serial data receiver / transmitter.
[28]

The 8051 microcontroller is capable of communicating with external devices like the
PC etc. Here data is sent in the form of bytes, at predefined speeds, also known as
baud rates.
The transmission is serial, in the sense, one bit at a time
7. 5- interrupt sources with two priority levels (Two external and three internal)
During the discussion on the timers, we had indicated that the timers can trigger a
branch in the main program. However, what would we do in case we would like the
microcontroller to take the branch, and then return back to the main program, without
having to constantly check whether the required time / count has been reached?
This is where the interrupts come into play. These can be set to either the timers, or to
some external events. Whenever the background program has reached the required
criteria in terms of time or count or an external event, the branch is taken, and on
completion of the branch, the control returns to the main program.
Priority levels indicate which interrupt is more important, and needs to be executed
first in case two interrupts occur at the same time.
8. On-chip clock oscillator.
This represents the oscillator circuits within the microcontroller. Thus the hardware is
reduced to just simply connecting an external crystal, to achieve the required pulsing
rate.
PIN FUNCTION OF IC 89C51.
Supply pin of this ic is pin no 40. Normally we apply a 5 volt regulated dc power
supply to this pin. For this purpose either we use step down transformer power supply
or we use 9 volt battery with 7805 regulator.
Ground pin of this ic is pin no 20. Pin no 20 is normally connected to the ground pin
( normally negative point of the power supply.
XTAL is connected to the pin no 18 and pin no 19 of this ic. The quartz crystal
oscillator connected to XTAL1 and

XTAL2 PIN. These pins also needs two

capacitors of 30 pf value. One side of each capacitor is connected to crystal and


other pis is connecte to the ground point. Normally we connect a 12 MHz or 11.0592
MHz crystal with this ic.. But we use crystal upto 20 MHz to this pins
RESET PIN.. Pin no 9 is the reset pin of this ic.. It is an active high pin. On
applying a high pulse to this pin, the micro controller will reset and terminate all
activities. This is often referred to as a power on reset. The high pulse must
be high for a minimum of 2 machine cycles before it is allowed to go low.
[29]

PORT0 Port 0 occupies a total of 8 pins. Pin no 32 to pin no 39. It can be used for
input or output. We connect all the pins of the port 0 with the pullup resistor (10 k
ohm) externally. This is due to fact that port 0 is an open drain mode. It is just like a
open collector transistor.
PORT1. ALL the ports in micrcontroller is 8 bit wide pin no 1 to pin no 8 because it
is a 8 bit controller. All the main register and sfr all is mainly 8 bit wide. Port 1 is
also occupies a 8 pins. But there is no need of pull up resistor in this port. Upon reset
port 1 act as a input port. Upon reset all the ports act as a input port
PORT2. port 2 also have a 8 pins. It can be used as a input or output. There is no
need of any pull up resistor to this pin.
PORT 3. Port3 occupies a totoal 8 pins from pin no 10 to pin no 17. It can be
used as input or output. Port 3 does not require any pull up resistor. The same as port
1 and port2. Port 3 is configured as an output port on reset. Port 3 has the additional
function of providing some important signals such as interrupts. Port 3 also use for
serial communication.
ALE ALE is an output pin and is active high. When connecting an 8031 to external
memory, port 0 provides both address and data. In other words, the 8031 multiplexes
address and data through port 0 to save pins. The ALE pin is used for demultiplexing
the address and data by connecting to the ic 74ls373 chip.

PSEN. PSEN stands for program store eneable. In an 8031 based system in which an
external rom holds the program code, this pin is connected to the OE pin of the rom.
EA. EA. In 89c51 8751 or any other family member of the ateml 89c51 series all
come with on-chip rom to store programs, in such cases the EA pin is connected to
the Vcc. For family member 8031 and 8032 is which there is no on chip rom, code is
stored in external memory and this is fetched by 8031. In that case EA pin must be
connected to GND pin to indicate that the code is stored externally.

[30]

8.2
SPECIAL FUNCTION REGISTER ( SFR) ADDRESSES.

ACC

ACCUMULATOR

0E0H

B REGISTER

0F0H

PSW

PROGRAM STATUS WORD

0D0H

SP

STACK POINTER

81H

DPTR

DATA POINTER 2 BYTES

DPL

LOW BYTE OF DPTR

82H

DPH

HIGH BYTE OF DPTR

83H

P0

PORT0

80H

P1

PORT1

90H

P2

PORT2

0A0H

P3

PORT3

0B0H

TMOD

TIMER/COUNTER MODE CONTROL

89H

[31]

TCON

TIMER COUNTER CONTROL

88H

TH0

TIMER 0 HIGH BYTE

8CH

TLO

TIMER 0 LOW BYTE

8AH

TH1

TIMER 1 HIGH BYTE

8DH

TL1

TIMER 1 LOW BYTE

8BH

SCON

SERIAL CONTROL

98H

SBUF

SERIAL DATA BUFFER

99H

PCON

POWER CONTROL

87H

8.3
INSTRUCTIONS
SINGLE BIT INSTRUCTIONS.
SETB BIT

SET THE BIT =1

CLR BIT

CLEAR THE BIT =0

CPL BIT

COMPLIMENT THE BIT 0 =1, 1=0

JB BIT,TARGET

JUMP TO TARGET IF BIT =1

JNB BIT, TARGET

JUMP TO TARGET IF BIT =0

JBC BIT,TARGET

JUMP TO TARGET IF BIT =1 &THEN CLEAR THE

BIT

[32]

MOV INSTRUCTIONS
MOV instruction simply copy the data from one location to another location
MOV D,S
Copy the data from(S) source to D(destination)
MOV R0,A

; Copy contents of A into Register R0

MOV R1,A

; Copy contents of A into register R1

MOV A,R3

; copy contents of Register R3 into Accnmulator.

DIRECT LOADING THROUGH MOV


MOV A,#23H

; Direct load the value of 23h in A

MOV R0,#12h

; direct load the value of 12h in R0

MOV R5,#0F9H

; Load the F9 value in the Register R5

ADD INSTRUCTIONS.
ADD instructions adds the source byte to the accumulator ( A) and place the result in
the Accumulator.
MOV A, #25H
ADD A,#42H ; BY this instructions we add the value 42h in Accumulator ( 42H+
25H)
ADDA,R3

;By this instructions we move the data from register r3 to accumulator

and then add the contents of the register into accumulator .


SUBROUTINE CALL FUNCTION.
[33]

ACALL,TARGET ADDRESS
By this instructions we call subroutines with a target address within 2k bytes from
the
current program counter.
LCALL, TARGET ADDRESS.
AJMP TARGET ADDRESS.
This is for absolute jump
AJMP stand for absolute jump. It transfers program execution to the target address
unconditionally. The target address for this instruction must be withib 2 k byte of
program memory.
LJMP is also for absoltute jump. It tranfer program execution to the target addres
unconditionally. This is a 3 byte instructions LJMP jump to any address within 64 k
byte location.
INSTRUCTIONS RELATED TO THE CARRY
JC TARGET
JUMP TO THE TARGET IF CY FLAG =1
JNC TARGET
JUMP TO THE TARGET ADDRESS IF CY FLAG IS = 0
INSTRUCTIONS RELASTED TO JUMP WITH ACCUMULATOR
JZ TARGET
JUMP TO TARGET IF A = 0
JNZ TARGET
JUMP IF ACCUMULATOR IS NOT ZERO
This instructions jumps if registe A has a value other than zero
INSTRUCTIONS RELATED TO THE ROTATE
RL A
ROTATE LEFT THE ACCUMULATOR
BY this instructions we rotate the bits of A left. The bits rotated out of A are rotated
back into A at the opposite end

[34]

RR A
By this instruction we rotate the contents of the accumulator from right to left from
LSB to MSB
RRC A
This is same as RR A but difference is that the bit rotated out of register first enter in
to carry and then enter into MSB
RLC A
ROTATE A LEFT THROUGH CARRY
Same as above but but shift the data from MSB to carry and carry to LSB
RET
This is return from subroutine. This instructions is used to return from a subroutine
previously entered by instructions LCALL and ACALL.
RET1
THIS is used at the end of an interrupt service routine. We use this instructions after
intruupt routine,
PUSH.
This copies the indicated byte onto the stack and increments SP by . This instructions
supports only direct addressing mode.
POP.
POP FROM STACK.
This copies the byte pointed to be SP to the location whose direct address is
indicated, and decrements SP by 1. Notice that this instructions supports only direct
addressing mode.

DPTR INSTRUCTIONS.
MOV DPTR,#16 BIT VALUE
LOAD DATA POINTER
This instructions load the 16 bit dptr register with a 16 bit immediate value
MOV C A,@A+DPTR
This instructions moves a byte of data located in program ROM into register A. This
allows us to put strings of data, such as look up table elements.

[35]

MOVC A,@A+PC
This instructions moves a byte of data located in the program area to A. the address of
the desired byte of data is formed by adding the program counter ( PC) register to the
original value of the accumulator.
INC BYTE
This instructions add 1 to the register or memory location specified by the operand.
INC A
INC Rn
INC DIRECT
DEC BYTE
This instructions subtracts 1 from the byte operand. Note that CY is unchanged
DEC A
DEC Rn
DEC DIRECT

ARITHMATIC INSTRUCTIONS.
ANL dest-byte, source-byte
This perform a logical AND operation
This performs a logical AND on the operands, bit by bit, storing the result in the
destination. Notice that both the source and destination values are byte size only
DIV AB
This instructions divides a byte accumulator by the byte in register B. It is assumed
that both register A and B contain an unsigned byte. After the division the quotient
will be in register A and the remainder in register B.
[36]

TMOD ( TIMER MODE ) REGISTER

Both timer is the 89c51 share the one register TMOD. 4 LSB bit for the timer 0 and 4
MSB for the timer 1.
In each case lower 2 bits set the mode of the timer
Upper two bits set the operations.
GATE:Gating control when set. Timer/counter is enabled only while the INTX pin is
high and the TRx control pin is set. When cleared, the timer is enabled whenever the
TRx control bit is set
C/T : Timer or counter selected cleared for timer operation ( input from internal
system clock)
M1

Mode bit 1

M0

Mode bit 0

M1

M0

MODE

OPERATING MODE

13 BIT TIMER/MODE

16 BIT TIMER MODE

8 BIT AUTO RELOAD

SPLIT TIMER MODE

[37]

PSW ( PROGRAM STATUS WORD)

CY

PSW.7

CARRY FLAG

AC

PSW.6

AUXILIARY CARRY

F0

PSW.5

AVAILABLE FOR THE USER FRO GENERAL PURPOSE

RS1

PSW.4

REGISTER BANK SELECTOR BIT 1

RS0

PSW.3

REGISTER BANK SELECTOR BIT 0

0V

PSW.2

OVERFLOW FLAG

--

PSW.1

USER DEFINABLE BIT

PSW.0

PARITY FLAG SET/CLEARED BY HARDWARE

PCON REGISATER ( NON BIT ADDRESSABLE)

If the SMOD = 0 ( DEFAULT ON RESET)

[38]

TH1

CRYSTAL FREQUENCY
256---- ____________________
384 X BAUD RATE

If the SMOD IS = 1
CRYSTAL FREQUENCY
TH1

256-------------------------------------192 X BAUD RATE

There are two ways to increase the baud rate of data transfer in the 8051
1.

To use a higher frequency crystal

2.

To change a bit in the PCON register

PCON register is an 8 bit register . Of the 8 bits, some are unused, and some are used
for the power control capability of the 8051. the bit which is used for the serial
communication is D7, the SMOD bit. When the 8051 is powered up, D7 ( SMOD BIT)
OF PCON register is zero. We can set it to high by software and thereby double the
baud rate
BAUD RATE COMPARISION FOR SMOD = 0 AND SMOD =1
TH1

( DECIMAL)

HEX

SMOD =0

SMOD =1

-3

FD

9600

19200

-6

FA

4800

9600

-12

F4

2400

4800

-24

E8

1200

2400

XTAL = 11.0592 MHZ


IE ( INTERRUPT ENABLE REGISTOR)

[39]

EA

IE.7

Disable all interrupts if EA = 0, no interrupts is acknowledged


If EA is 1, each interrupt source is individually enabled or disbaled
By sending or clearing its enable bit.

IE.6

NOT implemented

ET2

IE.5

enables or disables timer 2 overflag in 89c52 only

ES

IE.4

Enables or disables all serial interrupt

ET1

IE.3

Enables or Disables timer 1 overflow interrupt

EX1

IE.2

Enables or disables external interrupt

ET0

IE.1

Enables or Disbales timer 0 interrupt.

EX0

IE.0

Enables or Disables external interrupt 0

INTERRUPT PRIORITY REGISTER

If the bit is 0, the corresponding interrupt has a lower priority and if the bit is 1 the
corresponding interrupt has a higher priority

[40]

IP.7

NOT IMPLEMENTED, RESERVED FOR FUTURE USE.

IP.6

NOT IMPLEMENTED, RESERVED FOR FUTURE USE

PT2

IP.5

DEFINE THE TIMER 2 INTERRUPT PRIORITY LELVEL

PS

IP.4

DEFINES THE SERIAL PORT INTERRUPT PRIORITY LEVEL

PT1

IP.3

DEFINES THE TIMER 1 INTERRUPT PRIORITY LEVEL

PX1

IP.2

DEFINES EXTERNAL INTERRUPT 1 PRIORITY LEVEL

PT0

IP.1

DEFINES THE TIMER 0 INTERRUPT PRIORITY LEVEL

PX0

IP.0

DEFINES THE EXTERNAL INTERRUPT 0 PRIORITY LEVEL

SCON: SERIAL PORT CONTROL REGISTER , BIT ADDRESSABLE


SCON

SM0

SCON.7 Serial Port mode specifier

SM1

SCON.6 Serial Port mode specifier

SM2

SCON.5

REN

SCON.4 Set/cleared by the software to Enable/disable reception

TB8

SCON.3

The 9th bit that will be transmitted in modes 2 and 3,

Set/cleared
By software
[41]

RB8

SCON.2 In modes 2 &3, is the 9 th data bit that was received. In mode

1,
If SM2 = 0, RB8 is the stop bit that was received. In mode 0
RB8 is not used
T1

SCON.1 Transmit interrupt flag. Set by hardware at the end of the 8 th

bit
Time in mode 0, or at the beginning of the stop bit in the
other
Modes. Must be cleared by software
R1

SCON.0 Receive interrupt flag. Set by hardware at the end of the 8th bit
Time in mode 0, or halfway through the stop bit time in the

other
Modes. Must be cleared by the software.
TCON

TIMER COUNTER CONTROL REGISTER

This is a bit addressable


TF1

TCON.7

Timer 1 overflow flag. Set by hardware when the

Timer/Counter 1
Overflows. Cleared by hardware as processor
TR1

TCON.6

Timer 1 run control bit. Set/cleared by software to turn Timer


Counter 1 On/off

TF0

TCON.5

Timer 0 overflow flag. Set by hardware when the timer/counter

0
Overflows. Cleared by hardware as processor
TR0

TCON.4

Timer 0 run control bit. Set/cleared by software to turn timer


Counter 0 on/off.
[42]

IE1

TCON.3

External interrupt 1 edge flag

ITI

TCON.2

Interrupt 1 type control bit

IE0

TCON.1

External interrupt 0 edge

IT0

TCON.0

Interrupt 0 type control bit.

8051 Instruction Set


Arithmetic Operations
Mnemonic

Description

Size

Cycles

ADD A,Rn

Add register to Accumulator (ACC).

ADD A,direct Add direct byte to ACC.


ADD A,@Ri Add indirect RAM to ACC

ADD A,#data Add immediate data to ACC

ADDC A,Rn Add register to ACC with carry

ADDC A,direct

Add direct byte to ACC with carry.

ADDC A,@Ri

Add indirect RAM to ACC with carry.

ADDC A,#data

Add immediate data to ACC with carry.

Subtract direct byte from ACC with borrow 2

SUBB A,Rn

Subtract register from ACC with borrow.

SUBB A,direct

SUBB A,@Ri Subtract indirect RAM from ACC with borrow.

[43]

SUBB A,#data
INC A

Subtract immediate data from ACC with borrow.


Increment ACC.

INC Rn

Increment register.

INC direct

Increment direct byte.

INC @Ri

Increment indirect RAM.

Decrement ACC.

DEC A

DEC Rn

Decrement register.

DEC direct

Decrement direct byte.

DEC @Ri

Decrement indirect RAM.

INC DPTR

Increment data pointer.

MUL AB

Multiply A and B Result: A <- low byte, B <- high byte.

DIV AB

Divide A by B Result: A <- whole part, B <- remainder.

DA A

Decimal adjust ACC.

Size

Cycles

Logical Operations
Mnemonic

Description

ANL A,Rn

AND Register to ACC.

[44]

ANL A,direct AND direct byte to ACC.

ANL A,@Ri AND indirect RAM to ACC.

ANL A,#data AND immediate data to ACC.

ANL direct,A AND ACC to direct byte.

ANL direct,#data

ORL A,Rn

AND immediate data to direct byte.

OR Register to ACC.

ORL A,direct OR direct byte to ACC.

1
2

ORL A,@Ri OR indirect RAM to ACC.

ORL A,#data OR immediate data to ACC.

ORL direct,A OR ACC to direct byte.


ORL direct,#data

OR immediate data to direct byte.

1
3

2
XRL A,Rn

Exclusive OR Register to ACC.

XRL A,direct Exclusive OR direct byte to ACC.


XRL A,@Ri Exclusive OR indirect RAM to ACC.

XRL A,#data Exclusive OR immediate data to ACC.

XRL direct,A Exclusive OR ACC to direct byte.

XRL direct,#data

XOR immediate data to direct byte.


[45]

CLR A

Clear ACC (set all bits to zero).

CPL A

Compliment ACC.

RL A

Rotate ACC left.

RLC A

Rotate ACC left through carry.

RR A

Rotate ACC right.

RRC A

Rotate ACC right through carry.

SWAP A

Swap nibbles within ACC.

Data Transfer
Mnemonic

Description

Size

Move register to ACC.

Cycles
MOV A,Rn
MOV A,direct
2

Move direct byte to ACC.


1

MOV A,@Ri

Move indirect RAM to ACC.

MOV A,#data

Move immediate data to ACC.

MOV Rn,A

Move ACC to register.

MOV Rn,direct

Move direct byte to register.


[46]

MOV Rn,#data

Move immediate data to register.

MOV direct,A

Move ACC to direct byte.

MOV direct,Rn

Move register to direct byte.

MOV direct,direct

Move direct byte to direct byte.

MOV direct,@Ri

Move indirect RAM to direct byte.

MOV direct,#data

Move immediate data to direct byte.

MOV @Ri,A

Move ACC to indirect RAM.

MOV @Ri,direct

Move direct byte to indirect RAM.

MOV DPTR,#data16 Move immediate 16 bit data to data pointer register. 3

MOV @Ri,#data

Move immediate data to indirect RAM.

MOVC A,@A+DPTR
address).

MOVC A,@A+PC
MOVX A,@Ri
MOVX A,@DPTR
MOVX @Ri,A
MOVX @DPTR,A

Move code byte relative to DPTR to ACC (16 bit


2
Move code byte relative to PC to ACC (16 bit address).1
Move external RAM to ACC (8 bit address). 1
Move external RAM to ACC (16 bit address).

2
2

Move ACC to external RAM (8 bit address). 1

Move ACC to external RAM (16 bit address).

[47]

PUSH direct

Push direct byte onto stack.

POP direct

Pop direct byte from stack.

XCH A,Rn

Exchange register with ACC.

XCH A,direct

Exchange direct byte with ACC.

XCH A,@Ri

Exchange indirect RAM with ACC.

XCHD A,@Ri

Exchange low order nibble of indirect


RAM with low order nibble of ACC

Boolean Variable Manipulation


Mnemonic

Description

Size

Cycles

CLR C

Clear carry flag.

CLR bit

Clear direct bit.

SETB C

Set carry flag.

SETB

bitSet direct bit

CPL C

Compliment carry flag.

CPL bit

Compliment direct bit.

ANL C,bit

AND direct bit to carry flag.

ANL C,/bit

AND compliment of direct bit to carry.

ORL C,bit

OR direct bit to carry flag.

[48]

ORL C,/bit

OR compliment of direct bit to carry.

MOV C,bit

Move direct bit to carry flag.

MOV bit,C

Move carry to direct bit.

JC rel

Jump if carry is set.

JNC rel

Jump if carry is not set.

JB bit,rel

Jump if direct bit is set.

JNB bit,rel

Jump if direct bit is not set.

JBC bit,rel

Jump if direct bit is set & clear bit.

Program Branching
Mnemonic

Description

Size

Cycles
ACALL

addr11

Absolute subroutine call.

LCALL

addr16

Long subroutine call.

RET

Return from subroutine.

RETI

Return from interrupt.

AJMP addr11 Absolute jump.

LJMP addr16 Long jump.

[49]

SJMP rel

Short jump (relative address).

JMP @A+DPTR
JZ rel

Jump indirect relative to the DPTR.

Jump relative if ACC is zero.

JNZ rel

Jump relative if ACC is not zero.

CJNE A,direct,rel

Compare direct byte to ACC and jump if not equal. 3

CJNE A,#data,rel

Compare immediate byte to ACC and jump if not equal.3

CJNE Rn,#data,rel

Compare immediate byte to register and jump if not equal.32

CJNE @Ri,#data,rel Compare immediate byte to indirect and jump if not equal.32
DJNZ Rn,rel Decrement register and jump if not zero.

DJNZ direct,rel

Decrement direct byte and jump if not zero.

Other Instructions
Mnemonic
NOP

Description

No operation. 1

Size

Cycles

[50]

CHAPTER 9
LIGHT EMITTING DIODE
Light emitting diode (LED) is basically a P-N junction semiconductor diode
particularly designed to emit visible light. There are infrared emitting LEDs which
emit invisible light. The LEDs are now available in many colours red, green and
yellow. A normal LED emits at 2.4V and consumes MA of current. The LEDs are
made in the form of flat tiny P-N junction enclosed in a semi-spherical dome made
up of clear coloured epoxy resin. The dome of a LED acts as a lens and diffuser of
light. The diameter of the base is less than a quarter of an inch. The actual
diameter varies somewhat with different makes. The common circuit symbols for
the LED are shown in Fig. It is similar to the conventional rectifier diode symbol
with two arrows pointing out. There are two leads- one for anode and the other for
cathode.
LEDs often have leads of dissimilar length and the shorter one is the cathode. All
manufacturers do not strictly adhere this to. Sometimes the cathode side has a flat
base. If there is doubt, the polarity of the diode should be identified. A simple bench
method is to use the ohmmeter incorporating 3-volt cells for ohmmeter function.
When connected with the ohmmeter: one way there will be no deflection and when
connected the other way round there will be a large deflection of a pointer. When this
occurs the anode lead is connected to the negative of test lead and cathode to the
positive test lead of the ohmmeter.

[51]

If low range (Rxl) of the ohmmeter is used the LED would light up in most
cases because the low range of ohmmeter can pass sufficient current to light up the
LED.Another safe method is to connect the test circuit shown in Fig. 2. Use any two
dry cells in series with a current limiting resistor of 68 to 100 ohms. The resistor
limits the forward diode current of the LED under test to a safe value. When the LED
under test is connected to the test terminals in any way: if it does not light up, reverse
the test leads. The LED will now light up. The anode of the LED is that which is
connected to the A terminal (positive pole of the battery). This method is safe, as
reverse voltage can never exceed 3 volts in this test.
9.1
ELECTRICAL CHARACTERISTICS OF LEDS: Electrically, a LED is similar to the conventional diode in that it has relatively low
forward voltage threshold. Once this is exceeded the junction has a low slope
resistance and conducts current readily. An external resistor must limit this current.
Forward voltage drew across red LED is nominally 1.6 V but spread with commercial
diodes, it may be as high as 2 volts or so, while the Green LED drops 2.4V. This
difference accounts for use of lower limiting resistor used with the Green LED.
Another important parameter of the LED is its maximum reverse voltage
rating. For typical Red device it is of the order of 3 volts. But for Green LED it is
somewhat higher- 5 to 10 volts.
The LED produces light only when a d.c. current is passed in the forward direction
and the amount of light emitted by a LED is proportional to the forward current over a
broad range. It means that light intensity increases in an approximately linear manner
with increasing current.

Anode
9.2

Connection

SEVEN SEGMENT DISPLAY DECIMAL DISPLAY:A popular type consists of seven small, bar-shaped LED segment arranged so that
depending on which combinations are energized, the numbers 0 to 9 light up. All the
LED cathodes (or sometimes anodes) are joined to form a common connection.
Current limiting resistors are required (e.g. 270 ohms), preferably one per segment.
Common cathode method of connecting an array of display elements.

[52]

Common Cathode

The main requirements for a suitable LED material are:1)

It must have on energy gap of appropriate width.

2)

Both P and N types must exist, preferably with low resistivities.

3)

Efficient radioactive pathways must be present.


Generally, energy gaps greater than or equal to about 2 are required.

Commercial LED materials::


Gallium arsenide (Ga As) doped with Si
Gallium Phosphide (GaP) doped with N & Bi
Gallium arsenide Phosphide (Ga As1-x Px)
Gallium aluminium arsenide (Gax Al1-x As)
9.3
LED CONSTRUCTIONS: -To reduce reflection losses in LEDs there are two obvious
ways: a) The first is to ensure that most rays strike the surface at less

than the critical

angle. This may be achieved by shaping the semiconductor /air interface into a
hemisphere.

[53]

b) The second technique is to encapsulate the junction in a transparent medium of


high refractive index. This is usually a plastic material with refractive index of
about 1.5. Moulding the plastic into an approximately hemispherical shape can
minimize the losses at the plastic lair interface.

RESISTANCE :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).
[54]

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

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 number of zeroes to be placed after the digits. The fourth ring gives
tolerance (gold 5%, silver 10%, No colour 20%).

[55]

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.

[56]

CHAPTER 10
TRANSFORMER
10.1
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 stepup, step-down, frequency matching, sound output, amplifier driver etc. The basic
principles of all the transformers are same.

MINIATURE TRANSFORMER

[57]

CONVENTIONAL POWER TRANSFORMER

[58]