Vous êtes sur la page 1sur 136

Dissertation submitted in partial fulfillment of the Btech. course.

Black Box

Under the Guidence of


Arun Bansal
Innovative Project solutions
www.ludhianaprojects.com
ludhiana

Submitted By
Abhishek Kaushik
SG-119836.

Table of Contents

1.

Acknowledgements.

2.

Certificate.

3.

Introduction to the Project.

4.

Circuit Diagram.

5.

Component List.

6.

Hardware

a.

Power Supply for the circuit.

b.

Integrated Circuits.

c.

Transistors.

d.

Diode.

e.

Relays.

f.

Transformer.

g.

Resistors.

h.

Capacitors.

7.

Project Working.

8.

Project Synopsis.

9.

Bibliography.

Introduction
We know the about Black box in aeroplane.We are making same project for car. In which we
will use different type of sensors. We will use IR,LPG,LDR,water and Fire sensors.In this
project we will make project on black box of car. We will make security system for car. It
will detect the fire in car then it will give signal on indicator and we will use 16*2 LCD for
display fault on LCD. Here in this project we also show that how we detect a LPG gas or any
type of gases and if we detect a gases then alarm is on, doors glasses will open or doors will
open and the same time lcd display shows the gas detection display . lpg gas sensors are for
future point of view, because of increasing cost of petrol, most of car owner are using LPG
gas car kit/ If the gas is detected then relay is off and break the supply of gas applied to the
vehicle or we can control any type of electrical connection on or off by this relay operated
logic.Main part of this project is gas sensor.Here we use TGS gas sensor. This sensor is a 6
pin sensor . Top and bottom of the sensor is covered with 100 mesh stainless stell wire cloth.
The heart of the sensor is the cylindrical form in the middle of the unit. The cylinder is a
ceramic material with the SnO2 material deposited on its surface. The heater coil is located
inside the ceramic cylinder. The heater has a resistance of 38 ohms.Output of the gas sensor is
connected to npn transistor and the ic 555 as a monostable trigger ic. Sensor gives high signal
to npn transistor. Transistors emitter is connected with ground. And collector connected with
NE555 timer. Timer gives output to npn transitor. Second npn transistor gives low signal to
mcrcontroller. We know microcontroller default o/p is high.As the sensor is detect a gas then
ic 555 activate automatically and then output of the ic 555 is connected to the microcontroller
circuit.In the microcontroller circuit we use ic 89s51 controller. Use of this is is to control the
one or many relay logic and at the same time show the message on the lcd display. If no gas
is detected then display shows a everything is ok . If the gas is detected then show a warning
message on the screen and at the same time relay off the supply unit.

Circuit Diagram

V IN V O U T

D2

C1
1000uf

R1
C 2 470E
470uf
U2

12

VCC

LCD 16*2
VSS
RS

LE D +

2
15

R ST

ir sensor
VC C
R3
10K
C4
27pf

40

20

POT

P 2 .0 /A 8
P 2 .1 /A 9
P 2 .2 /A 1 0
P 2 .3 /A 1 1
P 2 .4 /A 1 2
P 2 .5 /A 1 3
P 2 .6 /A 1 4
P 2 .7 /A 1 5

P 1 .0 /T2
P 1 .1 /T 2 -E X
P 1 .2
P 1 .3
P 1 .4 /S S
P 1 .5 /M O S I
P 1 .6 /M IS O
P 1 .7 /S C K

R 14

R 15
NO CONNECTION

8051 A L E /P R O G

1
2
3
4
5
6
7
8

R 13

R 12

D7

voltage +9V
Q4

Q5

NO CONNECTION

Y 1 19
1 8 XTA L 1
XTA L 2

12MHz

D4

C5

27pf

R 22
Q 14 R 23
R E S IS TO R
R E S IS TO R

R6

R7
4 .7 K

12V

PC 819

N PN

O P TO IS O L A TO R

Q 10

R 20

1K

Q9

PNP

470E

4 .7 K

1K

R 21

1K

PC 820
O P TO IS O L A TO R

N PN
Q 11

R 19

PN P

Q8

R 18

1K

PC 818
O P TO IS O L A TO R

R9
4 .7 K

R 16

12V

Q6

O P TO IS O L A TO R

470E

N PN
Q7

N PN

R8

470E

R 17
4 .7 K

PC 817

R 10

thermister

R 11

470E

water sensor

D5

LDR SENSOR

R5
4 .7 K

10
11
12
13
14
15
16
17

R4
670E

P 3 .0 /R XD
P 3 .1 /TXD
P 3 .2 /IN T0
P 3 .3 /IN T1
P 3 .4 /T0
P 3 .5 /T1
P 3 .6 /W R
P 3 .7 /R D

R2

SW 3

29
PSEN 30

C3
10uf
21
22
23
24
25
26
27
28

VCC

P 0 .0 /A D 0
P 0 .1 /A D 1
P 0 .2 /A D 2
P 0 .3 /A D 3
P 0 .4 /A D 4
P 0 .5 /A D 5
P 0 .6 /A D 6
P 0 .7 /A D 7

GND

39
38
37
36
35
34
33
32

EA/VPP

U3

31

10
11
12
13
14

R/W

LED -

DB0
DB1
DB2
DB3
DB4
DB5
DB6
DB7

16

D3
LE D

7
8
9

IN 4 0 0 7

TR A N S F O R M E R

VEE

6 0

220V
A.C

U 1 LM 7805
1

D 1 IN 4 0 0 7
5 12

GND

T1

PN P

Q 12

PNP
Q 13

Q 15
B C 548

BUZZER

Component List:Microcontroller 89C051


LCD display 16*2 matrix
Keys matrix
Stepper Motor
Wood or ply
Crystal 3.58Mhz
Resistance 220 ohm
Capacitor 0.01 micro farad
Keyboard general or push to on Button
DIP switches
Connecting wires
Microcontroller programming kit
12v supply
copper clad board
Ferric chloride
Marker

Computer

Micro Controller 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 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

microcontroller.

makes

the

microcontroller

process

faster

than

other

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

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 or students to stick with 8051
when you learn a new microcontroller.

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.

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. Some of the important registers and their functions are
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
microcontroller.
Consider an electric circuit as follows,

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?
Execution time
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 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.
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 ROM
The 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 required 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.
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
connected 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.

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
dditional 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.

SPECIAL FUNCTION REGISTER ( SFR) ADDRESSES.

ACC

ACCUMULATOR

0E0H

B REGISTER

0F0H

PSW

PROGRAM STATUS WORD

SP

STACK POINTER

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

0D0H

81H

TMOD

TIMER/COUNTER MODE CONTROL

89H

TCON

TIMER COUNTER CONTROL

88H

TH0

TIMER 0 HIGH BYTE

8CH

TLO

TIMER 0 LOW BYTE

TH1

TIMER 1 HIGH BYTE

TL1

TIMER 1 LOW BYTE

SCON

SERIAL CONTROL

98H

SBUF

SERIAL DATA BUFFER

99H

PCON

POWER CONTROL

87H

8AH

8DH
8BH

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

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.

ACALL,TARGET ADDRESS

By this instructions we call subroutines with a target address within 2k bytes from the
current program counter.

LCALL, TARGET ADDRESS.

ACALL is a limit for the 2 k byte program counter, but for upto 64k byte we use LCALL
instructions.. Note that LCALL is a 3 byte instructions. ACALL is a
two byte instructions.

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
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

jump to any

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

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.

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.

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

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)

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)

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

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

RB8

SCON.2 In modes 2 &3, is the 9th 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 8th 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.

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.

SUBB A,#data

Subtract immediate data from ACC

with borrow.

INC A

INC Rn

Increment ACC.

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.1

DIV AB

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

DA A

Decimal adjust ACC.

Logical Operations

Mnemonic

Description

Size

Cycles

ANL A,Rn

AND Register to ACC.

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.

ORL A,@Ri

ORL A,#data OR immediate data to ACC.

ORL direct,A OR ACC to direct byte.

ORL direct,#data

XRL A,direct Exclusive OR direct byte to ACC.

XRL A,@Ri

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

XRL direct,A Exclusive OR ACC to direct byte.

XRL direct,#data

XRL A,Rn

OR indirect RAM to ACC.

OR immediate data to direct byte.

Exclusive OR Register to ACC.

Exclusive OR indirect RAM to ACC.

XOR immediate data to direct byte.

CLR A

Clear ACC (set all bits to zero).

CPL A

Compliment ACC.

RL A

Rotate ACC left.

RLC A

RR A

RRC A

SWAP A

Rotate ACC left through carry.

Rotate ACC right.

Rotate ACC right through carry.

Swap nibbles within ACC.

Data Transfer

Mnemonic

Description

MOV A,Rn

Move register to ACC.

Size

Cycles

MOV A,direct

Move direct byte to ACC.

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.

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
Move code byte relative to DPTR to ACC (16 bit address).

MOVC A,@A+PC

MOVX A,@Ri

MOVX A,@DPTR

MOVX @Ri,A

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).

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

MOVX @DPTR,A

Move ACC to external RAM (16 bit address).

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

CLR C

Clear carry flag.

CLR bit

Clear direct bit.

SETB C

Set carry flag.

SETB

bitSet direct bit

Cycles

CPL C

CPL bit

Compliment carry flag.

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.

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.

SJMP rel

Short jump (relative address).

JMP @A+DPTR

Jump indirect relative to the DPTR.

JZ rel

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.

CJNE A,#data,rel

Compare immediate byte to ACC and

jump if not equal.

CJNE Rn,#data,rel

Compare immediate byte to register

and jump if not equal.

CJNE @Ri,#data,rel Compare immediate byte to indirect and


jump if not equal.

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.

Size

Cycles

LCD DETAIL .

Frequently, an 8051 program must interact with the outside world using
input and output devices that communicate directly with a human being.
One of the most common devices attached to an 8051 is an LCD display.
Some of the most common LCDs connected to the 8051 are 16x2 and
20x2 displays. This means 16 characters per line by 2 lines and 20
characters per line by 2 lines, respectively.
Fortunately, a very popular standard exists which allows us to communicate with the vast
majority of LCDs regardless of their manufacturer. The standard is referred to as HD44780U,
which refers to the controller chip which receives data from an external source (in this case,
the 8051) and communicates directly with the LCD.
44780 BACKGROUND
The 44780 standard requires 3 control lines as well as either 4 or 8 I/O lines for the data bus.
The user may select whether the LCD is to operate with a 4-bit data bus or an 8-bit data bus.
If a 4-bit data bus is used, the LCD will require a total of 7 data lines (3 control lines plus the
4 lines for the data bus). If an 8-bit data bus is used, the LCD will require a total of 11 data
lines (3 control lines plus the 8 lines for the data bus).
The three control lines are referred to as EN, RS, and RW.
The EN line is called "Enable." This control line is used to tell the LCD that you are sending
it data. To send data to the LCD, your program should first set this line high (1) and then set
the other two control lines and/or put data on the data bus. When the other lines are
completely ready, bring EN low (0) again. The 1-0 transition tells the 44780 to take the data
currently found on the other control lines and on the data bus and to treat it as a command.
The RS line is the "Register Select" line. When RS is low (0), the data is to be treated as a
command or special instruction (such as clear screen, position cursor, etc.). When RS is high
(1), the data being sent is text data which should be displayed on the screen. For example, to
display the letter "T" on the screen you would set RS high.

The RW line is the "Read/Write" control line. When RW is low (0), the information on the
data bus is being written to the LCD. When RW is high (1), the program is effectively
querying (or reading) the LCD. Only one instruction ("Get LCD status") is a read command.
All others are write commands--so RW will almost always be low.
Finally, the data bus consists of 4 or 8 lines (depending on the mode of operation selected by
the user). In the case of an 8-bit data bus, the lines are referred to as DB0, DB1, DB2, DB3,
DB4, DB5, DB6, and DB7.

AN EXAMPLE HARDWARE CONFIGURATION


As we've mentioned, the LCD requires either 8 or 11 I/O lines to communicate with. For the
sake of this tutorial, we are going to use an 8-bit data bus--so we'll be using 11 of the 8051's
I/O pins to interface with the LCD.
Let's draw a sample psuedo-schematic of how the LCD will be connected to the 8051.

As you can see, we've established a 1-to-1 relation between a pin on the 8051 and a line on
the 44780 LCD. Thus as we write our assembly program to access the LCD, we are going to
equate constants to the 8051 ports so that we can refer to the lines by their 44780 name as
opposed to P0.1, P0.2, etc. Let's go ahead and write our initial equates:

DB0 EQU P1.0


DB1 EQU P1.1
DB2 EQU P1.2
DB3 EQU P1.3
DB4 EQU P1.4
DB5 EQU P1.5
DB6 EQU P1.6
DB7 EQU P1.7
EN EQU P3.7
RS EQU P3.6
RW EQU P3.5
DATA EQU P1
Having established the above equates, we may now refer to our I/O lines
by their 44780 name. For example, to set the RW line high (1), we can
execute the following insutrction:
SETB RW

HANDLING THE EN CONTROL LINE


As we mentioned above, the EN line is used to tell the LCD that you are ready for it to
execute an instruction that you've prepared on the data bus and on the other control lines.
Note that the EN line must be raised/lowered before/after each instruction sent to the LCD
regardless of whether that instruction is read or write, text or instruction. In short, you must
always manipulate EN when communicating with the LCD. EN is the LCD's way of knowing
that you are talking to it. If you don't raise/lower EN, the LCD doesn't know you're talking to
it on the other lines.
Thus, before we interact in any way with the LCD we will always bring the EN line high
with the following instruction:
SETB EN
And once we've finished setting up our instruction with the other control
lines and data bus lines, we'll always bring this line back low:

CLR EN
Programming Tip: The LCD interprets and executes our command
at the instant the EN line is brought low. If you never bring EN low,
your instruction will never be executed. Additionally, when you bring
EN low and the LCD executes your instruction, it requires a certain
amount of time to execute the command. The time it requires to
execute an instruction depends on the instruction and the speed of
the crystal which is attached to the 44780's oscillator input.

CHECKING THE BUSY STATUS OF THE LCD

As previously mentioned, it takes a certain amount of time for each instruction to be executed
by the LCD. The delay varies depending on the frequency of the crystal attached to the
oscillator input of the 44780 as well as the instruction which is being executed.
While it is possible to write code that waits for a specific amount of time to allow the LCD to
execute instructions, this method of "waiting" is not very flexible. If the crystal frequency is
changed, the software will need to be modified. Additionally, if the LCD itself is changed for
another LCD which, although 44780 compatible, requires more time to perform its
operations, the program will not work until it is properly modified.
A more robust method of programming is to use the "Get LCD Status" command to
determine whether the LCD is still busy executing the last instruction received.
The "Get LCD Status" command will return to us two tidbits of information; the information
that is useful to us right now is found in DB7. In summary, when we issue the "Get LCD
Status" command the LCD will immediately raise DB7 if it's still busy executing a command
or lower DB7 to indicate that the LCD is no longer occupied. Thus our program can query the
LCD until DB7 goes low, indicating the LCD is no longer busy. At that point we are free to
continue and send the next command.
Since we will use this code every time we send an instruction to the LCD, it is useful to make
it a subroutine. Let's write the code:
WAIT_LCD:

SETB EN ;Start LCD command


CLR RS ;It's a command
SETB RW ;It's a read command
MOV DATA,#0FFh ;Set all pins to FF initially
MOV A,DATA ;Read the return value
JB ACC.7,WAIT_LCD ;If bit 7 high, LCD still busy
CLR EN ;Finish the command
CLR RW ;Turn off RW for future commands
RET
Thus, our standard practice will be to send an instruction to the LCD and
then call our WAIT_LCD routine to wait until the instruction is completely
executed by the LCD. This will assure that our program gives the LCD the
time it needs to execute instructions and also makes our program
compatible with any LCD, regardless of how fast or slow it is.
Programming Tip: The above routine does the job of waiting for
the LCD, but were it to be used in a real application a very definite
improvement would need to be made: as written, if the LCD never
becomes "not busy" the program will effectively "hang," waiting for
DB7 to go low. If this never happens, the program will freeze. Of
course, this should never happen and won't happen when the
hardware is working properly. But in a real application it would be
wise to put some kind of time limit on the delay--for example, a
maximum of 256 attempts to wait for the busy signal to go low. This
would guarantee that even if the LCD hardware fails, the program
would not lock up.

INITIALIZING THE LCD


Before you may really use the LCD, you must initialize and configure it. This is
accomplished by sending a number of initialization instructions to the LCD.
The first instruction we send must tell the LCD whether we'll be communicating with it with
an 8-bit or 4-bit data bus. We also select a 5x8 dot character font. These two options are
selected by sending the command 38h to the LCD as a command. As you will recall from the
last section, we mentioned that the RS line must be low if we are sending a command to the
LCD. Thus, to send this 38h command to the LCD we must execute the following 8051
instructions:
SETB

EN

CLR

RS

MOV

DATA,#38h

CLR

EN

LCALL WAIT_LCD
Programming Tip: The LCD command 38h is really the sum of a
number of option bits. The instruction itself is the instruction 20h
("Function set"). However, to this we add the values 10h to indicate
an 8-bit data bus plus 08h to indicate that the display is a two-line
display.
We've now sent the first byte of the initialization sequence. The second
byte of the initialization sequence is the instruction 0Eh. Thus we must
repeat the initialization code from above, but now with the instruction.
Thus the next code segment is:
SETB EN
CLR RS
MOV DATA,#0Eh
CLR EN
LCALL WAIT_LCD

Programming Tip: The command 0Eh is really the instruction 08h


plus 04h to turn the LCD on. To that an additional 02h is added in
order to turn the cursor on.
The last byte we need to send is used to configure additional operational
parameters of the LCD. We must send the value 06h.
SETB EN
CLR RS
MOV DATA,#06h
CLR EN
LCALL WAIT_LCD
Programming Tip: The command 06h is really the instruction 04h
plus 02h to configure the LCD such that every time we send it a
character, the cursor position automatically moves to the right.
So, in all, our initialization code is as follows:
INIT_LCD:
SETB EN
CLR RS
MOV DATA,#38h
CLR EN
LCALL WAIT_LCD
SETB EN
CLR RS
MOV DATA,#0Eh
CLR EN
LCALL WAIT_LCD
SETB EN
CLR RS
MOV DATA,#06h
CLR EN

LCALL WAIT_LCD
RET
Having executed this code the LCD will be fully initialized and ready for us
to send display data to it.
CLEARING THE DISPLAY
When the LCD is first initialized, the screen should automatically be cleared by the 44780
controller. However, it's always a good idea to do things yourself so that you can be
completely sure that the display is the way you want it. Thus, it's not a bad idea to clear the
screen as the very first opreation after the LCD has been initialiezd.
An LCD command exists to accomplish this function. Not suprisingly, it is the command 01h.
Since clearing the screen is a function we very likely will wish to call more than once, it's a
good idea to make it a subroutine:
CLEAR_LCD:
SETB EN
CLR RS
MOV DATA,#01h
CLR EN
LCALL WAIT_LCD
RET
How that we've written a "Clear Screen" routine, we may clear the LCD at
any time by simply executing an LCALL CLEAR_LCD.
Programming Tip: Executing the "Clear Screen" instruction on the
LCD also positions the cursor in the upper left-hand corner as we
would expect.
WRITING TEXT TO THE LCD
Now we get to the real meat of what we're trying to do: All this effort is really so we can
display text on the LCD. Really, we're pretty much done.
Once again, writing text to the LCD is something we'll almost certainly want to do over and
over--so let's make it a subroutine.

WRITE_TEXT:
SETB EN
SETB RS
MOV DATA,A
CLR EN
LCALL WAIT_LCD
RET
The WRITE_TEXT routine that we just wrote will send the character in the
accumulator to the LCD which will, in turn, display it. Thus to display text
on the LCD all we need to do is load the accumulator with the byte to
display and make a call to this routine. Pretty easy, huh?
A "HELLO WORLD" PROGRAM
Now that we have all the component subroutines written, writing the classic "Hello World"
program--which displays the text "Hello World" on the LCD is a relatively trivial matter.
Consider:
LCALL INIT_LCD
LCALL CLEAR_LCD
MOV A,#'H'
LCALL WRITE_TEXT
MOV A,#'E'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'O'
LCALL WRITE_TEXT
MOV A,#' '
LCALL WRITE_TEXT
MOV A,#'W'
LCALL WRITE_TEXT

MOV A,#'O'
LCALL WRITE_TEXT
MOV A,#'R'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'D'
LCALL WRITE_TEXT
The above "Hello World" program should, when executed, initialize the
LCD, clear the LCD screen, and display "Hello World" in the upper lefthand corner of the display.
CURSOR POSITIONING
The above "Hello World" program is simplistic in the sense that it prints its text in the upper
left-hand corner of the screen. However, what if we wanted to display the word "Hello" in the
upper left-hand corner but wanted to display the word "World" on the second line at the tenth
character? This sounds simple--and actually, it is simple. However, it requires a little more
understanding of the design of the LCD.
The 44780 contains a certain amount of memory which is assigned to the display. All the text
we write to the 44780 is stored in this memory, and the 44780 subsequently reads this
memory to display the text on the LCD itself. This memory can be represented with the
following "memory map":

Thus, the first character in the upper left-hand corner is at address 00h. The following
character position (character #2 on the first line) is address 01h, etc. This continues until we
reach the 16th character of the first line which is at address 0Fh.

However, the first character of line 2, as shown in the memory map, is at address 40h. This
means if we write a character to the last position of the first line and then write a second
character, the second character will not appear on the second line. That is because the second
character will effectively be written to address 10h--but the second line begins at address 40h.
Thus we need to send a command to the LCD that tells it to position the cursor on the second
line. The "Set Cursor Position" instruction is 80h. To this we must add the address of the
location where we wish to position the cursor. In our example, we said we wanted to display
"World" on the second line on the tenth character position.
Referring again to the memory map, we see that the tenth character position of the second
line is address 4Ah. Thus, before writing the word "World" to the LCD, we must send a "Set
Cursor Position" instruction--the value of this command will be 80h (the instruction code to
position the cursor) plus the address 4Ah. 80h + 4Ah = C4h. Thus sending the command C4h
to the LCD will position the cursor on the second line at the tenth character position:

SETB EN
CLR RS
MOV DATA,#0C4h
CLR EN
LCALL WAIT_LCD
The above code will position the cursor on line 2, character 10. To display
"Hello" in the upper left-hand corner with the word "World" on the second
line at character position 10 just requires us to insert the above code into
our existing "Hello World" program. This results in the following:
LCALL INIT_LCD
LCALL CLEAR_LCD
MOV A,#'H'
LCALL WRITE_TEXT
MOV A,#'E'
LCALL WRITE_TEXT

MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'O'
LCALL WRITE_TEXT
SETB EN
CLR RS
MOV DATA,#0C4h
CLR EN
LCALL WAIT_LCD
MOV A,#'W'
LCALL WRITE_TEXT
MOV A,#'O'
LCALL WRITE_TEXT
MOV A,#'R'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'D'
LCALL WRITE_TEXT

PIN WISE DETAIL OF LCD

1.

Vss

GROUND

2.

Vcc

+5VOLT SUPPLY

Vee

POWER SUPPLY TO CONTROL CONTRAST

4.

RS

RS = 0 TO SELECT COMMAND REGISTER


RS = 1 TO SELECT DATA REGISTER

5.

R/W

R/W = 0 FOR WRITE


R/W = 1 FOR READ

DB0

DB1

9.

DB2

10.

DB3

ENABLE

11.

DB4

12.

DB5

13.

DB6

14.

DB7

15 ,16

FOR BACK LIGHT DISPLAY

LCD COMMAND CODES.

1.

CLEAR DISPLAY SCREEN

2.

RETURN HOME

DECREMENT CURSOR ( SHIFT CURSOR TO LEFT)

SHIFT DISPLAY RIGHT.

6.

INCREMENT CURSOR ( SHIFT CURSOR TO RIGHT)

7.

SHIFT DISPLAY LEFT

8.

DISPLAY OFF, CURSOR OFF

DISPLAY OFF CURSOR ON

DISPLAY ON CURSOR OFF

DISPLAY ON CURSOR BLINKING

F.

DISPLAY ON CURSOR BLINKING.

10.

SHIFT CURSOR POSITION TO LEFT

14.

SHIFT CURSOR POSITION TO RIGHT

18.

SHIFT THE ENTIRE DISPLAY TO THE LEFT

1C

SHIFT THE ENTIRE DISPLAY TO THE RIGHT

80

FORCE CURSOR TO BEGINNING OF IST LINE

C0

38

FORCE CURSOR TO BEGINNING OF 2ND LINE

2 LINES AND 5 X 7 MATRIX

TRANSFORMER
Transformer works on the principle of mutual inductance. We know that if
two coils or windings are placed on the core of iron, and if we pass
alternating current in one winding, back emf or induced voltage is
produced in the second winding. We know that alternating current always
changes with the time. So if we apply AC voltage across one winding, a
voltage will be induced in the other winding. Transformer works on this
same principle. It is made of two windings wound around the same core of
iron. The winding to which AC voltage is applied is called primary winding.
The other winding is called as secondary winding.

Voltage and current relationship:

Let V1 volts be input alternating voltage applied to primary winding. I 1


Amp is input alternating current through primary winding. V 2 volt is output

alternating voltage produced in the secondary. I2 amp be the current


flowing through the secondary.

Then relationship between input and output voltages is given by


V1/V2 = N1/N2

Relationship between input and output currents is


I1/I2 = N2/N1
(Where N1 is no. of turns of coil in primary and N 2 is number of turns in
secondary )

We know that Power = Current X Voltage. It is to be noted that input power is equal
to output power. Power is not changed. If V 2 is greater than V1, then I2 will be less
than I1. This type of transformer is called as step up transformer. If V 1 is

greater than V2, then I1 will be less than I2. This type of transformer is called as step
down transformer.
For step up transformer, N2>N1, i.e., number of turns of secondary winding is more
than those in primary.
For step down transformer, N 1>N2, i.e., numbers of turns of primary winding is more
than those in secondary.

RESISTANCE
resistor is a two-terminal electronic component that produces a voltage across its
terminals that is proportional to the electric current passing through it in
accordance with Ohm's law:

V = IR
Resistors are elements of electrical networks and electronic circuits and are
ubiquitous in most electronic equipment. Practical resistors can be made of
various compounds and films, as well as resistance wire (wire made of a highresistivity alloy, such as nickel/chrome).
The primary characteristics of a resistor are the resistance, the tolerance,
maximum working voltage and the power rating. Other characteristics include
temperature coefficient, noise, and inductance. Less well-known is critical
resistance, the value below which power dissipation limits the maximum
permitted current flow, and above which the limit is applied voltage. Critical
resistance is determined by the design, materials and dimensions of the resistor.
Resistors can be integrated into hybrid and printed circuits, as well as integrated
circuits. Size, and position of leads (or terminals) are relevant to equipment
designers; resistors must be physically large enough not to overheat when
dissipating their power

Units
The ohm (symbol: ) is the SI unit of electrical resistance, named after Georg Simon Ohm.
Commonly used multiples and submultiples in electrical and electronic usage are the
milliohm (1x103), kilohm (1x103), and megohm (1x106).
Theory of operation
Ohm's law
The behavior of an ideal resistor is dictated by the relationship specified in Ohm's law:
Ohm's law states that the voltage (V) across a resistor is proportional to the current (I)
through it where the constant of proportionality is the resistance (R).
Equivalently, Ohm's law can be stated:
This formulation of Ohm's law states that, when a voltage (V) is maintained across a
resistance (R), a current (I) will flow through the resistance.
This formulation is often used in practice. For example, if V is 12 volts and R is 400 ohms, a
current of 12 / 400 = 0.03 amperes will flow through the resistance R.
Series and parallel resistors
Main article: Series and parallel circuits
Resistors in a parallel configuration each have the same potential difference (voltage). To find
their total equivalent resistance (Req):
The parallel property can be represented in equations by two vertical lines "||" (as in
geometry) to simplify equations. For two resistors,
The current through resistors in series stays the same, but the voltage across each resistor can
be different. The sum of the potential differences (voltage) is equal to the total voltage. To
find their total resistance:
A resistor network that is a combination of parallel and series can be broken up into smaller
parts that are either one or the other. For instance,

However, many resistor networks cannot be split up in this way. Consider a cube, each edge
of which has been replaced by a resistor. For example, determining the resistance between
two opposite vertices requires additional transforms, such as the Y- transform, or else matrix
methods must be used for the general case. However, if all twelve resistors are equal, the
corner-to-corner resistance is 56 of any one of them.
The practical application to resistors is that a resistance of any non-standard value can be
obtained by connecting standard values in series or in parallel.
Power dissipation
The power dissipated by a resistor (or the equivalent resistance of a resistor network) is
calculated using the following:
All three equations are equivalent. The first is derived from Joule's first law. Ohms Law
derives the other two from that.
The total amount of heat energy released is the integral of the power over time:
If the average power dissipated is more than the resistor can safely dissipate, the resistor may
depart from its nominal resistance and may become damaged by overheating. Excessive
power dissipation may raise the temperature of the resistor to a point where it burns out,
which could cause a fire in adjacent components and materials. There are flameproof resistors
that fail (open circuit) before they overheat dangerously.
Note that the nominal power rating of a resistor is not the same as the power that it can safely
dissipate in practical use. AIR circulation and proximity to a circuit board, ambient
temperature, and other factors can reduce acceptable dissipation significantly. Rated power
dissipation may be given for an ambient temperature of 25 C in free air. Inside an equipment
case at 60 C, rated dissipation will be significantly less; a resistor dissipating a bit less than
the maximum figure given by the manufacturer may still be outside the safe operating area
and may prematurely fail.
Resistor marking
Most axial resistors use a pattern of colored stripes to indicate resistance. Surface-mount
resistors are marked numerically, if they are big enough to permit marking; more-recent small
sizes are impractical to mark. Cases are usually tan, brown, blue, or green, though other
colors are occasionally found such as dark red or dark gray.
Early 20th century resistors, essentially uninsulated, were dipped in paint to cover their entire
body for color coding. A second color of paint was applied to one end of the element, and a
color dot (or band) in the middle provided the tthird digit. The rule was "body, tip, dot",
providing two significant digits for value and the decimal multiplier, in that sequence. Default
tolerance was 20%. Closer-tolerance resistors had silver (10%) or gold-colored (5%)
paint on the other end.
Four-band resistors

Four-band identification is the most commonly used color-coding scheme on resistors. It


consists of four colored bands that are painted around the body of the resistor. The first two
bands encode the first two significant digits of the resistance value, the third is a power-of-ten
multiplier or number-of-zeroes, and the fourth is the tolerance accuracy, or acceptable error,
of the value. The first three bands are equally spaced along the resistor; the spacing to the
fourth band is wider. Sometimes a fifth band identifies the thermal coefficient, but this must
be distinguished from the true 5-color system, with 3 significant digits.
For example, green-blue-yellow-red is 56104 = 560 k 2%. An easier description can
be as followed: the first band, green, has a value of 5 and the second band, blue, has a value
of 6, and is counted as 56. The tthird band, yellow, has a value of 104, which adds four 0's to
the end, creating 560,000 at 2% tolerance accuracy. 560,000 changes to 560 k 2%
(as a kilo- is 103).
Each color corresponds to a certain digit, progressing from darker to lighter colors, as shown
in the chart below.
Color

1st band 2nd band 3rd band (multiplier)

4th band (tolerance)

Temp. Coefficient

Black

100

Brown 1

101

1% (F)

100 ppm

Red

102

2% (G)

50 ppm

Orange 3

103

15 ppm

Yellow 4

104

25 ppm

Green

105

0.5% (D)

Blue

106

0.25% (C)

Violet

107

0.1% (B)

Gray

108

0.05% (A)

White

109

Gold

101

5% (J)

Silver

102

10% (K)

None

20% (M)

Variable Resistors

Construction
Variable resistors consist of a resistance track with
connections at both ends and a wiper which moves along the

track as you turn the spindle. The track may be made from carbon, cermet (ceramic and metal
mixture) or a coil of wire (for low resistances). The track is usually rotary but straight track
versions, usually called sliders, are also available.
Variable resistors may be used as a rheostat with two connections (the wiper and
just one end of the track) or as a potentiometer with all three connections in use.
Miniature versions called presets are made for setting up circuits which will not
require further adjustment.
Variable resistors are often called potentiometers in books and catalogues. They
are specified by their maximum resistance, linear or logarithmic track, and their
physical size. The standard spindle diameter is 6mm.
The resistance and type of track are marked on the body:
4K7 LIN means 4.7 k linear track.
1M LOG means 1 M logarithmic track.
Some variable resistors are designed to be mounted directly on the circuit board,
but most are for mounting through a hole drilled in the case containing the
circuit with stranded wire connecting their terminals to the circuit board.

CAPACITORS
A capacitor (formerly known as condenser) is a passive
electronic component consisting of a pair of conductors
separated by a dielectric (insulator). When there is a potential
difference (voltage) across the conductors a static electric field
develops in the dielectric that stores energy and produces a
mechanical force between the conductors. An ideal capacitor is
characterized by a single constant value, capacitance,
measured in farads. This is the ratio of the electric charge on
each conductor to the potential difference between them.
Capacitors are widely used in electronic circuits for blocking
direct current while allowing alternating current to pass, in filter
networks, for smoothing the output of power supplies, in the
resonant circuits that tune radios to particular frequencies and
for many other purposes.
The effect is greatest when there is a narrow separation
between large areas of conductor, hence capacitor conductors
are often called "plates", referring to an early means of

construction. In practice the dielectric between the plates


passes a small amount of leakage current and also has an
electric field strength limit, resulting in a breakdown voltage,
while the conductors and leads introduce an equivalent series
resistance

Ripple current
Ripple current is the AC component of an applied source (often
a switched-mode power supply) whose frequency may be
constant or varying. Certain types of capacitors, such as
electrolytic tantalum capacitors, usually have a rating for
maximum ripple current (both in frequency and magnitude).

This ripple current can cause damaging heat to be generated


within the capacitor due to the current flow across resistive
imperfections in the materials used within the capacitor, more
commonly referred to as equivalent series resistance (ESR). For
example electrolytic tantalum capacitors are limited by ripple
current and generally have the highest ESR ratings in the
capacitor family, while ceramic capacitors generally have no
ripple current limitation and have some of the lowest ESR
ratings.
Capacitor types
Practical capacitors are available commercially in many
different forms. The type of internal dielectric, the structure of
the plates and the device packaging all strongly affect the
characteristics of the capacitor, and its applications.
Values available range from very low (picofarad range; while
arbitrarily low values are in principle possible, stray (parasitic)
capacitance in any circuit is the limiting factor) to about 5 kF
supercapacitors.
Above approximately 1 microfarad electrolytic capacitors are
usually used because of their small size and low cost compared
with other technologies, unless their relatively poor stability,
life and polarised nature make them unsuitable. Very high
capacity supercapacitors use a porous carbon-based electrode
material.
Dielectric materials

Capacitor materials. From left: multilayer ceramic, ceramic disc,


multilayer polyester film, tubular ceramic, polystyrene,
metalized polyester film, aluminum electrolytic. Major scale
divisions are in centimetres.

Most types of capacitor include a dielectric spacer, which


increases their capacitance. These dielectrics are most often
insulators. However, low capacitance devices are available with
a vacuum between their plates, which allows extremely high
voltage operation and low losses. Variable capacitors with their
plates open to the atmosphere were commonly used in radio
tuning circuits. Later designs use polymer foil dielectric
between the moving and stationary plates, with no significant
air space between them.
In order to maximise the charge that a capacitor can hold, the
dialectric material needs to have as high a permittivity as
possible, while also having as high a breakdown voltage as
possible.
Several solid dielectrics are available, including paper, plastic,
glass, mica and ceramic materials. Paper was used extensively
in older devices and offers relatively high voltage performance.
However, it is susceptible to water absorption, and has been
largely replaced by plastic film capacitors. Plastics offer better
stability and aging performance, which makes them useful in
timer circuits, although they may be limited to low operating
temperatures and frequencies. Ceramic capacitors are
generally small, cheap and useful for high frequency
applications, although their capacitance varies strongly with
voltage and they age poorly. They are broadly categorized as
class 1 dielectrics, which have predictable variation of
capacitance with temperature or class 2 dielectrics, which can
operate at higher voltage. Glass and mica capacitors are
extremely reliable, stable and tolerant to high temperatures
and voltages, but are too expensive for most mainstream
applications. Electrolytic capacitors and supercapacitors are
used to store small and larger amounts of energy, respectively,
ceramic capacitors are often used in resonators, and parasitic
capacitance occurs in circuits wherever the simple conductorinsulator-conductor structure is formed unintentionally by the
configuration of the circuit layout.

Electrolytic capacitors use an aluminum or tantalum plate with


an oxide dielectric layer. The second electrode is a liquid
electrolyte, connected to the circuit by another foil plate.
Electrolytic capacitors offer very high capacitance but suffer
from poor tolerances, high instability, gradual loss of
capacitance especially when subjected to heat, and high
leakage current. Poor quality capacitors may leak electrolyte,
which is harmful to printed circuit boards. The conductivity of
the electrolyte drops at low temperatures, which increases
equivalent series resistance. While widely used for powersupply conditioning, poor high-frequency characteristics make
them unsuitable for many applications. Electrolytic capacitors
will self-degrade if unused for a period (around a year), and
when full power is applied may short circuit, permanently
damaging the capacitor and usually blowing a fuse or causing
arcing in rectifier tubes. They can be restored before use (and
damage) by gradually applying the operating voltage, often
done on antique [[vacuum tube] equipment over a period of 30
minutes by using a variable transformer to supply AC power.
Unfortunately, the use of this technique may be less
satisfactory for some solid state equipment, which may be
damaged by operation below its normal power range, requiring
that the power supply first be isolated from the consuming
circuits. Such remedies may not be applicable to modern highfrequency power supplies as these produce full output voltage
even with reduced input.
Tantalum capacitors offer better frequency and temperature
characteristics than aluminum, but higher dielectric absorption
and leakage.[21] OS-CON (or OC-CON) capacitors are a
polymerized organic semiconductor solid-electrolyte type that
offer longer life at higher cost than standard electrolytic
capacitors.
Several other types of capacitor are available for specialist
applications. Supercapacitors store large amounts of energy.
Supercapacitors made from carbon aerogel, carbon nanotubes,
or highly porous electrode materials offer extremely high

capacitance (up to 5 kF as of 2010) and can be used in some


applications instead of rechargeable batteries. Alternating
current capacitors are specifically designed to work on line
(mains) voltage AC power circuits. They are commonly used in
electric motor circuits and are often designed to handle large
currents, so they tend to be physically large. They are usually
ruggedly packaged, often in metal cases that can be easily
grounded/earthed. They also are designed with direct current
breakdown voltages of at least five times the maximum AC
voltage.

CERAMIC CAPACITOR :

In this project, 0.01 microfarad capacitor is a ceramic capacitor.


The basis of the ceramic material is mainly barium titanate or a similar material, but other
ceramic substance including hydrous silicate of magnesia or talc are also used. The electrodes
are applied in the form of silver which is either spread or plated on to the opposite faces of a
thin tube, wafer or disc made from the ceramic material. Connecting wires are then soldered
to this deposit and the whole capacitor dipped in for a suitable coating.

Fig. Tabular and disc type ceramic capacitors

ELECTROLYTIC CAPACITOR :
In this project, 10f capacitor is an electrolytic capacitor. In this type of
capacitors, the dielectric consists of an extremely thin film of aluminum oxide
formed on one of its aluminum foil plates. Intimate contact with the other plate is
achieved by impregnating the paper between the foils with an electrolyte in the
form of viscous substance, such as ammonium borate. The sandwich is then
rolled into a cylindrical element and housed in either metallic cardboard, plastic
or ceramic protective tube.

Fig. Electrolytic and Tantalum capacitor

Applications
Capacitors have many uses in electronic and electrical systems.
They are so common that it is a rare electrical product that
does not include at least one for some purpose.
Energy storage
A capacitor can store electric energy when disconnected from
its charging circuit, so it can be used like a temporary battery.
Capacitors are commonly used in electronic devices to maintain
power supply while batteries are being changed. (This prevents
loss of information in volatile memory.)
Conventional electrostatic capacitors provide less than 360
joules per kilogram of energy density, while capacitors using
developing technologies can provide more than 2.52 kilojoules
per kilogram[22].
In car audio systems, large capacitors store energy for the
amplifier to use on demand. Also for a flash tube a capacitor is
used to hold the high voltage. In ceiling fans, capacitors play
the important role of storing electrical energy to give the fan
enough torque to start spinning.
Pulsed power and weapons
Groups of large, specially constructed, low-inductance highvoltage capacitors (capacitor banks) are used to supply huge
pulses of current for many pulsed power applications. These
include electromagnetic forming, Marx generators, pulsed
lasers (especially TEA lasers), pulse forming networks, radar,
fusion research, and particle accelerators.
Large capacitor banks (reservoir) are used as energy sources
for the exploding-bridgewire detonators or slapper detonators
in nuclear weapons and other specialty weapons. Experimental
work is under way using banks of capacitors as power sources

for electromagnetic armour and electromagnetic railguns and


coilguns.

Variable capacitor
A variable capacitor is a capacitor whose capacitance may be
intentionally and repeatedly changed mechanically or
electronically. Variable capacitors are often used in L/C circuits
to set the resonance frequency, e.g. to tune a radio (therefore
they are sometimes called tuning capacitors), or as a variable
reactance, e.g. for impedance matching in antenna tuners.

Mechanically controlled
In mechanically controlled variable capacitors, the distance
between the plates, or the amount of plate surface area which
overlaps, can be changed.
The most common form arranges a group of semicircular metal
plates on a rotary axis (rotor) that are positioned in the gaps
between a set of stationary plates (stator) so that the area of

overlap can be changed by rotating the axis. Air or plastic foils


can be used as dielectric material. By choosing the shape of the
rotary plates, various functions of capacitance vs. angle can be
created, e.g. to obtain a linear frequency scale. Various forms of
reduction gear mechanisms are often used to achieve finer
tuning control, i.e. to spread the variation of capacity over a
larger angle, often several turns. A vacuum variable capacitor
uses a set of plates made from concentric cylinders that can be
slid in or out of an opposing set of cylinders [1] (sleeve and
plunger). These plates are then sealed inside of a nonconductive envelope such as glass or ceramic and placed under
a high vacuum. The movable part (plunger) is mounted on a
flexible metal membrane that seals and maintains the vacuum.
A screw shaft is attached to the plunger, when the shaft is
turned the plunger moves in or out of the sleeve and the value
of the capacitor changes. The vacuum not only increases the
working voltage and current handling capacity of the capacitor
it also greatly reduces the chance of arcing across the plates.
The most common usage for vacuum variables are in high
powered transmitters such as those used for broadcasting,
military and amateur radio as well as high powered RF tuning
networks. Vacuum variables can also be more convenient since
the elements are under a vacuum the working voltage can be
higher than an air variable the same size, allowing the size of
the vacuum capacitor to be reduced.
Very cheap variable capacitors are constructed from layered
aluminium and plastic foils that are variably pressed together
using a screw. These so-called squeezers cant provide a stable
and reproducible capacitance, however. A variant of this
structure that allows for linear movement of one set of plates to
change the plate overlap area is also used and might be called
a slider. This has practical advantages for makeshift or home
construction and may be found in resonant loop antennas or
crystal radios.
Small variable capacitors operated by screwdriver (for instance,
to precisely set a resonant frequency at the factory and then

never be adjusted again) are called trimmer capacitors. In


addition to air and plastic, trimmers can also be made using a
ceramic dielectric.
Electronically controlled
The thickness of the depletion layer of a reverse-biased
semiconductor diode varies with the DC voltage applied across
the diode. Any diode exhibits this effect (including p/n junctions
in transistors), but devices specifically sold as variable
capacitance diodes (also called varactors or varicaps) are
designed with a large junction area and a doping profile
specifically designed to maximize capacitance.
Their use is limited to low signal amplitudes to avoid obvious
distortions as the capacitance would be affected by the change
of signal voltage, precluding their use in the input stages of
high-quality RF communications receivers, where they would
add unacceptable levels of intermodulation. At VHF/UHF
frequencies, e.g. in FM Radio or TV tuners, dynamic range is
limited by noise rather than large signal handling requirements,
and varicaps are commonly used in the signal path.
Varicaps are used for frequency modulation of oscillators, and
to make high-frequency voltage controlled oscillators (VCOs),
the core component in phase-locked loop (PLL) frequency
synthesizers that are ubiquitous in modern communications
equipment.
Digitally Tuned Capacitor
A digitally tuned capacitor is a type of chip-form variable
capacitor patented by Peregrine Semiconductor in the form of
DuNE technology using UltraCMOS process and HaRP
design innovation.[1]. The DuNE digitally tunable capacitor (DTC)
chip contains five capacitors switched by MOSFETs that operate
from a serial input bus with a 5-bit code providing 32 possible
capacitor values.

The capacitor values can range from 0.5 to 10 pF with typical


tuning ratios of 3:1 to 6:1, or 10:1 in some cases. Typical
switching speed is less than 5 s. Capacitor Q's greater than
100 are possible. The frecuency range is up to 3 GHz, and
power handling is up to 40 dBm. The chip operates with a
supply voltage of 2.4 to 3.0 V with current consumption in the
20- to 100-A range, unlike other . The device comes in a 2- by
2-mm dual flat no-lead (DFN) 8L flip-chip or plastic package.
It is ideal for antenna impedance matching in multi-band
GSM/WCDMA cellular handsets and mobile TV recivers that
must operate over wide frequency ranges such as the European
DVB-H and Japanese ISDB-T mobile TV systems, due to its small
size, high Q factor, low voltage operation and current
consumption.[2]

Diode
1N4007
1N4001 - 1N4007

General Purpose Rectifiers (Glass Passivated)


Absolute Maximum Ratings* TA = 25C unless otherwise noted
Features
Low forward voltage drop.
High surge current capability.
DO-41
COLOR BAND DENOTES CATHODE

A diode is an electrical device allowing current to move through


it in one direction with far greater ease than in the other. The
most common kind of diode in modern circuit design is the
semiconductor diode, although other diode technologies exist.
Semiconductor diodes are symbolized in schematic diagrams
such as Figure below. The term diode is customarily reserved
for small signal devices, I 1 A. The term rectifier is used for
power devices, I > 1 A.
Semiconductor diode schematic symbol: Arrows indicate the
direction of electron current flow.
When placed in a simple battery-lamp circuit, the diode will
either allow or prevent current through the lamp, depending on
the polarity of the applied voltage. (Figure below)

Diode operation: (a) Current flow is permitted; the diode is


forward biased. (b) Current flow is prohibited; the diode is
reversed biased.
When the polarity of the battery is such that electrons are
allowed to flow through the diode, the diode is said to be
forward-biased. Conversely, when the battery is backward
and the diode blocks current, the diode is said to be reversebiased. A diode may be thought of as like a switch: closed
when forward-biased and open when reverse-biased. Oddly
enough, the direction of the diode symbol's arrowhead points
against the direction of electron flow. This is because the diode
symbol was invented by engineers, who predominantly use
conventional flow notation in their schematics, showing current
as a flow of charge from the positive (+) side of the voltage

source to the negative (-). This convention holds true for all
semiconductor symbols possessing arrowheads: the arrow
points in the permitted direction of conventional flow, and
against the permitted direction of electron flow.
Diode behavior is analogous to the behavior of a hydraulic
device called a check valve. A check valve allows fluid flow
through it in only one direction as in Figure below.

Hydraulic check valve analogy: (a) Electron current flow


permitted. (b) Current flow prohibited.
Check valves are essentially pressure-operated devices: they
open and allow flow if the pressure across them is of the correct
polarity to open the gate (in the analogy shown, greater fluid
pressure on the right than on the left). If the pressure is of the
opposite polarity, the pressure difference across the check
valve will close and hold the gate so that no flow occurs. Like
check valves, diodes are essentially pressure- operated
(voltage-operated) devices. The essential difference between
forward-bias and reverse-bias is the polarity of the voltage
dropped across the diode. Let's take a closer look at the simple
battery-diode-lamp circuit shown earlier, this time investigating
voltage drops across the various components in Figure below.
ucts current and drops a small voltage across it, leaving most of
the battery voltage dropped across the lamp. If the battery's
polarity is reversed, the diode becomes reverse-biased, and
drops all of the battery's voltage leaving none for the lamp. If
we consider the diode to be a self-actuating switch (closed in

the forward-bias mode and open in the reverse-bias mode), this


behavior makes sense. The most substantial difference is that
the diode drops a lot more voltage when conducting than the
average mechanical switch (0.7 volts versus tens of millivolts).
This forward-bias voltage drop exhibited by the diode is due to
the action of the depletion region formed by the P-N junction
under the influence of an applied voltage. If no voltage applied
is across a semiconductor diode, a thin depletion region exists
around the region of the P-N junction, preventing current flow.
(Figure below (a)) The depletion region is almost devoid of
available charge carriers, and acts as an insulator:

Diode representations: PN-junction model, schematic symbol,


physical part.
The schematic symbol of the diode is shown in Figure above (b)
such that the anode (pointing end) corresponds to the P-type
semiconductor at (a). The cathode bar, non-pointing end, at (b)
corresponds to the N-type material at (a). Also note that the
cathode stripe on the physical part (c) corresponds to the
cathode on the symbol.
If a reverse-biasing voltage is applied across the P-N junction,
this depletion region expands, further resisting any current
through it. (Figure below)

Depletion region expands with reverse bias.


Conversely, if a forward-biasing voltage is applied across the PN junction, the depletion region collapses becoming thinner.
The diode becomes less resistive to current through it. In order
for a sustained current to go through the diode; though, the
depletion region must be fully collapsed by the applied voltage.
This takes a certain minimum voltage to accomplish, called the
forward voltage as illustrated in Figure below.

Inceasing forward bias from (a) to (b) decreases depletion


region thickness.
For silicon diodes, the typical forward voltage is 0.7 volts,
nominal. For germanium diodes, the forward voltage is only 0.3
volts. The chemical constituency of the P-N junction comprising
the diode accounts for its nominal forward voltage figure, which
is why silicon and germanium diodes have such different
forward voltages. Forward voltage drop remains approximately
constant for a wide range of diode currents, meaning that diode
voltage drop is not like that of a resistor or even a normal
(closed) switch. For most simplified circuit analysis, the voltage

drop across a conducting diode may be considered constant at


the nominal figure and not related to the amount of current.

A light-emitting diode (LED) (pronounced /l i di/, L-E-D[1]) is a


semiconductor light source. LEDs are used as indicator lamps in
many devices, and are increasingly used for lighting.
Introduced as a practical electronic component in 1962, [2] early
LEDs emitted low-intensity red light, but modern versions are
available across the visible, ultraviolet and infrared
wavelengths, with very high brightness. When a light-emitting
diode is forward biased (switched on), electrons are able to
recombine with electron holes within the device, releasing
energy in the form of photons. This effect is called
electroluminescence and the color of the light (corresponding
to the energy of the photon) is determined by the energy gap
of the semiconductor. An LED is often small in area (less than
1 mm2), and integrated optical components may be used to
shape its radiation pattern.[3] LEDs present many advantages
over incandescent light sources including lower energy
consumption, longer lifetime, improved robustness, smaller
size, faster switching, and greater durability and reliability. LEDs
powerful enough for room lighting are relatively expensive and
require more precise current and heat management than
compact fluorescent lamp sources of comparable output.
Light-emitting diodes are used in applications as diverse as
replacements for aviation lighting, automotive lighting
(particularly brake lamps, turn signals and indicators) as well as
in traffic signals

LIGHT EMITTING DIODE


LED falls within the family of P-N junction devices. The light emitting diode (LED) is a diode that
will give off visible light when it is energized. In any forward biased P-N junction there is, within the
structure and primarily close to the junction, a recombination of holes and electrons. This
recombination requires that the energy possessed by the unbound free electron be transferred to
another state.
The process of giving off light by applying an electrical source of energy is called
electroluminescence. As shown in fig., with its graphic symbol, the conducting surface connected to
the P-material is much smaller, to permit the emergence of the maximum number of photons of light
energy. Note in the figure that the recombination of the injected carriers due to the forward-biased
junction results in emitted light at the site of recombination. There may, of course, be some absorption
of the packages of photon energy in the structure itself, but a very large percentage are able to leave,
as shown in the fig.

Fig. Process of
electroluminescence in the LED

Absolute Maximum Ratings at TA = 25C


Parameter

High Eff. Red 4160

Units

Power dissipation

120

mW

Average forward current

20[1]

mA

Peak forward current

60

mA

Operating and storage temperature


range

-55C to 100C

Lead soldering temperature

230C for 3 seconds

[1.6mm (0.063 in.) from body]


[1] Derate from 50C at 0.2 mA/C

Electrical/Optical Characteristics at TA = 25C


Parameter

Symbol

High Eff. Red 4160

Units

Test
Conditions

Min.

Type

Max

1.0

3.0

mcd

IF = 10mA

Axial luminous
intensity

Iv

Included angle
between half luminous
intensity points

21/2

80

deg.

Peak wave length

peak

635

nm

Measurem
ent at Peak

Dominant wave length

628

nm

Speed of response

90

ns

Capacitance

11

pF

VF=0;
f=1 MHz

Thermal resistance

JC

120

C/W

Junction to
cathode
lead at
0.79 mm
(0.031 in)
from body

Forward voltage

VF

2.2

3.0

IF = 10mA

Reverse breakdown
voltage

BVR

Luminous efficacy

5.0

147

IR = 100A

Lm/V

BC548

NPN General Purpose Amplifier


This device is designed for use as general purpose amplifiers
and switches requiring collector currents to 300 mA. Sourced
from
Process 10. See PN100A for characteristics.

TRANSISTOR (BC558)

A transistor is semi conductor device consisting of three regions


separated by two P-N junctions. The three regions are Base,
Emitter & Collector.
The base may be of N- type or P- type. The emitter and
collector have same impurities but different from that of base.
Thus if base is of N- type then emitter and collector are of Ptype then transistor is called P-N-P transistor and vice versa
transistor is called N-P-N transistor.
The base is made thin and number density of majority carriers is always less
than emitter and collector. The base provides junction for proper interaction
between emitter and collector.
Electrons are majority charge carriers in N- region and in P-region, holes are the
majority charge carriers. Thus two types of charge carriers are involved in
current flow through N-P-N or P-N-P transistor.

SYMBOLS FOR TRANSISTORS:

In schematic symbols, the emitter is always represented by an


arrow indicating the direction of conventional current in the
device.

In case of N-P-N transistor arrow points away from base and in


case of P-N-P transistor it points towards base.
When transistor is used in circuit, emitter - base junction is
always forward biased while base - collector junction is always
reverse biased.

BIASING OF TRANSISTOR:

The two junctions can be biased in four different ways:


Both junctions may be forward biased. It causes large current to
flow across junctions. Transistor is to be operated in
SATURATION REGION.
Both junctions may be reversed biased. It causes very small
current to flow across junctions. Transistor is to be operated in
CUT OFF REGION.
E-B junction is forward biased and C-B junction is reverse
biased. The transistor is said to be operated in ACTIVE
REGION. Most of the transistors work in this region.
E-B junction is reversed biased and C-B junction is forward
biased. The transistor is said to be operated in INVERTED
MODE.

Fig. (a) P-N-P transistor biasing (b) N-P-N transistor biasing

CIRCUIT CONFIGURATIONS:
There are three possible ways in which a transistor can be
connected in the circuit which are following:
Common Base Configuration: Base is made common in this
configuration.
Common Emitter Configuration: Emitter is made common in
this configuration.
Common Collector Configuration: Collector is made common in
this configuration.
Absolute Maximum Rating :
noted

Ta = 25C unless otherwise

Parameter

Symb
ol

Value

Collector Emitter Voltage

VCEO

-30

Collector Base Voltage

VCBO

-30

Emitter Base Voltage

VEBO

-5

Collector Current (DC)

IC

-100

Collector Dissipation

PC

500

Junction Temperature

TJ

150

Storage Temperature

TSTG

-65 to 150

Electrical Characteristics : Ta = 25C unless otherwise noted


Parameter

Symbol

Test Condition

Collector Cut-off Current

ICBO

VCB = -30V, IE=0

DC Current Gain

hfe

VCB = -5V, IC=2mA

Min.

110

Type

Collector Emitter
Saturation Voltage

VCE(sat)

IC= -10mA, IB=


-0.5mA

-90
-250

IC= -100mA, IB=


-5mA
Collector Base
Saturation Voltage

VBE(sat)

IC= -10mA, IB=


-0.5mA

-700
-900

IC= -100mA, IB=


-5mA
Base Emitter On Voltage

VBE(On)

VCE= -5V, IC= -2mA


VCE= -5V, IC= -10mA

Current Gain Bandwidth


Product

fT

VCE= -5V, IC= -10mA,

Output Capacitance

Cob

VCB=
-10V,IE=0,f=1MHz

Noise Figure

NF

VCE= -5V, IC=


-200mA

600

-660

150

f=10MHz

REED SWITCH:
The reed switch contains a pair (or more) of magnetizable,
flexible, metal reeds whose end portions are separated by a
small gap when the switch is open. The reeds are hermetically
sealed in opposite ends of a tubular glass envelope. A magnetic
field (from an electromagnet or a permanent magnet) will
cause the reeds to come together, thus completing anelectrical
circuit. The stiffness of the reeds causes them to separate, and
open the circuit, when the magnetic field ceases. Another
configuration contains a non-ferrous normally-closed contact
that opens when the ferrous normally-open contact closes.
Good electrical contact is assured by plating a thin layer of nonferrous precious metal over the flat contact portions of the
reeds; low-resistivity silver is more suitable than corrosionresistant gold in the sealed envelope. There are also versions of
reed switches with mercury "wetted" contacts. Such switches

must be mounted in a particular orientation otherwise drops of


mercury may bridge the contacts even when not activated.
Since the contacts of the reed switch are sealed away from the
atmosphere, they are protected against atmospheric corrosion.
The hermetic sealing of a reed switch make them suitable for
use in explosive atmospheres where tiny sparks from
conventional switches would constitute a hazard.
One important quality of the switch is its sensitivity, the
amount of magnetic field necessary to actuate it. Sensitivity is
measured in units of Ampere-turns, corresponding to the
current in a coil multiplied by the number of turns. Typical pullin sensitivities for commercial devices are in the 10 to 60 AT
range. The lower the AT, the more sensitive the reed switch.
Also, smaller reed switches, which have smaller parts, are more
sensitive to magnetic fields, so the smaller the reed switch's
glass envelope is, the more sensitive it is.
In production, a metal reed is inserted in each end of a glass
tube and the end of the tube heated so that it seals around a
shank portion on the reed. Infrared-absorbing glass is used, so
an infrared heat source can concentrate the heat in the small
sealing zone of the glass tube. The thermal coefficient of
expansion of the glass material and metal parts must be similar
to prevent breaking the glass-to-metal seal. The glass used
must have a high electrical resistance and must not contain
volatile components such as lead oxide and fluorides. The leads
of the switch must be handled carefully to prevent breaking the
glass envelope.
.

MICROSWITCH

In electronics, a switch is an electrical component that can break an electrical


circuit, interrupting the current or diverting it from one conductor to another.[1][2]
The most familiar form of switch is a manually operated electromechanical
device with one or more sets of electrical contacts. Each set of contacts can be in
one of two states: either 'closed' meaning the contacts are touching and
electricity can flow between them, or 'open', meaning the contacts are separated
and nonconducting.
A switch may be directly manipulated by a human as a control signal to a
system, such as a computer keyboard button, or to control power flow in a

circuit, such as a light switch. Automatically-operated switches can be used to


control the motions of machines, for example, to indicate that a garage door has
reached its full open position or that a machine tool is in a position to accept
another workpiece. Switches may be operated by process variables such as
pressure, temperature, flow, current, voltage, and force, acting as sensors in a
process and used to automatically control a system. For example, a thermostat is
an automatically-operated switch used to control a heating process. A switch that
is operated by another electrical circuit is called a relay. Large switches may be
remotely operated by a motor drive mechanism. Some switches are used to
isolate electric power from a system, providing a visible point of isolation that
can be pad-locked if necessary to prevent accidental operation of a machine
during maintenance, or to prevent electric shock.

IC 7805 :

Three Terminal Positive Fixed Voltage Regulators


These voltage regulators are monolithic integrated circuits
designed as fixed voltage. These regulators employ internal
current limiting, thermal shutdown, and safe-area compensation.
With adequate heat sinking they can deliver output currents in
excess of 1.0A. Although designed primarily as a fixed voltage
regulator, these devices can be used with external components to
obtain adjustable voltages and currents.
Output Current in Excess of 1.0A
No external components required
Internal thermal overload protection
Internal short circuit current limiting

Output transistor safe area compensation


Output voltage offered in 2% and 4% tolerance
Available in surface mount D2pAK and standard 3-lead transistor
packages
Previous commercial temperature range has been extended to a
junction temperature range of 40C to +125C

DESCRIPTION
The 7805 series of three terminal positive regulators are
available in the TO-220/D-PAK package and with several fixed
output voltages, making them useful in a wide range of
applications. Each type employs internal current limiting, thermal
shut down and safe operating area protection, making it
essentially indestructible. If adequate heat sinking is provided,
they can deliver over 1A output current. Although designed
primarily as fixed voltage regulators, these devices can be used
with external components to obtain adjustable voltages and
currents.

Fig. Block Diagram of IC7805

Absolute Maximum Rating :


Parameter

Symbol

Value

Unit

Input Voltage (for VO=5V to 18V)

VI

35

(for VO =24V)

VI

40

Thermal Resistance, Junction to


Cases (TO-220)

RJC

C/W

Thermal Resistance, Junction to Air


(TO-220)

RJC

65

C/W

Operating Temp. Range

TOPR

0 - +125

Storage Temp. Range

TSTG

-65 - +150

Electrical Characteristics (TA = 25C unless otherwise noted)


Parameter

Symbol

Min

Typ
e

Max.

Unit

Output Voltage TJ =+25C

VO

4.8

5.0

5.2

Line Regulation (Note 1)

Regline

4.0

100

MV

Regload

100

MV

Quiescent Current TJ
=+25C

IQ

5.0

8.0

mA

Quiescent Current Change

IQ

0.0
3

0.5

mA

VO/T

-0.8

MV/
C

VN

42

V/VO

RR

62

73

dB

VDrop

rO

15

ISC

230

MA

IPK

2.2

VO =7V to 25V
Load Regulation (Note 1)
IO = 5.0mA to 1.5A

IO = 5.0mA to 1.0A
Output Voltage Drift
IO = 5.0mA
Output Noise Voltage
f=10Hz to 100MHz
TA=+25C
Ripple Rejection
f=120Hz, VO=8V to 18V
Dropout Voltage
IO = 1A, TA=+25C
Output Resistance
f=1KHz
Short Circuit Current
VI = 35V, TA=+25C
Peak Current TA=+25C

NOTE : Load and line regulation are specified at constant junction


temperature. Changes in VO due to heating effects must be taken
into account separately. Pulse testing with low duty is used

RELAYS

Error: Reference source not found


STRIP
OUT N/C

OUT N/O
SPRING
230V

P
MAGNET

A relay is an electrically operated switch. The relay contacts can be made to


operate in the pre-arranged fashion. For instance, normally open contacts close
and normally closed contacts open. In electromagnetic relays, the contacts
however complex they might be, they have only two position i.e. OPEN and
CLOSED, whereas in case of electromagnetic switches, the contacts can have
multiple positions.

NEED FOR THE USE OF RELAY

The reason behind using relay for switching loads is to provide complete
electrical isolation. The means that there is no electrical connection between the
driving circuits and the driven circuits. The driving circuit may be low voltage
operated low power circuits that control several kilowatts of power. In our

circuit where a high fan could be switched on or off depending upon the output
from the telephone.
Since the relay circuit operated on a low voltage, the controlling circuit is quite
safe. In an electromagnetic relay the armature is pulled by a magnetic force
only. There is no electrical connection between the coil of a relay and the
switching contacts of the relay. If there are more than one contact they all are
electrically isolated from each other by mounting them on insulating plates and
washers. Hence they can be wired to control different circuits independently.
Some of the popular contacts forms are described below:
1. Electromagnetic relay
2. Power Relay.
3. Time Delay Relay.
4. Latching Relay.
5. Crystal Can Relay.
6. Co-axial Relay.
1. Electromagnetic relay:

An electromagnetic relay in its simplest form consists of a coil, a DC current


passing through which produces a magnetic field. This magnetic field attracts an
armature, which in turn operates the contacts. Normally open contacts close and
normally closed contacts open. Electromagnetic relays are made in a large
variety of contacts forms.

2. Power relays:

Power relays are multi-pole heavy duty lapper type relays that are capable of
switching resistive loads of upto 25amp.. These relays are widely used for a
variety of industrial application like control of fractional horse power motors,
solenoids, heating elements and so on. These relays usually have button like
silver alloy contacts and the contact welding due to heavy in rush current is

avoided by wiping action of the contacts to quench the arc during high voltage
DC switching thus avoiding the contact welding.

3. Time Delay Relay:

A time delay relay is the one in which there is a desired amount of time delay
between the application of the actuating signal and operation of the load
switching devices.

4. Latching Relay:

In a Latching Relay, the relay contacts remain in the last energized position
even after removal of signal in the relay control circuit. The contacts are held in
the last relay-energized position after removal of energisation either electrically
or magnetically. The contacts can be released to the normal position electrically
or mechanically.

5. Crystal Can Relay:

They are so called, as they resemble quartz crystal in external shapes. These are
high performance hermetically sealed miniature or sub-miniature relay widely
used in aerospace and military application. These relays usually have gold
plated contacts and thus have extremely low contact resistance. Due to low
moment of inertia of the armature and also due to statically and dynamically
balanced nature of armature, these relays switch quite reliably even under
extreme condition of shock and vibration.

6. Co-axial Relay:

A Co-axial Relay has two basic parts, an actuator which is nothing but some
kind of a coil and a cavity, housing the relay contacts. The co-axial relay are
extensively used for radio frequency switching operations of equipment

How to control sensors


What is a voltage divider?
You are going to find out but don't be in too much of a hurry. Work through the
Chapter and allow the explanation to develop.
The diagram below shows a light dependent resistor, or LDR, together with
its circuit symbol:

The light-sensitive part of the LDR is a wavy track of cadmium sulphide. Light
energy triggers the release of extra charge carriers in this material, so that its
resistance falls as the level of illumination increases.
A light sensor uses an LDR as part of a voltage divider.
The essential circuit of a voltage divider, also called a potential divider, is:

What happens if one of the resistors in the voltage divider is replaced by an


LDR? In the circuit below, Rtop is a 10

Suppose the LDR has a resistance of 500

resistor, and an LDR is used as Rbottom :

, 0.5

in the shade (these values are reasonable).


When the LDR is in the light, Vout will be:

, in bright light, and 200

In the shade, Vout will be:

In other words, this circuit gives a LOW voltage when the LDR is in the light,
and a HIGH voltage when the LDR is in the shade. The voltage divider circuit
gives an output voltage which changes with illumination.
A sensor subsystem which functions like this could be thought of as a 'dark
sensor' and could be used to control lighting circuits which are switched on
automatically in the evening.
Perhaps this does not seem terribly exciting, but almost every sensor circuit you
can think of uses a voltage divider. There's just no other way to make sensor
subsystems work.
Here is the voltage divider built with the LDR in place of Rtop :

Temperature sensors
A temperature-sensitive resistor is called a thermistor. There are several
different types:

The resistance of most common types of thermistor decreases as the temperature


rises. They are called negative temperature coefficient, or ntc, thermistors.
Note the -t next to the circuit symbol. A typical ntc thermistor is made using
semiconductor metal oxide materials. (Semiconductors have resistance
properties midway between those of conductors and insulators.) As the
temperature rises, more charge carriers become available and the resistance
falls.
Although less often used, it is possible to manufacture positive temperature
coefficient, or ptc, thermistors. These are made of different materials and show
an increase in resistance with temperature.
How could you make a sensor circuit for use in a fire alarm? You want a circuit
which will deliver a HIGH voltage when hot conditions are detected. You need
a voltage divider with the ntc thermistor in the Rtop position:

How could you make a sensor circuit to detect temperatures less than 4C to
warn motorists that there may be ice on the road? You want a circuit which will
give a HIGH voltage in cold conditions. You need a voltage divider with the
thermistor in place of Rbottom :

This last application raises an important question: How do you know what value
of Vout you are going to get at 4C?

Key point: The biggest change in Vout from a voltage divider is obtained when
Rtop and Rbottom are equal in value

Sound sensors
Another name for a sound sensor is a microphone. The diagram shows a
cermet microphone:

Cermet' stands for 'ceramic' and 'metal'. A mixture of these materials is used in
making the sound-sensitive part of the microphone. To make them work
properly, cermet microphones need a voltage, usually around 1.5 V across them.
A suitable circuit for use with a 9 V supply is:

The 4.7

and the 1

resistors make a voltage divider which provides 1.6 V

across the microphone. Sound waves generate small changes in voltage, usually
in the range 10-20 mV. To isolate these small signals from the steady 1.6 V, a
capacitor is used.
Signals from switches
When a switch is used to provide an input to a circuit, pressing the switch
usually generates a voltage signal. It is the voltage signal which triggers the
circuit into action. What do you need to get the switch to generate a voltage
signal? . . . You need a voltage divider. The circuit can be built in either of two
ways:

The pull down resistor in the first circuit forces Vout to become LOW except
when the push button switch is operated. This circuit delivers a HIGH voltage
when the switch is pressed. A resistor value of 10

is often used.

In the second circuit, the pull up resistor forces Vout to become HIGH except
when the switch is operated. Pressing the switch connects Vout directly to 0 V. In
other words, this circuit delivers a LOW voltage when the switch is pressed.
In circuits which process logic signals, a LOW voltage is called 'logic 0' or just
'0', while a HIGH voltage is called 'logic1' or '1'. These voltage divider circuits
are perfect for providing input signals for logic systems.

What kinds of switches could you use. One variety of push button switch is
called a miniature tactile switch. These are small switches which work well
with prototype board:

As you can see, the switch has four pins which are linked in pairs by internal
metal strips. Pressing the button bridges the contacts and closes the switch. The
extra pins are useful in designing printed circuit boards for keyboard input and
also stop the switch from being moved about or bent once soldered into
position.
There are lots of other switches which you might want to use in a voltage
divider configuration. These include magnetically-operated reed switches, tilt
switches and pressure pads, all with burglar alarm applications.

SOLDERING

Soldering is the process of joining two metallic conductors the


joint where two metal conductors are to be joined or fused is
heated with a device called soldering iron and then as allow of tin
and lead called solder is applied which melts and converse the
joint. The solder cools and solidifies quickly to ensure is good and
durable connection between the jointed metal converting the joint
solder also present oxidation.

SOLDERING & DESOLDERING TECHNIQUES :


There are basically two soldering techniques:
Manual soldering with iron.
Mass soldering.
The iron consist of an insulated handle connected via a metal
shank to the bit the function of bit is to
Stare host & convey it to the component
To store and deliver molten solder 7 flux.
To remove surplus solder from joints.
Soldering bit are made of copper because it has good heat
capacity & thermal conductivity. It may erode after long term use
to avoid it coating of nickel or tin is used.

SOLDERING WITH IRON :


The surface to be soldered must be cleaned & fluxed. The
soldering iron switched on & bellowed to attain soldering
temperature. The solder in form of wire is allied hear the
component to be soldered &b heated with iron. The surface to be
soldered is filled, iron is removed & the joint is cold without
disturbing.

Solder joint are supposed to


Provide permanent low resistance path
Make a robust mechanical link between PCB & leads of
components.
Allow heat flow between component, joining elements & PCB.
Retain adequate strength with temperature variation.
The following precaution should be taken while soldering.
Use always an iron plated copper core tip for soldering iron.
Slightly fore the tip with a cut file when it is cold.
Use a wet sponge to wipe out dirt from the tip before soldering
instead of asking the iron.
Tighten the tip screw if necessary before iron is connected to
power supply.
Clean component lead & copper pad before soldering.
Use proper tool for component handling instead of direct
handling.
Apply solder between component leads, PCB pattern & tip of
soldering iron.
Iron should be kept in contact with the joint s for 2-3 second s
only instead of keeping for very long or very small time.
Use optimum quantity of solder.

Use multistoried wire instead of single strands solvent like


isopropyl alcohol.
Every time soldering is over, put a little clean solder on the tip.

org 0003h
reti
org 000Bh
reti
org 0013h
reti
org 001Bh
reti
org 0023h
reti
org 002Bh
reti
org 33h
poweron:
mov sp,#stack
mov p0,#0ffh
mov p1,#0ffh

mov p2,#0ffh
mov p3,#0ffh
mov IE,#00h
mov IP,#00h

acall mainlp
mainlp:
setb p3.7
;show car is parked or not on led
acall init_LCD

;calling LCd commands

acall express
acall start1
acall nooo
Following instruction will display black box on LCD. Fcbfl
instruction is to to write data on LCD in first line. First of all data
in table in dptr-16 bit register. Then we will call write
instruction. In write instruction we will mov data pointewin
accumulator and acc data on LCd and check zero at end. If zero
detetected it will show data on LCD
express:

; moving auto carparking on lcd

acall fcbfl
mov dptr,#TABLE1

acall write
ret

start1:

; moving motor forward and backward

jnb p1.0,phase1;gas
jnb p1.1,phase2
jnb p1.2,phase3
jnb p1.3,phase4
jnb p1.4,phase5
jnb p1.3,phase5
jnb p1.4,phase6
acall phase10
acall delay
sjmp start1
phase1:

;gas
acall fcbsl
mov dptr,#TABLE2
acall write
clr p2.0

setb p2.1
acall buzze
acall delay1
acall delay1
acall delay1
ret
phase2:

;dipper
acall fcbsl
mov dptr,#TABLE3
acall write
clr p2.0
setb p2.1
acall buzze
acall delay1
acall delay1
acall delay1
ret

phase3:

;Rain
acall fcbsl
mov dptr,#TABLE4

acall write
clr p2.0
setb p2.1
acall buzze
acall delay1
acall delay1
acall delay1
acall delay
clr p2.0
setb p2.1

ret
This program is to write table 6 on LCD. In table 6 we will
display fire detected signal on LCD
phase4:

;thermocouple
mov dptr,#TABLE6
acall write
clr p2.0
setb p2.1

acall buzze
acall delay1
acall delay1
acall delay1
acall delay

ret
phase5:

; LDR
acall fcbsl
mov dptr,#TABLE7
acall write
clr p2.0
setb p2.1
acall buzze
acall delay1
acall delay1
acall delay1
acall delay

ret

phase6:
acall fcbsl
mov dptr,#TABLE8
acall write
clr p2.0
setb p2.1
acall buzze
acall delay1
acall delay1
acall delay1
acall delay

ret
phase7:
acall fcbsl
mov dptr,#TABLE9
acall write
clr p2.0
setb p2.1
acall buzze

acall delay1
acall delay1
acall delay1
acall delay

ret
phase10:
acall fcbsl
mov dptr,#TABLE5
acall write
setb p2.0
setb p2.1
setb p2.2
acall delay1
acall delay1
ret
To make buzzer we will clear buzzer so that it will give low
signal from microcontroller to buzzer circuit. In Buzzer circuit
we will use two npn and pnp transistors.
We will use BC 548 npn and bc 558 pnp transistors.

We will give low signal from mircoontroller to pnp transistor .


pnp transistors o/p will be connected to npn.
Npn will give low signal to buzzer or relay circuit.
buzze:
clr buzz

acall delay
acall delay
setb buzz
ret

clrlcd:
mov A,#01h

Entry mode, Set increment

acall command
acall delay
ret
init_LCD:

; LCD routines

mov A,#38h

acall command

acall delay

Display clear

mov A,#0Eh

Entry mode, Set

Entry mode, Set

Entry mode, Set

increment
acall command
acall delay
mov A,#01h
increment
acall command
acall delay
mov A,#06h
increment
acall command
acall delay
ret

display:
mov lcd,a
setb rs
clr rw

;WRITE COMMAND TO LCD

setb en
acall delay
clr en
ret
command:

;INSTRUCTION COMMAND TO LCD

mov lcd,a
clr rs ; 4thn pin of LCD
clr rw
setb en
acall delay
clr en
ret

write:
clr a
movc a,@a+dptr
acall display
acall delay
inc dptr

;WRITE FROM DATATABLES

jz again

sjmp write
again: acall delay1

fcbfl:
mov a,#80h

;CURSOR AT BEGINNING OF IST LINE

acall command
acall delay
ret
fcbsl:
mov a,#0C0h

;CURSOR AT BEGINNING OF IIND

LINE
acall delay
acall command
ret

delay:
mov r3,#50
here2: mov r4,#255

;lcd delay

here:

djnz r4,here

djnz r3,here2
ret
delay1:

;motor delay

mov r0,#0ffh
her: mov r1,#0ffh
h1: djnz r1,h1
djnz r0,her
ret
nooo:
nop
;DATA TABLE
we will create table for black box. To display more then one
charater on LCD. Then we will make table in database.Keep
data in double colons and end with comma. After completing
characters finish it with Zero so that we can check character
finished or not.
TABLE1: DB "BLACK BOX*****",0
TABLE2: DB 'GAS DETECTED**',0
TABLE3: DB "DPPER ON******",0
TABLE4: DB "RAIN DETECTED*",0

TABLE5: DB "NO PROBLEM****",0


TABLE6: DB "FIRE DETECTED*",0
TABLE7: DB "SOMEONE IN CAR",0
end

BIBILIOGRAPHY

1. HAND BOOK OF ELECTRONICS

A.K.

MAINI.
2.HAND BOOK OF ELECTRONICS
3.LET US C

GUPTA & KUMAR.


YASHWANT

KANITKAR.
4.SHYAM SERIES

TATA MC

GRILL.

5.DIGITAL SYSTEMS PRINCIPLES AND APPLICATION

RONALD LTOCCI.

(Sixth addition)
6.ELECTRONICS FOR YOU

(MARCH

1998).
7.DIGITAL DESIGN

MORIS

MANO.
(Second addition)
8.RELAYS AND ITS APPLICATION

SHARMA, MC.

(Bpb-publishers)
9.MODERN ALL ABOUT MOTHERBOARD

LOTHIA, M.

(Bpb-publishers)
10.POWER SUPPLY FOR ALL OCCASION

SHARMA,

MC.
(Bpb-publishers)
11.CMOS DATA BOOK (74SERIES)
ECA.
(Bpb-publishers)
12.PRACTICAL VALUE AND TRANSISTOR DATA

POPE.

(Bpb-publishers)
13.PRACTICAL TRANSFORMER DESIGN HAND BOOK
(Bpb-publishers)

LABON. E.

14 MODERN IC
LOTIA.
(DATA AND SUBSTITUTIONAL MANUAL)

MANAHAR