Escolar Documentos
Profissional Documentos
Cultura Documentos
B.TECH
( Dept.of Electronics and Communication Engineering)
SUBMITTED BY
MUKESH KUMAR
University Roll NoUnder the supervision of
MR. SACHIN
(Department of ECE)
June -2015
ABSTRACT
In this project we give a idea of automatic water filling
system. If we want to water on desired level then system
automatically sense this level and control the water on
desired level on the bases of sensing module. System
automatically check the water in sever pipe. water is
available in sever in pipe system operate the pump
automatically and fill the tank/field . but for water saving
and energy saving it sense the level of water in tank .in
case of tank is full system automatically weep the buzzer
and off the pump.
Future:
It check the leakage of water in pipe and provide the
water saving and indicate sign.
2. FEEDBACK MODE:
In this mode we check the water in tank. With the
help of water sensor we check the level and this
information give to microcontroller and this situation
control by microcontroller on the bases of pump
controlling in this project.
Operate the pump: if we want to operate the pump then it
operate and it control by switch and automatic also. If field
complete fill then system automatically sense it condition
and operate the pump in off mode.
Component:
1. Step down transformer.(190)
2. Regulator (7805).(35)
3. Diode (in-4007(2)
4. Led.(1)
5. Microcontroller (at89s52).(120)
6. Capacitor (1000uf, 27pf, 10uf).(5)
7. Resistor(1k,4700hm,10k,220k)(2)
8. Transistor (npn and pnp).(5)
9. Relay.(120)
10.
Motor(750).
11.
12.
13.
14.
15.
16.
17.
tank with the help of water sensor and in case of full tank
system automatically stop the pump and alert the honor.
In any case water leakage In any place in pipe line
system automatically check this condition and it give the
signal to control room and operate the buzzer.
RESEARCH AREA
G.L Peterson ,the wireless control system.
U.S Department of energy, Energy saver
system,
S.kopparthi pratul K ajmera : Signal delivery for
remotely located micro-system.
Discrete Semiconductors.2n222222.
TEXAS Instruments.max232,ht-12e and ht12.
Atmel corporation, microcontroller at89s52.
Digikey,BJT,TIP
Programming,8051 microcontroller Mazidi.,
programming ,Kenneth j.ayala western
Carolina university.
Harry keybett and earl boysen,basic
electronics.
Front line electronic, application of
electronics
Power
supply
Microco
ntroller
At89s52
Driver
ckt
Lm-339
relay
Water level
sensor
Wat
er
sen
sor
CIRCUIT DIAGRAM:
pum
p
U?
LCD1
7805
LM016L
GND
VO
C?
1nF
C?
R?
1nF
10k
VSS
VDD
VEE
RV2
D?
DIODE
D?
1
2
3
TRAN-2P2S
LED
1k
U?
D3
8
7
6
5
4
3
2
1
LED
LDR SENOR
R1
U1:A
8
10k
P1.7
P1.6
P1.5
P1.4
P1.3
P1.2
P1.1/T2EX
P1.0/T2
P3.7/RD
P3.6/WR
P3.5/T1
P3.4/T0
P3.3/INT1
P3.2/INT0
P3.1/TXD
P3.0/RXD
P2.7/A15
P2.6/A14
P2.5/A13
P2.4/A12
P2.3/A11
P2.2/A10
P2.1/A9
P2.0/A8
C?
1nF 31
30
29
EA
ALE
PSEN
LM358
R?
10k
RV1
RST
P0.7/AD7
P0.6/AD6
P0.5/AD5
P0.4/AD4
P0.3/AD3
P0.2/AD2
P0.1/AD1
P0.0/AD0
1k
X?
18
XTAL2
19
CRYSTAL
WATER SENSOR
XTAL1
17
16
15
14
13
12
11
10
28
27
26
25
24
23
22
21
D1
Q?
PNP
32
33
34
35
36
37
38
39
C?
C?
LED
1nF
1nF
U2:A
10k
8
4
3
LM358
D5
LED
D2
R2
DIODE
LED
D6
Q6
U1:B
NPN
AT89C52
D4
Q1
PLATE SENSOR
RV3
RV4
1k
1k
LM358
PNP
Q7
NPN
DIODE
D0
D1
D2
D3
D4
D5
D6
D7
VI
DIODE
7
8
9
10
11
12
13
14
RS
RW
E
D?
4
5
6
TR?
GAINT CHART:
Start
and Interruption
D
No
Is on the pump?
Yes
A
Yes
Is Key = m.v>set value key?
No
Is Wait Timer
Over?
No
Yes
Enable Receiver
Yes
Is
Over?
Yes
No
PROBLEM CONTENT:
Components availability.
How to decide value of components.
Circuit designing.
How to give the effort of soldering properly.
Programming of sensor,
signal sending and.
lcd interfacing.
LEARNING OBJECTIVE:
9x5.
Components.
Decide the component rating.
Name of components that may be use in project.
Purchase the components.
rd
3. 3 Mode:
In this mode we design a circuit on pcb.
Assemble the components.
Test the soldering dry or not.
th
4. 4 mode:
in this mode we software for coding.
We use keil software.
We design a code in assembly or embedded c.
We create the hex file.
5. 5th mode:
in this mode we design a circuit diagram on proteus for
simulation
try to simulation on proteus.
6. 6th mode:
In this mode we use the top-win software.
We programmed the ic.
th
7. 7 mode :in this mode we test the features of project.
TESTING TOOL:
Multi-meter.
Switch.
Battery.
Cro.
Scope.
Led indication.
HARDWARE/COMPONENTS DETAIL:
POWER SUPPLY
All digital circuits require regulated power supply. In this article we are going to learn how to get
a regulated positive supply from the mains supply.
Figure 1 shows the basic block diagram of a fixed regulated power supply. Let us go through
each block.
TRANSFORMER
A transformer consists of two coils also called as WINDINGS namely PRIMARY &
SECONDARY.
They are linked together through inductively coupled electrical conductors also called as CORE.
A changing current in the primary causes a change in the Magnetic Field in the core & this in
turn induces an alternating voltage in the secondary coil. If load is applied to the secondary then
an alternating current will flow through the load. If we consider an ideal condition then all the
energy from the primary circuit will be transferred to the secondary circuit through the magnetic
field.
So
The secondary voltage of the transformer depends on the number of turns in the Primary as well as in the
secondary..
Rectifier
A rectifier is a device that converts an AC signal into DC signal. For rectification purpose we use
a diode, a diode is a device that allows current to pass only in one direction i.e. when the anode
of the diode is positive with respect to the cathode also called as forward biased condition &
blocks current in the reversed biased condition.
This is the simplest type of rectifier as you can see in the diagram a half wave rectifier consists
of only one diode. When an AC signal is applied to it during the positive half cycle the diode is
forward biased & current flows through it. But during the negative half cycle diode is reverse
biased & no current flows through it. Since only one half of the input reaches the output, it is
very inefficient to be used in power supplies.
2) Full wave rectifier.
Half wave rectifier is quite simple but it is very inefficient, for greater efficiency we would like
to use both the half cycles of the AC signal. This can be achieved by using a center tapped
transformer i.e. we would have to double the size of secondary winding & provide connection to
the center. So during the positive half cycle diode D1 conducts & D2 is in reverse biased
condition. During the negative half cycle diode D2 conducts & D1 is reverse biased. Thus we get
both the half cycles across the load.
One of the disadvantages of Full Wave Rectifier design is the necessity of using a center tapped
transformer, thus increasing the size & cost of the circuit. This can be avoided by using the Full
Wave Bridge Rectifier.
3) Bridge Rectifier.
As the name suggests it converts the full wave i.e. both the positive & the negative half cycle
into DC thus it is much more efficient than Half Wave Rectifier & that too without using a center
tapped transformer thus much more cost effective than Full Wave Rectifier.
Full Bridge Wave Rectifier consists of four diodes namely D1, D2, D3 and D4. During the
positive half cycle diodes D1 & D4 conduct whereas in the negative half cycle diodes D2 & D3
conduct thus the diodes keep switching the transformer connections so we get positive half
cycles in the output.
If we use a center tapped transformer for a bridge rectifier we can get both positive & negative
half cycles which can thus be used for generating fixed positive & fixed negative voltages.
FILTER CAPACITOR
Even though half wave & full wave rectifier give DC output, none of them provides a constant
output voltage.For this we require to smoothen the waveform received from the rectifier. This
can be done by using a capacitor at the output of the rectifier this capacitor is also called as
FILTER CAPACITOR or SMOOTHING CAPACITOR or RESERVOIR CAPACITOR.
Even after using this capacitor a small amount of ripple will remain.
We place the Filter Capacitor at the output of the rectifier the capacitor will charge to the peak voltage during
each half cycle then will discharge its stored energy slowly through the load while the rectified voltage drops
to zero, thus trying to keep the voltage as constant as possible.
If we go on increasing the value of the filter capacitor then the Ripple will decrease. But then the costing will
increase. The value of the Filter capacitor depends on the current consumed by the circuit, the frequency of
the waveform & the accepted ripple.
Where,
Vr= accepted ripple voltage.( should not be more than 10% of the voltage)
I= current consumed by the circuit in Amperes.
F= frequency of the waveform. A half wave rectifier has only one peak in one cycle so F=25hz
whereas a full wave rectifier has Two peaks in one cycle so F=100hz.
VOLTAGE REGULATOR
A Voltage regulator is a device which converts varying input voltage into a constant regulated
output voltage. voltage regulator can be of two types
1) Linear Voltage Regulator
Also called as Resistive Voltage regulator because they dissipate the excessive voltage
resistively as heat.
2) Switching Regulators.
They regulate the output voltage by switching the Current ON/OFF very rapidly. Since their
output is either ON or OFF it dissipates very low power thus achieving higher efficiency as
compared to linear voltage regulators. But they are more complex & generate high noise due to
their switching action. For low level of output power switching regulators tend to be costly but
for higher output wattage they are much cheaper than linear regulators.
The most commonly available Linear Positive Voltage Regulators are the 78XX series where the
XX indicates the output voltage. And 79XX series is for Negative Voltage Regulators.
After filtering the rectifier output the signal is given to a voltage regulator. The maximum input voltage that
can be applied at the input is 35V.Normally there is a 2-3 Volts drop across the regulator so the input voltage
should be at least 2-3 Volts higher than the output voltage. If the input voltage gets below the Vmin of the
regulator due to the ripple voltage or due to any other reason the voltage regulator will not be able to produce
the correct regulated voltage
POWER SUPPLY
in this project we use one 5 volt regulated power supply to convert the 220
volt ac in to 5 volt dc with the help of the 5 volt regulator circuit. First OF all
we step down the 220 volt ac into 6 volt ac with the help of step down
transformer. Step down transformer step down the voltage from 220 volt ac
to 9 volt ac. This ac is further converted into the dc voltage with the help of
the full wave rectifier circuit
DIODE
If the connections are reversed, a very little current will flow. This
is because under this condition, the p-type material will accept the
electrons from the negative terminal of the battery and the N-type
material will give up its free electrons to the battery, resulting in the
state of electrical equilibrium since the N-type material has no more
electrons. Thus there will be a small current to flow and the diode is
called Reverse biased.
Thus the Diode allows direct current to pass only in one direction
while blocking it in the other direction. Power diodes are used in
concerting AC into DC. In this, current will flow freely during the first
half cycle (forward biased) and practically not at all during the other
half cycle (reverse biased). This makes the diode an effective rectifier,
which convert ac into pulsating dc. Signal diodes are used in radio
circuits for detection. Zener diodes are used in the circuit to control the
voltage.
1. Zener diode.
2. Photo diode.
1.
ZENER DIODE:-
2.
PHOTO DIODE:-
3.
Basically, LEDs are just tiny light bulbs that fit easily into an electrical circuit. But
unlike ordinary incandescent bulbs, they don't have a filament that will burn out,
and they don't get especially hot. They are illuminated solely by the movement of
electrons in a semiconductor material, and they last just as long as a standard
transistor.
DIODE
A diode is the simplest sort of semiconductor device. A semiconductor is a material
with a varying ability to conduct electrical current. Most semiconductors are made
of a poor conductor that has had impurities (atoms of another material) added to it.
The process of adding impurities is called doping.
In the case of LEDs, the conductor material is typically aluminum-galliumarsenide (AlGaAs). In pure aluminum-gallium-arsenide, all of the atoms bond
perfectly to their neighbors, leaving no free electrons (negatively-charged particles)
to conduct electric current. In doped material, additional atoms change the balance,
either adding free electrons or creating holes where electrons can go. Either of
these additions makes the material more conductive.
At the junction, free electrons from the N-type material fill holes from
the P-type material. This creates an insulating layer in the middle of the
diode called the depletion zone.
semiconductor with extra electrons is called N-type material, since it has extra
negatively charged particles. In N-type material, free electrons move from a
negatively charged area to a positively charged area.
A semiconductor with extra holes is called P-type material, since it effectively has
extra positively charged particles. Electrons can jump from hole to hole, moving
from a negatively charged area to a positively charged area. As a result, the holes
themselves appear to move from a positively charged area to a negatively charged
area.
At the junction, free electrons from the N-type material fill holes from
the P-type material. This creates an insulating layer in the middle of the
diode called the depletion zone.
To get rid of the depletion zone, electrons should move from the N-type area to the
P-type area and holes should move in the reverse direction. This is done by
connecting the N-type side of the diode to the negative end of a circuit and the Ptype side to the positive end. The free electrons in the N-type material are repelled
by the negative electrode and drawn to the positive electrode. The holes in the Ptype material move the other way. When the voltage difference between the
electrodes is high enough, the electrons in the depletion zone are boosted out of
their holes and begin moving freely again. The depletion zone disappears, and
charge moves across the diode.
When the negative end of the circuit is hooked up to the N-type layer
and the positive end is hooked up to P-type layer, electrons and holes
start moving and the depletion zone disappears.
If current is run the other way, with the P-type side connected to the negative end
of the circuit and the N-type side connected to the positive end, current will not
flow. The negative electrons in the N-type material are attracted to the positive
electrode. The positive holes in the P-type material are attracted to the negative
electrode. No current flows across the junction because the holes and the electrons
are each moving in the wrong direction. The depletion zone increases.
The interaction between electrons and holes in this setup has an interesting side
effect - it generates light.
For an electron to jump from a lower orbital to a higher orbital, something has to
boost its energy level. Conversely, an electron releases energy when it drops from a
higher orbital to a lower one. This energy is released in the form of a photon. A
greater energy drop releases a higher-energy photon, which is characterized by a
higher frequency.
As free electrons moving across a diode can fall into empty holes from the P-type
layer. This involves a drop from the conduction band to a lower orbital, so the
electrons release energy in the form of photons. This happens in any diode, but the
photons are seen when the diode is composed of certain material. The atoms in a
standard silicon diode, for example, are arranged in such a way that the electron
drops a relatively short distance. As a result, the photon's frequency is so low that it
is invisible to the human eye - it is in the infrared portion of the light spectrum. This
isn't necessarily a bad thing, of course: Infrared LEDs are ideal for remote controls,
among other things.
Visible light-emitting diodes (VLEDs), such as the ones that light up numbers in a
digital clock, are made of materials characterized by a wider gap between the
conduction band and the lower orbitals. The size of the gap determines the
frequency of the photon -- in other words, it determines the color of the light.
While all diodes release light, most don't do it very effectively. In an ordinary diode,
the semiconductor material itself ends up absorbing a lot of the light energy.
LEDs have several advantages over conventional incandescent lamps. For one
thing, they don't have a filament that will burn out, so they last much longer.
Additionally, their small plastic bulb makes them a lot more durable. They also fit
more easily into modern electronic circuits.
But the main advantage is efficiency. In conventional incandescent bulbs, the lightproduction process involves generating a lot of heat (the filament must be warmed).
is completely wasted energy, unless the lamp is used as a heater, because a huge
portion of the available electricity isn't going toward producing visible light. LEDs
generate very little heat, relatively. A much higher percentage of the electrical
power is going directly to generating light, which cuts down on the electricity
demands considerably.
Up until recently, LEDs were too expensive to use for most lighting applications
because they're built around advanced semiconductor material. The price of
semiconductor devices has plummeted over the past decade, however, making
LEDs a more cost-effective lighting option for a wide range of situations. While they
may be more expensive than incande front, their lower cost in the long run can
make them a better buy. In the future, they will play an even bigger role in the world
of technology.
MATERIAL REQUIRED
Plastic Tray
PROCEDURE
The first and foremost in the process is to clean all dirt from copper
sheet with say spirit or trichloro ethylene to remove traces grease or oil
etc. and then wash the board under running tap water. Dry the surface
with forced warm air or just leave the board to dry naturally for some
time.
REACTION
PRECAUTION
1.
2.
3.
Try not to breathe the vapours. Stir the solution by giving see-saw
motion to the dish and solution in it.
4.
5.
USES
for
compactness,
simplicity
of
servicing
and
case
of
In the boards copper cladding is done by pasting thin copper foil on the
boards during curing. The copper on the board is about 2 mm thick and
weights an ounce per square foot.
The process of making a Printed Circuit for any application has the
following steps (opted professionally):
for
comactness,
simplicity
of
servicing
and
ease
of
curing does this. Boards are prepared in sizes of 1 to 5 metre wide and
upto 2 metres long. The thickness of the boards is 1.42 to 1.8mm. The
copper on the boards is about 0.2 thick and weighs and ounce per
square foot.
CAPACITORS
To understand the concept of capacitance, consider a pair of metal plates which all
are placed near to each other without touching. If a battery is connected to these plates
the positive pole to one and the negative pole to the other, electrons from the battery will
be attracted from the plate connected to the positive terminal of the battery. If the battery
is then disconnected, one plate will be left with an excess of electrons, the other with a
shortage, and a potential or voltage difference will exists between them. These plates will
be acting as capacitors. Capacitors are of two types: - (1) fixed type like ceramic,
polyester, electrolytic capacitors-these names refer to the
material they are made of aluminium foil. (2) Variable type like gang condenser in radio
or trimmer. In fixed type capacitors, it has two leads and its value is written over its body
and variable type has three leads. Unit of measurement of a capacitor is farad denoted by
the symbol F. It is a very big unit of capacitance. Small unit capacitor are pico-farad
denoted by pf (Ipf=1/1000,000,000,000 f) Above all, in case of electrolytic capacitors, it's
two terminal are marked as (-) and (+) so check it while using capacitors in the circuit in
right direction. Mistake can destroy the capacitor or entire circuit in operational.
RESISTANCE
CODE
Black----------------------------------------0
Brown---------------------------------------1
Red------------------------------------------2
Orange-------------------------------------3
Yellow---------------------------------------4
Green---------------------------------------5
Blue-----------------------------------------6
Violet---------------------------------------7
Grey-----------------------------------------8
White---------------------------------------9
The first rings give the first digit. The second ring gives the
second digit. The third ring indicates the number of zeroes to be
placed after the digits. The fourth ring gives tolerance (gold 5%,
silver 10%, No colour 20%).
read upto 10,000, it will have three dials each having ten gaps
i.e. ten resistance coils each of resistance 10. The third dial will
have ten resistances each of 100.
Before developing the final circuits, let us first understand the 3-terminal type
constant voltage regulators. Let us see the schematic in Fig. where 78XX is a 3-terminal
voltage regulator.
Schematic
obtaining low-voltage regulated output using 3-terminal voltage regulators.
for
*
It is highly recommended to use the two capacitors as shown.
Electrically regulator will be at a distance from the rectifier supply.
Thus, a tantalum grade capacitor of 5mf and rated voltage is good.
Electrolytic capacitor is not suitable for it is poor in response to load
transients, which have high frequency components. At the output side
a 0.22mf disc ceramic capacitor is useful to eliminate spurious
oscillations, which the regulator might break into because of its
internal high gain circuitry.
Now let us see that what can be done to get a higher but
constant output voltage. If to the circuit of Fig. resistor RY and zener V z
are added as shown in Fig., the output voltage is now given by
VOUT=VR+VZ + IBIAS RX
VOZ=VR + IBIAS Rx
IBIAS=5mA
55 - 39 - 15
5 x 10-3
VIN - VZ - IBIAS RX
MAX
= 45 + 35 - 5 = 75 VOLTS
This circuit will have an excellent load and line regulation. For
shot-circuit protection, it is recommended to use a fast-blow fuse of
suitable value. Although the regulator has inherent short-circuit
protection, the maximum current differs from device to device.
Adequate heat sink should be used with the regulator.
Schematic for constant high-voltage power supplies providing currents in excess of one ampere
This circuit will show load and live regulation within 1% and will
function properly for VIN-VOUT as low as 4 volt. For short-circuit
protection, a fast blow fuse is recommended as this circuit does not
have inherent short-circuit protection. Adequate heat sink is to be used
for the pass transistors.
For negative voltages, use 79XX series
regulators and ECN055 as the pass transistor. Some advantages of the
circuits described above are: the lowest cost among comparable
performance circuits, ability to work at low input-output differential,
and flexibility in design for various applications.
2.1.1 MICROCONTROLLER:
A microcontroller is a single chip that contains the processor (the CPU), non-volatile
memory for the program (ROM or flash), volatile memory for input and output
(RAM), a clock and an I/O control unit. Also called a "computer on a chip," billions of
microcontroller units (MCUs) are embedded each year in a myriad of products from
toys to appliances to automobiles. For example, a single vehicle can use 70 or more
microcontrollers.
2.1.2
IMPORTANT
FEATURES
APPLICATIONS OF
80C51:
It provides many
single package
functions
AND
etc.)
in
comparators, A/D and D/A converters, RTCs, extra counters and timers, in-circuit
debugging facilities, more interrupt sources, and extra power saving modes.
MEMORY ARCHITECTURE:
The MCS-51 has four distinct types of memory internal RAM, special function
registers, program memory, and external data memory.
Internal RAM (IRAM) is located from address 0 to address 0xFF. IRAM from 0x00 to
0x7F can be accessed directly, and the bytes from 0x20 to 0x2F are also bitaddressable. IRAM from 0x80 to 0xFF must be accessed indirectly, using the @R0 or
@R1 syntax, with the address to access loaded in R0 or R1.
Special function registers (SFR) are located from address 0x80 to 0xFF, and are
accessed directly using the same instructions as for the lower half of IRAM. Some of
the SFR's are also bit-addressable.
Program memory (PMEM, though less common in usage than IRAM and XRAM) is
located starting at address 0. It may be on- or off-chip, depending on the particular
model of chip being used. Program memory is read-only, though some variants of
the 8051 use on-chip flash memory and provide a method of re-programming the
memory in-system or in-application. Aside from storing code, program memory can
also store tables of constants that can be accessed by MOVC A, @DPTR, using the
16-bit special function register DPTR.
External data memory (XRAM) also starts at address 0. It can also be on- or off-chip;
what makes it "external" is that it must be accessed using the MOVX (Move
external) instruction. Many variants of the 8051 include the standard 256 bytes of
IRAM plus a few KB of XRAM on the chip. If more XRAM is required by an application,
the internal XRAM can be disabled, and all MOVX instructions will fetch from the
external bus.
INSTRUCTION SET:
The MCS-51 instruction set offers several addressing modes, including
direct memory, which access the internal RAM or the SFR's, depending on the
address
indirect memory, using R0, R1, or DPTR to hold the memory address. The
instruction used may vary to access internal RAM, external RAM, or program
memory.
Many of the operations allow any addressing mode for the source or the destination,
for example, MOV 020h, 03fh will copy the value in memory location 0x3f in the
internal RAM to the memory location 0x20, also in internal RAM. Because the 8051
is an accumulator-based architecture, all arithmetic operations must use the
accumulator, e.g. ADD A, 020h will add the value in memory location 0x20 in the
internal RAM to the accumulator.
One does not need to master these instructions to program the 8051. With the
availability of good quality C compilers, including open source virtually all programs
can be written with high level language.
2.1.3 P89V51RD2
(8-bit 80C51 5 V low power 64 kB Flash microcontroller with 1 kB RAM)
GENERAL DESCRIPTION:
The P89V51RD2 is an 80C51 microcontroller with 64 kB Flash and 1024 bytes of
data RAM.
A key feature of the P89V51RD2 is its X2 mode option. The design engineer can
choose to run the application with the conventional 80C51 clock rate (12 clocks per
machine cycle) or select the X2 mode (6 clocks per machine cycle) to achieve twice
the throughput at the same clock frequency. Another way to benefit from this
feature is to keep the same performance by reducing the clock frequency by half,
thus dramatically reducing the EMI.
The Flash program memory supports both parallel programming and in serial
In-System Programming (ISP). Parallel programming mode offers gang-programming
at high speed, reducing programming costs and time to market. ISP allows a device
to be reprogrammed in the end product under software control. The capability to
field/update the application firmware makes a wide range of applications possible.
The P89V51RD2 is also In-Application Programmable (IAP), allowing the Flash
Program memory to be reconfigured even while the application is running.
FEATURES:
SYMBOL
PIN
TYPE
DESCRIPTION
P0.0 to P0.7
39 to 32
I/O
PI.0 to P1.7
1 to 8
I/O with
internal pull-up
high by the
internal
pull-ups
when 1s are written
to them and can
be used as inputs in
this state. As inputs,
Port 1 pins that
are externally pulled
LOW will source
current (IIL)
because
of
the
internal
pull-ups.
P1.5, P1.6, P1.7
have
high current drive of
16 mA. Port 1 also
receives the
low-order
address
bytes during the
external host mode
programming
and
verification
P1.0
I/O
P1.1
T2EX: Timer/Counter
2
capture/reload
trigger and
direction control
P1.2
P1.3
I/O
CEX0:
Capture/compare
external I/O for PCA
Module 0.
Each
capture/compare
module connects to a
Port 1 pin
for external I/O.
When not used by
the PCA, this pin can
handle standard I/O.
P1.4
I/O
P1.5
I/O
P1.6
I/O
P1.7
I/0
P2.0 to P2.7
21 to 28
I/O
with internal
pull-up
P3.0 to P3.7
10 to 17
I/O
with internal pullup
current (IIL)
because
of
the
internal pull-ups. Port
3 also receives
some control signals
and a partial of highorder address
bits
during
the
external host mode
programming and
verification.
10
11
P3.2
12
P3.3
13
P3.4
14
P3.5
15
P3.6
16
P3.7
17
----PSEN
29
I/O
P3.0
P3.1
--------Program
Store
Enable: PSEN is the
read strobe for
external
program
memory. When the
device is executing
from
internal
program
memory,
PSEN is inactive
(HIGH). When the
device is executing
code from
external
program
memory, PSEN is
activated twice each
machine
cycle,
except
that
two
PSEN activations are
skipped during each
access to external
data memory. A
forced HIGH-to-LOW
input transition on
the PSEN pin
while the RST input
is continually held
HIGH for more
than 10 machine
cycles will cause the
device to enter
external host mode
programming.
RST
normal
mode.
----
operation
EA
31
External
Access
Enable: EA must be
connected to VSS
in order to enable the
device to fetch code
from the
external
program
memory. EA must be
strapped to VDD
for internal program
execution. However,
Security lock
level 4 will disable
EA, and program
execution is only
possible from internal
program
memory.
The EA pin can
tolerate
a
high
voltage of 12 V.
------PROG/ALE
30
I/O
Address
Latch
Enable: ALE is the
output signal for
latching the low byte
of the address during
an access to
external
memory.
This pin is also the
programming
pulse input (PROG)
for
flash
programming.
Normally the
ALE is emitted at a
constant rate of 16
the crystal
frequencyand can be
used for external
timing and
NC
I/O
No Connect
XTAL1
19
XTAL2
18
Crystal 2: Output
from the inverting
oscillator amplifier.
VDD
40
POWER SUPPLY
VSS
20
GROUND
DRIVING LCD
INTRODUCTION:
The LCD is a dot matrix liquid crystal display that displays alphanumeric,
Kana (Japanese) character and symbols. The built - in controller & driver
LSIs provide convenient connectively between a dot matrix LCD and most 4
or 8 bit microprocessors or microcontrollers. All the functions required for
dot matrix liquid crystal display drive are internally provided. Internal refresh
is provided by the LCD. The CMOS technology makes the device ideal for
FEATURES:
Both display data and character generator RAMs can be read from the
MPU.
OPERATIONAL OVERVIEW:
When the busy flag is HIGH level, it indicates that the controller is in the
internal operation mode and the next instruction will not be accepted. When
R/W is 1 and Rs is 0, the busy flag is output from DB 7. The next instruction
must be written after the busy flag goes low.
The address counter (AC) generates the address for the DD RAM, the CG
RAM and for the cursor display. When an instruction code for DD or CG RAM
address is written to the controller, after deciding whether it is DD RAM or
CG RAM, the address information is transferred to AC. After writing into DD
or CG RAM display data, AC is automatically incremented (or decremented).
The data of AC is output DB0~DB0 when RS is0 and R/W is1.
00
01
02
03
04
05
06
07
The character generator RAM (CG RAM) is the RAM with which the user can
generate character patterns by program. The CG RAM has the capacity to
store 8 kinds of 5 X 7 dots or 4 kinds of 5 X 10 dots. Programming of this
character patterns is explained in CG RAM programming.
01
02
03
04
05
06
07
00 01 02 03 04 05 06 07
The display data RAM (DD RAM) stores display data represented in 8-bit
(hexadecimal) character codes. Its capacity is 80 X 8 bits, or 80 characters.
The display data RAM (DD RAM) that is not used for display can be used as
general data RAM. Depending on the 8-bit character code that is written into
the DD RAM. LCD will select the character pattern either from Character
Generator RAM (CG RAM) or from Character Generator ROM (CG ROM).
00 01 02 03 04 05 -- -- 26 27
1-line Display (N=O)
40 41 42 43 44 45 -- -- 66 67
1
78 79 80
Display position
00 01 02 03 04 -- -- -- 4D 4E 4F
Line-1
DD RAM address
When the display characters are less than 80, the display begins at the
home position. For example, 8 characters X 1 line will be like:
1
00
01
02
03
04
6
05
7
06
8
07
Display position
DD RAM address
When the display shift operation is performed, the DD RAM address moves
as:
40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
00
01
02
03
04
05
06
07
00
01
02
03
04
05
06
07
display)
-- -- 39 40
Display position
41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50
00 01 02 03 04 05 -- -- 26 27
Line-1
DD RAM address
40 41 42 43 44 45 -- -- 66 67
27 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E
Note that the first line end address and the second line start address are not
consecutive. When the capacity is less than 40 X 2, the 2 lines are displayed
40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E
from the home67
position.
5 6
9 10 11 12 13 14 15 16
Display
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
positio
Line-1
DDRAM
40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
Line-2
address
01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10
41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50
shift
Left
27 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E
67 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E
Right shift
display
INSTRUCTION CODE:
The instruction code is a command set through which the LCD is controlled
by the MPU. Prior to internal execution of the instruction code, control
information is temporally stored in the internal resisters of the LCD, to allow
2.
3.
4.
Others.
The busy flag is set to1 while the LCD is internally processing an
instruction. LCD signals that it is ready to accept the instruction by resetting
the Busy flag. It is therefore to be ensured that the instructions are written
to the LCD only while the busy flag is 0. There are two ways of doing this:
1. Read the Busy flag and ensure it is 0 before writing any instruction to
the LCD.
INSTRUCTION TABLE:
Instru
Code
Description
-ction
Execut
e time
(max)
Clear
display
Cursor
at
home
1.64mS
1.64mS
Entry
mode
I/D
ON/OFF
40S
set
Display
character (B).
control
Cursor/
display
40S
S/C R/L
40S
shift
Functio
n set
CGRAM
DL
40S
ACG
40S
address
set
DDRAM
ADD
address
set
40S
Busy
BF
AC
flag/ad
d-ress
read
CGRAM
40S
counter contents.
Write data
/DDRA
40S
CGRAM.
M
write
CGRAM
Read data
/DDRA
CGRAM.
M read
1. CLEAR DISPLAY:
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0
I/D
When this instruction is executed, the LCD display cleared and returned to
its original status if it is shifted. The cursor goes to left edge of the display
(the left end of the first line if 2-line mode). Space code 20 (hexadecimal)
40S
(character pattern for character code 20 is blank pattern) is written into all
DD RAM addresses. Sets DD RAM address 0 in address counter (AC). Sets
I/D = 1 (Increment Mode) of Entry Mode. S of Entry Mode Doesnt change.
2. RETURN HOME:
Code
Higher order bits
* NO effect
The cursor or blink goes to the left edge of the display (to the left end of the
first line in the 2 line display mode). The display returns to its original status
if it was shifted. DD RAM contents do not change. Sets the DD RAM address
0 in address counter.
0
I/D
Code
Higher order bits
I/D: when the I/D is set, the 8-bit character code is written or read to and
from the DD RAM, the cursor shifts to the right by 1 character position (I/D
= 1; increment) or to the left by 1 character position (I/D =0; decrement).
The address is incremented (I/D = 1) or decremented (I/D =0) by 1 at
this time. Even after the character pattern code is written or read to end
from the CG RAM, the address counter (A/C) is incremented (I/D = 1) or
decremented (I/D = 0) by 1.
S: Shift the entire to the right or to the left when s is 1; to the left when I/D
=1 and to the right when I/D = 0. Thus it looks as if the cursor stands still
the display moves. The display does not shift when reading from the DD
RAM when or when writing in to or reading out from the CG RAM when S=0.
0
0
0
0
0
0
0
0
1
0
S/C
1
R/L
D
*
C
*
B
Code
Higher order bits
S/C
R/L
Code
passes the 40th digit of the 1st list. Notice that the 1st and 2nd line displays
will shift at the same time. When the displayed data is shifted repeatedly
each line only moves horizontally. The 2 nd line display does not shift into
the 1st line position.
S/C
R/L
Address counter (AC) contents do not change if the only action performed is
shift display.
6. FUNCTION SET:
0 R/W
0
0
1
A5 DB4
A4 DB3
A3 DB2
A2 DB1
A1 DB0
A0
RS
DB7
DB6
DB5
DL
Code
Higher order bits
0
0
1
B6
N: Sets number of display lines
B5
B4
B3
B2
B1
B0
The 2-line display mode of the LCD is selected when N =1, while the 1-Line
display mode is selected when N = 0
A5
A4
A3
A2
A1
A0
BF
C6
C5
C4
C3
C2
C1
C0
Code
B6
B5
B4
B3
B2
B1
B0
Code
Sets the DD RAM address into the address counter in binary B6 to B0. Data
1
0
D
D
D
D
D
D
D
D
then written or read from the LCD pertains to the DD RAM. However, when
N= 0 (1-line display), B6 to B0 is 00~ 4F (hexa). When N = 1 (2-line
display), B6 to B0 is 00 ~ 27 (hexa) for the first line, and 40~67 (hexa)
for the second line.
BF
C6
C5
C4
C3
C2
C1
C0
Code
Higher order bits
Reads the busy flag (BF) that indicates the system is now internally
1
1
D
D
D
D
D
D
D
D
executing a previously received instruction. BF = 1 indicates that internal
operation is in progress. The next instruction will not be accepted until BF
goes 0. Check the BF status before the next write operation.
At the same time, the value of the address counter expressed in binary C6
toC0 is read. The address counter is used by both CG and DD RAM
addresses, and its value is determined by the previous instruction.
Code
Higher order bits
Code
Higher order bits
Reads binary 8 bit data DDDDDDDD from the CG or DD RAM. The previous
designation determines whether the CG or DD RAM is to be read. Before
entering the read instruction, you must execute either the CG RAM or DD
RAM address set instruction. If you do not, the first read data would be
invalid.
COMPARATOR:
over a wide range of voltages. Operation from split power supplies is also
possible and the low power supply current
drain is independent of the magnitude of the power supply voltage. These
comparators also have a unique characteristic
in that the input common-mode voltage range includes ground, even
though operated from a single power supply
voltage. Application areas include limit comparators, simple analog to
digital converters; pulse, squarewave and time delay generators;wide range
VCO; MOS clock timers; multivibrators and high voltage digital logic gates.
The LM139 series was
designed to directly interface with TTL and CMOS. When operated from
both plus and minus power supplies, they will
directly interface with MOS logic where the low power drain of the LM339
is a distinct advantage over standard
comparators.
Features
Comparator Operation
The following drawing show the two simplest configurations for voltage comparators. The
diagrams below the circuits give the output results in a graphical form.
For these circuits the REFERENCE voltage is fixed at one-half of the supply voltage while the
INPUT voltage is variable from zero to the supply voltage.
In theory the REFERENCE and INPUT voltages can be anywhere between zero and the supply
voltage but there are practical limitations on the actual range depending on the particular device
used.
Current WILL flow through the open collector when the voltage at the
PLUS input is lower than the voltage at the MINUS input.
2.
Current WILL NOT flow through the open collector when the voltage at
the PLUS input is higher than the voltage at the MINUS input.
A mechanical analog of added hysteresis can be found in many toggle switches: As the handle
moves past its center point, a spring in the switch forces the contacts of the switch to open or
close, ensuring that the switch's contacts snap to the ON or OFF position.
The width of the loop outlined by an off-on-off cycle is the input hysteresis voltage.
The hysteresis voltage for most comparators is only a few millivolts and usually only affects
circuits where the input voltage rises or falls very slowly or has voltage spikes known as "noise".
If the comparator is 'ON', the MINUS input voltage needs to drop slightly below the PLUS
input voltage by the hysteresis voltage range before it turns 'OFF'.
The hysteresis voltage range can also be made quite large in order to force the comparator's
output to change as quickly as possible. The FLIP-FLOP circuits shown later on this page make
use of an exaggerated hysteresis to create the memory effect with large input voltage changes
needed to trigger a change in the output.
Window Comparator
circuit as an input. The resistance values are not critical but should be used as a guide. In most
comparator circuits the ratio of the resistances is more important than their actual values.
Photocell Circuits
If higher current loads are to be driven a PNP transistor can be added to the comparators output
this will allow loads of up to 300Ma. to be controlled.
SOFTWARE:
.1 Appendix 1:
How to compile the demo program?