(_______)
____________
(_______)
____________
(_______)
CERTIFICATE
This is to certify that the dissertation work entitled SCADA(SUPERVISORY
CONTROL AND DATA ACQUISTION)FOR REMOTE INDUSTRIAL
PLANT
ORIENTATION
is
the
work
done
by
_________________________________________________________ submitted
in partial fulfillment for the award of BACHELOR OF ENGINEERING (B.E) in
____________________________ Engineering from ___________ College of
Engineering affiliated to _________ University , Hyderabad .
___________________
_____________
(Assistant Professor)
EXTERNAL EXAMINER
ACKNOWLEDGEMENT
The satisfaction and euphoria that accompany the successful completion of any
task would be incomplete without the mentioning of the people whose constant
guidance and encouragement made it possible. We take pleasure in presenting
before you, our project, which is result of studied blend of both research and
knowledge.
We express our earnest gratitude to our internal guide, Assistant Professor
___________, Department of ECE, our project guide, for his constant support,
encouragement and guidance. We are grateful for his cooperation and his valuable
suggestions.
DECLARATION
3
___________
___________
__________
___________
____________
___________
CONTENTS
1. ABSTRACT
2. INTRODUCTION TO EMBEDDED SYSTEMS
PAGE NO.
13
13
4
3. BLOCK DIAGRAM
15
4. HARDWARE REQUIREMENTS
4.1 TRANSFORMERS
17
19
4.3 RECTIFIER
4.4
FILTER
22
4.6 ADC0808
4.7
MAX232
4.8
ULN2003
4.9
RELAY DRIVER
4.12
LED
4.13 IN4007
4.14
RESISTORS
4.15 CAPACITORS
5. SOFTWARE REQUIREMENTS
5.1 IDE
57
57
58
59
59
60
61
5
61
61
62
62
63
63
5.15 EMBEDDED C
64
6. SCHEMATIC DIAGRAM
66
6.1 DESCRIPTION
67
7. LAYOUT DIAGRAM
71
8. BILL OF MATERIALS
72
9. CODING
75
9.1 COMPILER
76
84
88
88
89
11. RESULTS
69
12. CONCLUSION
93
13. BIBLIOGRAPHY
94
LIST OF FIGURES
PAGE NO.
17
20
OF VOLTAGE REGULATOR
4.5 BLOCK DIAGRAM OF AT89S52
4.5(b) PIN DIAGRAM OF AT89S52
21
24
25
29
30
4.6 ADC0808
31
37
38
39
42
7. PROJECT LAYOUT
8.1
CONTINUITY TEST
64
8.2
POWER ON TEST
66
ABSTRACT
low
limit
the
alarm
will
be
turned
on.
Hardware
The complete hardware schematic for the SCADA board consists of microcontroller 89C51, the
temperature sensor (LM335), ADC 0808, relay driver ULN 2003, relays and Max232 for the
serial interface. The on chip firmware controls reading the ADC converter, receives commands
from PC and sends the reading to PC. We use LM335 temperature sensor. It can measure the
temperature using two wires remotely. The chip produces an output signal that is proportional to
the Celsius temperature scale. The trimmer POT is used to calibrate the correct output voltage at
known temperature, for example 2.98V @ 25 C.
and hardware layout designed for the specific purpose. Examples Small controllers and devices
in our everyday life like Washing Machine, Microwave Ovens, where they are embedded in.
Build
Operating
Digital
Integrated Download
circuit
Systems
Electronic design
design
Debug
Analog
Tools
Electronic design
Computer
Embedded Architecture
Sensors and Systems
measurements
Software
Engineering
Electric motors
and actuatorsControl
Data
Engineering
Communication
Har
Sy
Sy
EMBEDDED SYSTEM DESIGN
dw CYCLE
ste
ste
are
m
m
Rapi
-inDef
Tes
d
the
init
tin
Prot
ion
g
otypi
Lo
Targ
ng
op
eting
Tes
tin
g
11
An embedded system is any computer system hidden inside a product other than a
computer.
They will encounter a number of difficulties when writing embedded system software in
addition to those we encounter when we write applications.
Throughput Our system may need to handle a lot of data in a short period of
time.
Memory space Memory is limited on embedded systems, and you must make
the software and the data fit into whatever memory exists.
Program installation you will need special tools to get your software into
embedded systems.
Power consumption Portable systems must run on battery power, and the
software in these systems must conserve power.
Processor hogs computing that requires large amounts of CPU time can
complicate the response problem.
Cost Reducing the cost of the hardware is a concern in many embedded system
projects; software often operates on hardware that is barely adequate for the job.
APPLICATIONS
1) Military and aerospace embedded software applications
12
2 ) C o mmu n i ca t io n App l ic a t io ns
3 ) I nd us t r ia l au to ma t io n a nd p ro ce s s c on tr o l s o ft w a re
4) Mastering the complexity of applications.
5) Reduction of product design time.
6) Real time processing of ever increasing amounts of data.
7) Intelligent, autonomous sensors.
CLASSIFICATION
RTS CLASSIFICATION
"Soft" real-time systems have reduced constrains on "lateness" but still must operate very
quickly and repeatable.
Example: Railway reservation system takes a few extra seconds the data remains valid.
13
3. BLOCK DIAGRAM
14
15
4. HARDWARE REQUIREMENTS
HARDWARE COMPONENTS:
3. FILTER
4. RECTIFIER
5. MICROCONTROLLER (AT89S52/AT89C51)
6. ADC0808
7. MAX232
8.
RELAYS
9. DB9 CONNECTOR
10. LM35 TEMPERATURE SENSOR
11. ULN2003
12. LED
13. IN4007
14. RESISTORS
15. CAPACITORS
4.1 TRANSFORMER
Transformers convert AC electricity from one voltage to another with a little loss of power.
Step-up transformers increase voltage, step-down transformers reduce voltage. Most power
supplies use a step-down transformer to reduce the dangerously high voltage to a safer low
voltage.
17
18
19
Description
The LM78XX/LM78XXA 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 shutdown 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.
20
4.3 RECTIFIER
A rectifier is an electrical device that converts alternating current (AC), which
periodically reverses direction, to direct current (DC), current that flows in only one direction, a
process known as rectification. Rectifiers have many uses including as components of power
supplies and as detectors of radio signals. Rectifiers may be made of solid state diodes, vacuum
tube diodes, mercury arc valves, and other components. The output from the transformer is fed to
the rectifier. It converts A.C. into pulsating D.C. The rectifier may be a half wave or a full wave
rectifier. In this project, a bridge rectifier is used because of its merits like good stability and full
wave rectification. In positive half cycle only two diodes( 1 set of parallel diodes) will conduct,
in negative half cycle remaining two diodes will conduct and they will conduct only in forward
bias only.
22
4.4 FILTER
Capacitive filter is used in this project. It removes the ripples from the output of rectifier
and smoothens the D.C. Output received from this filter is constant until the mains voltage and
load is maintained constant. However, if either of the two is varied, D.C. voltage received at this
point changes. Therefore a regulator is applied at the output stage.
The simple capacitor filter is the most basic type of power supply filter. The use of this
filter is very limited. It is sometimes used on extremely high-voltage, low-current power supplies
for cathode-ray and similar electron tubes that require very little load current from the supply.
This filter is also used in circuits where the power-supply ripple frequency is not critical and can
be relatively high. Below figure can show how the capacitor charges and discharges.
23
Features:
Compatible with MCS-51 Products
8K Bytes of In-System Programmable (ISP) Flash Memory
Endurance: 10,000 Write/Erase Cycles
4.0V to 5.5V Operating Range
Fully Static Operation: 0 Hz to 33 MHz
Three-level Program Memory Lock
256 x 8-bit Internal RAM
32 Programmable I/O Lines
Three 16-bit Timer/Counters
Eight Interrupt Sources
Full Duplex UART Serial Channel
Low-power Idle and Power-down Modes
Interrupt Recovery from Power-down Mode
Watchdog Timer
Dual Data Pointer
Power-off Flag
Fast Programming Time
Flexible ISP Programming (Byte and Page Mode)
Green (Pb/Halide-free) Packaging Option
25
configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2
trigger input (P1.1/T2EX).
Port 2:
Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output buffers
can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the
internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled
low will source current (IIL) because of the internal pull-ups. Port 2 emits the high-order address
byte during fetches from external program memory and during accesses to external data memory
that use 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pullups when emitting 1s. During accesses to external data memory that use 8-bit addresses (MOVX
@ RI), Port 2 emits the contents of the P2 Special Function Register.
Port 3:
Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output buffers
can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the
internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled
low will source current (IIL) because of the pull-ups.
RST:
Reset input. A high on this pin for two machine cycles while the oscillator is running
resets the device. This pin drives high for 98 oscillator periods after the Watchdog times out. The
DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state
of bit DISRTO, the RESET HIGH out feature is enabled.
ALE/PROG:
Address Latch Enable (ALE) is an output pulse for latching the low byte of the address
during accesses to external memory. This pin is also the program pulse input (PROG) during
Flash programming.
In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and
may be used for external timing or clocking purposes. Note, however, that one ALE pulse is
skipped during each access to external data memory.
PSEN:
28
Program Store Enable (PSEN) is the read strobe to external program memory. When the
AT89S52 is executing code from external program memory, PSEN is activated twice each
machine cycle, except that two PSEN activations are skipped during each access to external data
memory.
EA/VPP:
External Access Enable. EA must be strapped to GND in order to enable the device to
fetch code from external program memory locations starting at 0000H up to FFFFH. Note,
however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be
strapped to VCC for internal program executions. This pin also receives the 12-volt
programming enable voltage (VPP) during Flash programming.
XTAL1:
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2:
Output from the inverting oscillator amplifier
Oscillator Characteristics:
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier
which can be configured for use as an on-chip oscillator, as shown in Figure 1. Either a quartz
crystal or ceramic resonator may be used. To drive the device from an external clock source,
XTAL2 should be left unconnected while XTAL1 is driven as shown in Figure 6.2. There are no
requirements on the duty cycle of the external clock signal, since the input to the internal
clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high
and low time specifications must be observed.
29
Idle Mode
In idle mode, the CPU puts itself to sleep while all the on chip peripherals remain active.
The mode is invoked by software. The content of the on-chip RAM and all the special functions
registers remain unchanged during this mode. The idle mode can be terminated by any enabled
interrupt or by a hardware reset.
Power down Mode
In the power down mode the oscillator is stopped, and the instruction that invokes power
down is the last instruction executed. The on-chip RAM and Special Function Registers retain
their values until the power down mode is terminated. The only exit from power down is a
hardware reset. Reset redefines the SFRs but does not change the on-chip RAM. The reset should
not be activated before VCC is restored to its normal operating level and must be held active
long enough to allow the oscillator to restart and stabilize.
30
4.6 ADC0808
Features
31
Key Specifications
Resolution 8 Bits
Total Unadjusted Error 12 LSB and 1 LSB
Single Supply 5 VDC
Low Power 15 mW
Conversion Time 100 s
The ADC0808, ADC0809 data acquisition component is a monolithic CMOS device with
in100 s when using a 640 kHz clock, but can convert a single input in as little as 50 s.
executed 8 times per conversion, once every 8 clock periods, yielding a total conversion time of
64 clock periods.
When the conversion cycle is complete the resulting data is loaded into the TRI-STATE
output latch. The data in the output latch can then be read by the host system any time before the
end of the next conversion. The TRI-STATE capability of the latch allows easy interface to bus
oriented systems. The operation of these converters by a microprocessor or some control logic is
very simple. The controlling device first selects the desired input channel. To do this, a 3-bit
channel address is placed on the A, B, C input pins; and the ALE input is pulsed positively,
clocking the address into the multiplexer address register. To begin the conversion, the START
pin is pulsed. On the rising edge of this pulse the internal registers are cleared and on the falling
edge the start conversion initiated. There are 8 clock periods per approximation. Even though
there is no conversion in progress the ADC0808/ADC0809 is still internally cycling through
these 8 clock periods. A start pulse can occur any time during this cycle but the conversion will
not actually begin until the converter internally cycles to the beginning of the next 8 clock period
sequence.
As long as the start pin is held high no conversion begins, but when the start pin is taken
low the conversion will start within 8 clock periods. The EOC output is triggered on the rising
edge of the start pulse. It, too, is controlled by the 8 clock period cycle, so it will go low within 8
clock periods of the rising edge of the start pulse. One can see that it is entirely possible for EOC
to go low before the conversion starts internally, but this is not important, since the positive
transition of EOC, which occurs at the end of a conversion, is what the control logic is looking
for. Once EOC does go high this signals the interface logic that the data resulting from the
conversion is ready to be read. The output enable (OE) is then raised high. This enables the TRISTATE outputs, allowing the data to be read.
35
The MAX232 is an integrated circuit that converts signals from an RS-232 serial port to
signals suitable for use in TTL compatible digital logic circuits. The MAX232 is a dual
driver/receiver and typically converts the RX, TX, CTS and RTS signals.
The drivers provide RS-232 voltage level outputs (approx. 7.5 V) from a single + 5 V
supply via on-chip charge pumps and external capacitors. This makes it useful for implementing
RS-232 in devices that otherwise do not need any voltages outside the 0 V to + 5 V range, as
power supply design does not need to be made more complicated just for driving the RS-232 in
this case. The receivers reduce RS-232 inputs (which may be as high as 25 V), to standard 5 V
TTL levels. These receivers have a typical threshold of 1.3 V, and a typical hysteresis of 0.5 V.
The later MAX232A is backwards compatible with the original MAX232 but may
operate at higher baud rates and can use smaller external capacitors (0.1 F) in place of the
1.0 F capacitors used with the original device. The newer MAX3232 is also backwards
compatible, but operates at a broader voltage range, from 3 to 5.5V.
Voltage levels:
It is helpful to understand what occurs to the voltage levels. When a MAX232 IC
receives a TTL level to convert, it changes a TTL Logic 0 to between +3 and +15V, and changes
TTL Logic 1 to between -3 to -15V, and vice versa for converting from RS232 to TTL.
This can be confusing when you realize that the RS232 Data Transmission voltages at a
certain logic state are opposite from the RS232 Control Line voltages at the same logic state. To
clarify the matter, see the table below. For more information see RS-232 Voltage Levels.
36
37
Pin Description:
38
Application:
The MAX232 has two receivers (converts from RS-232 to TTL voltage levels) and two
drivers (converts from TTL logic to RS-232 voltage levels). This means only two of the RS-232
signals can be converted in each direction.
TX and RX
39
There are not enough drivers/receivers in the MAX232 to also connect the DTR, DSR, and
DCD signals. Usually these signals can be omitted when e.g. communicating with a PC's serial
interface. If the DTE really requires these signals either a second MAX232 is needed, or some
other IC from the MAX232 family can be used.
The DB9 (originally DE-9) connector is an analog 9-pin plug of the D-Sub miniature connector
family (D-Sub or Sub-D). The DB9 connector is mainly used for serial connections, allowing for
the asynchronous transmission of data as provided for by standard RS-232 (RS-232C).
Pins:
40
This is a common connector used in many computer, audio/video, and data applications.
The official name is D-sub miniature, but many people call it D-sub or just DB. The
connector gets its name from its trapezoidal shape that resembles the letter D. Most DB
connectors have two rows of pins. Common types of D-sub connectors are DB9 and DB25, used
on PCs for serial and parallel ports.
One special type of D-sub connectors is the High-Density DB style, which looks just like
a regular DB connector, only with pins that are slightly smaller and placed closer together. This
is typically referred to as an HD connector. HD connectors often have three rows of pins
instead of two. The most common HD connector is the HD15, which is found on PC video cards
and monitors. DB- and HD-connectors use thumbscrews to secure the connector in place.
Another type of D-sub is the MD, or Micro DB connector. This connector is slimmer than
a standard D-sub, with pins even smaller than the ones used on HD connectors. The MD is also
commonly called a half-pitch DB connector. These are often used in SCSI applications, and
the most popular types are the MD50 and MD68 connections. MD-connectors can use latch clips
or thumbscrews as anchoring mechanisms.
41
D-sub connectors are usually described by the total number of pins that they can hold. In
some cases, a DB25 connector may only have 4 or 5 pins loaded into it; however, it is still called
a DB25 connector and not a DB4 or DB5. Another example is the HD15 connector used
by monitorsmost monitor cables only are loaded with 14 pins, but it is still called an HD15
connector.
4.9 ULN2003
RELAY DRIVER:
ULN2003 is a high voltage and high current Darlington transistor array.
DESCRIPTION:
42
The ULN2003 is a monolithic high voltage and high current Darlington transistor arrays.
It consists of seven NPN Darlington pairs that feature high-voltage outputs with commoncathode Clamp diode for switching inductive loads. The collector-current rating of a single
Darlington pair is 500mA. The Darlington pairs may be paralleled for higher current capability.
Applications include relay drivers, hammer drivers, lamp drivers, display drivers (LED gas
discharge), line drivers, and logic buffers.
The ULN2003 has a 2.7kW series base resistor for each Darlington pair for operation
directly with TTL or 5V CMOS devices.
Pin no.:16
Temperature, Operating Range:-20C to +85C
Transistor Polarity: NPN
Transistors, No. of:7
Case Style:DIP-16
Temp, Op. Min:-20C
Temp, Op. Max:85C
Base Number:2003
Channels, No. of:7
Current, Output Max:500mA
Device Marking:ULN2003A
IC Generic Number:2003
Input Type: TTL, CMOS 5V
Logic Function Number:2003
Output Type: Open Collector
43
PIN Diagram:
44
45
Darlington pairs are back to back connection of two transistors with some source resistors and
when they are arranged as shown in the circuit they are used to amplify weak signals. The
amount by which the weak signal is amplified is called the GAIN. .
FEATURES OF DRIVER:
Figure shows the Darlington pair connection of transistor. The circuit above is a
Darlington Pair driver. The first transistors emitter feeds into the second transistors base and
as a result the input signal is amplified by the time it reaches the output. The important point to
remember is that the Darlington Pair is made up of two transistors
FEATURES
46
4.10 RELAY
A relay is an electrically operated switch. Many relays use an electromagnet to operate a
switching mechanism mechanically, but other operating principles are also used. Relays are used
where it is necessary to control a circuit by a low-power signal (with complete electrical isolation
between control and controlled circuits), or where several circuits must be controlled by one
signal.
A relay is an electrically operated switch. Current flowing through the coil of the relay
creates a magnetic field which attracts a lever and changes the switch contacts. The coil current
can be on or off so relays have two switch positions and most have double throw (changeover)
switch contacts as shown in the diagram.
47
Relays allow one circuit to switch a second circuit which can be completely separate
from the first. For example a low voltage battery circuit can use a relay to switch a 230V AC
mains circuit. There is no electrical connection inside the relay between the two circuits; the link
is magnetic and mechanical.
The coil of a relay passes a relatively large current, typically 30mA for a 12V relay, but it
can be as much as 100mA for relays designed to operate from lower voltages. Most ICs (chips)
cannot provide this current and a transistor is usually used to amplify the small IC current to the
larger value required for the relay coil. The maximum output current for the popular 555 timer IC
is 200mA so these devices can supply relay coils directly without amplification.
Relays are usually SPDT or DPDT but they can have many more sets of switch contacts,
for example relays with 4 sets of changeover contacts are readily available. For further
information about switch contacts and the terms used to describe them please see the page on
switches.
48
Most relays are designed for PCB mounting but you can solder wires directly to the pins
providing you take care to avoid melting the plastic case of the relay.
The supplier's catalogue should show you the relay's connections. The coil will be
obvious and it may be connected either way round. Relay coils produce brief high voltage
'spikes' when they are switched off and this can destroy transistors and ICs in the circuit. To
prevent damage you must connect a protection diode across the relay coil.
The figure shows a relay with its coil and switch contacts. You can see a lever on the left
being attracted by magnetism when the coil is switched on. This lever moves the switch contacts.
49
There is one set of contacts (SPDT) in the foreground and another behind them, making
the relay DPDT.
The relay's switch connections are usually labelled COM, NC and NO:
COM = Common, always connect to this; it is the moving part of the switch.
NC = Normally Closed, COM is connected to this when the relay coil is off.
NO = Normally Open, COM is connected to this when the relay coil is on.
50
Applications of relays
Relays are used to and for:
Detect and isolate faults on transmission and distribution lines by opening and closing
circuit breakers.
Time delay functions. Relays can be modified to delay opening or delay closing a set of
contacts. A very short (a fraction of a second) delay would use a copper disk between the
armature and moving blade assembly. Current flowing in the disk maintains magnetic field
for a short time, lengthening release time. For a slightly longer (up to a minute) delay, a
dashpot is used. A dashpot is a piston filled with fluid that is allowed to escape slowly. The
time period can be varied by increasing or decreasing the flow rate. For longer time
periods, a mechanical clockwork timer is installed.
n
n
n
n
n
n
n
n
n
n
n
The LM35 series are precision integrated-circuit temperature sensors, whose output
51
voltage is linearly proportional to the Celsius (Centigrade) temperature. The LM35 thus has
an advantage over linear temperature sensors calibrated in Kelvin, as the user is not
required
to
subtract
Centigrade scaling. The LM35 does not require any external calibration or trimming to
provide typical accuracies of 14C at room temperature and 34C over a full 55 to
+150C temperature range. Low cost is assured by trimming and calibration at the wafer level.
The LM35s low output impedance, linear output, and precise inherent calibration make interfacing to
readout or control circuitry especially easy. It can be used with single power supplies, or
with plus and minus supplies. As it draws only 60 A from its supply, it has very low selfheating, less than 0.1C in still air. The LM35 is rated to operate over a 55 to +150C
temperature range, while the LM35C is rated for a 40 to +110C range (10 with
improved accuracy). The LM35 series is available packaged in hermetic TO-46 transistor
packages, while the LM35C, LM35CA, and LM35D are also available in the plastic
TO-92 transistor package. The LM35D is also avail- able in an 8-lead surface mount small
outline package and a plastic TO-220 package.
The LM35 can be applied easily in the same way as other integrated circuit
temperature sensors. It can be glued or cemented to a surface and its
principal thermal path to carry heat into the device, so its temperature might be
4.12 LED
A light-emitting diode (LED) is a semiconductor light source. LEDs are used as indicator
lamps in many devices, and are increasingly used for lighting. When a light-emitting diode is
forward biased (switched on), electrons are able to recombine with 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. 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.
53
Types of LEDS
54
White LEDS
Light Emitting Diodes (LED) have recently become available that are both white and
bright, so bright that they seriously compete with incandescent lamps in lighting applications.
They are still pretty expensive as compared to a GOW lamp but draw much less current and
project a fairly well focused beam.
When run within their ratings, they are more reliable than lamps as well. Red LEDs are
now being used in automotive and truck tail lights and in red traffic signal lights. You will be
able to detect them because they look like an array of point sources and they go on and off
instantly as
compared
to
conventional
incandescent
lamps.
55
There are two primary ways of producing high intensity white-light using LEDs. One is
to use individual LEDs that emit three primary coloursred, green, and blueand then mix all
the colours to form white light. The other is to use a phosphor material to convert
monochromatic light from a blue or UV LED to broad-spectrum white light, much in the same
way a fluorescent light bulb works. Due to metamerism, it is possible to have quite different
spectra that appear white.
4.13 IN4007
Diodes are used to convert AC into DC these are used as half wave rectifier or full wave
rectifier. Three points must he kept in mind while using any type of diode.
1. Maximum forward current capacity
2. Maximum reverse voltage capacity
3. Maximum forward voltage capacity
Diodes of number IN4001, IN4002, IN4003, IN4004, IN4005, IN4006 and IN4007 have
maximum reverse bias voltage capacity of 50V and maximum forward current capacity
of 1 Amp.
Diode of same capacities can be used in place of one another. Besides this diode of more
capacity can be used in place of diode of low capacity but diode of low capacity cannot
56
be used in place of diode of high capacity. For example, in place of IN4002; IN4001 or
IN4007 can be used but IN4001 or IN4002 cannot be used in place of IN4007.The diode
BY125made by company BEL is equivalent of diode from IN4001 to IN4003. BY 126 is
equivalent to diodes IN4004 to 4006 and BY 127 is equivalent to diode IN4007.
PN JUNCTION OPERATION
Now that you are familiar with P- and N-type materials, how these materials are joined
together to form a diode, and the function of the diode, let us continue our discussion with the
operation of the PN junction. But before we can understand how the PN junction works, we
must first consider current flow in the materials that make up the junction and what happens
initially within the junction when these two materials are joined together.
the crystal and flow into the positive terminal of the battery. As an electron leaves the crystal,
an electron from the negative terminal of the battery will enter the crystal, thus completing the
current path. Therefore, the majority current carriers in the N-type material (electrons) are
repelled by the negative side of the battery and move through the crystal toward the positive
side of the battery.
4.14 RESISTORS
A resistor is a two-terminal electronic component designed to oppose an electric current by
producing a voltage drop between its terminals in proportion to the current, that is, in accordance
with Ohm's law:
V = IR
Resistors are used as part of electrical networks and electronic circuits. They are extremely
commonplace in most electronic equipment. Practical resistors can be made of various
compounds and films, as well as resistance wire (wire made of a high-resistivity alloy, such as
nickel/chrome).
The primary characteristics of resistors are their resistance and the power they can
dissipate. Other characteristics include temperature coefficient, noise, and inductance. Less wellknown 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 depends
upon the materials constituting the resistor as well as its physical dimensions; it's determined by
design.
58
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.
Resistors are common 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 high-resistivity alloy, such as nickelchrome). Resistors are also implemented within integrated circuits, particularly analog devices,
and can also be integrated into hybrid and printed circuits.
The electrical functionality of a resistor is specified by its resistance: common
commercial resistors are manufactured over a range of more than 9 orders of magnitude. When
specifying that resistance in an electronic design, the required precision of the resistance may
require attention to the manufacturing tolerance of the chosen resistor, according to its specific
application. The temperature coefficient of the resistance may also be of concern in some
precision applications. Practical resistors are also specified as having a maximum power rating
which must exceed the anticipated power dissipation of that resistor in a particular circuit: this is
59
mainly of concern in power electronics applications. Resistors with higher power ratings are
physically larger and may require heat sinking. In a high voltage circuit, attention must
sometimes be paid to the rated maximum working voltage of the resistor.
The series inductance of a practical resistor causes its behavior to depart from ohms law;
this specification can be important in some high-frequency applications for smaller values of
resistance. In a low-noise amplifier or pre-amp the noise characteristics of a resistor may be an
issue. The unwanted inductance, excess noise, and temperature coefficient are mainly dependent
on the technology used in manufacturing the resistor. They are not normally specified
individually for a particular family of resistors manufactured using a particular technology. A
family of discrete resistors is also characterized according to its form factor, that is, the size of
the device and position of its leads (or terminals) which is relevant in the practical manufacturing
of circuits using them.
Units
The ohm (symbol: ) is the SI unit of electrical resistance, named after Georg Simon
Ohm. An ohm is equivalent to a volt per ampere. Since resistors are specified and manufactured
over a very large range of values, the derived units of milliohm (1 m = 103 ), kilohm (1 k =
103 ), and megohm (1 M = 106 ) are also in common usage.
The reciprocal of resistance R is called conductance G = 1/R and is measured in Siemens
(SI unit), sometimes referred to as a mho. Thus a Siemens is the reciprocal of an ohm: S = 1.
Although the concept of conductance is often used in circuit analysis, practical resistors are
always specified in terms of their resistance (ohms) rather than conductance.
VARIABLE RESISTORS
Adjustable resistors
A resistor may have one or more fixed tapping points so that the resistance can be
changed by moving the connecting wires to different terminals. Some wire wound power
resistors have a tapping point that can slide along the resistance element, allowing a larger or
smaller part of the resistance to be used.
60
Potentiometer
A potentiometer is a manually adjustable resistor. The way this device works is relatively simple.
One terminal of the potentiometer is connected to a power source. Another is hooked up to ground (a
point with no voltage or resistance and which serves as a neutral reference point), while the third
terminal runs across a strip of resistive material. This resistive strip generally has a low resistance at
one end; its resistance gradually increases to a maximum resistance at the other end. The third terminal
serves as the connection between the power source and ground, and is usually interfaced to the user by
means of a knob or lever. The user can adjust the position of the third terminal along the resistive strip
in order to manually increase or decrease resistance. By controlling resistance, a potentiometer can
determine how much current flow through a circuit. When used to regulate current, the potentiometer
is limited by the maximum resistivity of the strip.
The power of this simple device is not to be underestimated. In most analog devices, a
potentiometer is what establishes the levels of output. In a loud speaker, for example, a potentiometer
directly adjusts volume; in a television monitor, it controls brightness.
A potentiometer can also be used to control the potential difference, or voltage, across a circuit.
The setup involved in utilizing a potentiometer for this purpose is a little bit more complicated. It
involves two circuits: the first circuit consists of a cell and a resistor. At one end, the cell is connected
in series to the second circuit, and at the other end it is connected to a potentiometer in parallel with
61
the second circuit. The potentiometer in this arrangement drops the voltage by an amount equal to the
ratio between the resistance allowed by the position of the third terminal and the highest possible
resistivity of the strip. In other words, if the knob controlling the resistance is positioned at the exact
halfway point on the resistive strip, then the output voltage will drop by exactly fifty percent, no
matter how high the potentiometer's input voltage. Unlike with current regulation, voltage regulation is
not limited by the maximum resistivity of the strip
4.15 CAPACITORS
62
A capacitor (formerly known as condenser) is a device for storing electric charge. The
forms of practical capacitors vary widely, but all contain at least two conductors separated by a
non-conductor. Capacitors used as parts of electrical systems, for example, consist of metal foils
separated by a layer of insulating film.
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.
A capacitor 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.
The capacitance 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 undesired inductance and resistance.
63
Theory of operation
Capacitance
64
The capacitor is a reasonably general model for electric fields within electric circuits. An ideal
capacitor is wholly characterized by a constant capacitance C, defined as the ratio of charge Q
on each conductor to the voltage V between them:
Sometimes charge build-up affects the capacitor mechanically, causing its capacitance to vary. In
this case, capacitance is defined in terms of incremental changes:
Energy storage
Work must be done by an external influence to "move" charge between the conductors in a
capacitor. When the external influence is removed the charge separation persists in the electric
field and energy is stored to be released when the charge is allowed to return to its equilibrium
position. The work done in establishing the electric field, and hence the amount of energy stored,
is given by:
Current-voltage relation
The current i(t) through any component in an electric circuit is defined as the rate of flow of a
charge q(t) passing through it, but actual charges, electrons, cannot pass through the dielectric
layer of a capacitor, rather an electron accumulates on the negative plate for each one that leaves
the positive plate, resulting in an electron depletion and consequent positive charge on one
electrode that is equal and opposite to the accumulated negative charge on the other. Thus the
charge on the electrodes is equal to the integral of the current as well as proportional to the
voltage as discussed above. As with any ant derivative, a constant of integration is added to
represent the initial voltage v (t0). This is the integral form of the capacitor equation,
65
.
Taking the derivative of this, and multiplying by C, yields the derivative form,
.
The dual of the capacitor is the inductor, which stores energy in the magnetic field rather than the
electric field. Its current-voltage relation is obtained by exchanging current and voltage in the
capacitor equations and replacing C with the inductance L.
DC circuits
RC circuit
66
At t = 0, the voltage across the capacitor is zero and the voltage across the resistor is V0. The
initial current is then i (0) =V0 /R. With this assumption, the differential equation yields
where j is the imaginary unit and is the angular velocity of the sinusoidal signal. The - j phase
indicates that the AC voltage V = Z I lags the AC current by 90: the positive current phase
corresponds to increasing voltage as the capacitor charges; zero current corresponds to
instantaneous constant voltage, etc.
67
Note that impedance decreases with increasing capacitance and increasing frequency. This
implies that a higher-frequency signal or a larger capacitor results in a lower voltage amplitude
per current amplitudean AC "short circuit" or AC coupling. Conversely, for very low
frequencies, the reactance will be high, so that a capacitor is nearly an open circuit in AC
analysisthose frequencies have been "filtered out".
Capacitors are different from resistors and inductors in that the impedance is inversely
proportional to the defining characteristic, i.e. capacitance.
Parallel plate model
Dielectric is placed between two conducting plates, each of area A and with a separation of d.
The simplest capacitor consists of two parallel conductive plates separated by a dielectric with
permittivity (such as air). The model may also be used to make qualitative predictions for other
device geometries. The plates are considered to extend uniformly over an area A and a charge
density = Q/A exists on their surface. Assuming that the width of the plates is much greater
than their separation d, the electric field near the centre of the device will be uniform with the
magnitude E = /. The voltage is defined as the line integral of the electric field between the
plates
Solving this for C = Q/V reveals that capacitance increases with area and decreases with
separation
68
.
The capacitance is therefore greatest in devices made from materials with a high permittivity.
69
Capacitors are combined in series to achieve a higher working voltage, for example for
smoothing a high voltage power supply. The voltage ratings, which are based on plate
separation, add up. In such an application, several series connections may in turn be
connected in parallel, forming a matrix. The goal is to maximize the energy storage utility
of each capacitor without overloading it.
Series connection is also used to adapt electrolytic capacitors for AC use.
Non-ideal behaviour
Capacitors deviate from the ideal capacitor equation in a number of ways. Some of these, such as
leakage current and parasitic effects are linear, or can be assumed to be linear, and can be dealt
with by adding virtual components to the equivalent circuit of the capacitor. The usual methods
of network analysis can then be applied. In other cases, such as with breakdown voltage, the
effect is non-linear and normal (i.e., linear) network analysis cannot be used, the effect must be
dealt with separately. There is yet another group, which may be linear but invalidate the
assumption in the analysis that capacitance is a constant. Such an example is temperature
dependence.
Breakdown voltage
Main article: Breakdown voltage
Above a particular electric field, known as the dielectric strength Eds, the dielectric in a capacitor
becomes conductive. The voltage at which this occurs is called the breakdown voltage of the
device, and is given by the product of the dielectric strength and the separation between the
conductors,
Vbd = Edsd
The maximum energy that can be stored safely in a capacitor is limited by the breakdown
voltage. Due to the scaling of capacitance and breakdown voltage with dielectric thickness, all
capacitors made with a particular dielectric have approximately equal maximum energy density,
to the extent that the dielectric dominates their volume.
For air dielectric capacitors the breakdown field strength is of the order 2 to 5 MV/m; for mica
the breakdown is 100 to 300 MV/m, for oil 15 to 25 MV/m, and can be much less when other
materials are used for the dielectric. The dielectric is used in very thin layers and so absolute
breakdown voltage of capacitors is limited. Typical ratings for capacitors used for general
70
electronics applications range from a few volts to 100V or so. As the voltage increases, the
dielectric must be thicker, making high-voltage capacitors larger than those rated for lower
voltages. The breakdown voltage is critically affected by factors such as the geometry of the
capacitor conductive parts; sharp edges or points increase the electric field strength at that point
and can lead to a local breakdown. Once this starts to happen, the breakdown will quickly "track"
through the dielectric till it reaches the opposite plate and cause a short circuit. The usual
breakdown route is that the field strength becomes large enough to pull electrons in the dielectric
from their atoms thus causing conduction. Other scenarios are possible, such as impurities in the
dielectric, and, if the dielectric is of a crystalline nature, imperfections in the crystal structure can
result in an avalanche breakdown as seen in semi-conductor devices. Breakdown voltage is also
affected by pressure, humidity and temperature.
Equivalent circuit
71
As frequency approaches infinity, the capacitive impedance (or reactance) approaches zero and
the ESR becomes significant. As the reactance becomes negligible, power dissipation approaches
PRMS = VRMS /RESR.
Similarly to ESR, the capacitor's leads add equivalent series inductance or ESL to the
component. This is usually significant only at relatively high frequencies. As inductive reactance
is positive and increases with frequency, above a certain frequency capacitance will be canceled
by inductance. High-frequency engineering involves accounting for the inductance of all
connections and components.
If the conductors are separated by a material with a small conductivity rather than a perfect
dielectric, then a small leakage current flows directly between them. The capacitor therefore has
a finite parallel resistance, and slowly discharges over time (time may vary greatly depending on
the capacitor material and quality).
72
5. SOFTWARE REQUIREMENTS
73
as compilers translate source code into object code, which is unique for each type of computer,
many compilers are available for the same language.
Project Manager
Simulator
Debugger
The Keil ARM tool kit includes three main tools, assembler, compiler and linker. An
assembler is used to assemble the ARM assembly program. A compiler is used to compile the C
source code into an object file. A linker is used to create an absolute object module suitable for
our in-circuit emulator.
75
Select Project - Rebuild all target files or Build target.Vision2 compiles, assembles, and
links the files in your project.
Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from the
Device Database.
Select Project - Targets, Groups, Files. Add/Files, select Source Group1, and add the
source files to the project.
Select Project - Options and set the tool options. Note when you select the target device
from the Device Database all special options are set automatically. You typically only
need to configure the memory map of your target hardware. Default memory model
settings are optimal for most applications.
Use the Step toolbar buttons to single-step through your program. You may enter G, main
in the Output Window to execute to the main C function.
Open the Serial Window using the Serial #1 button on the toolbar.
Debug your program using standard options like Step, Go, Break, and so on.
76
77
78
displayed with Debug View Trace Records. To enable the trace history, set Debug
Enable/Disable Trace Recording.
If you select the Disassembly Window as the active window all program step commands
work on CPU instruction level rather than program source lines. You can select a text line and set
or modify code breakpoints using toolbar buttons or the context menu commands.
You may use the dialog Debug Inline Assembly to modify the CPU instructions. That
allows you to correct mistakes or to make temporary changes to the target program you are
debugging. Numerous example programs are included to help you get started with the most
popular embedded 8051 devices.
The Keil Vision Debugger accurately simulates on-chip peripherals (IC, CAN, UART,
SPI, Interrupts, I/O Ports, A/D Converter, D/A Converter, and PWM Modules) of your 8051
device. Simulation helps you understand hardware configurations and avoids time wasted on
setup problems. Additionally, with simulation, you can write and test applications before target
hardware is available.
5.15 EMBEDDED C
Use of embedded processors in passenger cars, mobile phones, medical equipment,
aerospace systems and defense systems is widespread, and even everyday domestic appliances
such as dish washers, televisions, washing machines and video recorders now include at least one
such device.
Because most embedded projects have severe cost constraints, they tend to use low-cost
processors like the 8051 family of devices considered in this book. These popular chips have
very limited resources available most such devices have around 256 bytes (not megabytes!) of
RAM, and the available processor power is around 1000 times less than that of a desktop
processor. As a result, developing embedded software presents significant new challenges, even
for experienced desktop programmers. If you have some programming experience - in C, C++
or Java - then this book and its accompanying CD will help make your move to the embedded
world as quick and painless as possible.
79
6. SCHEMATIC DIAGRAM
80
filtered by an electrolytic capacitor of about 470F to 1000F. The filtered dc being unregulated,
IC LM7805 is used to get 5V DC constant at its pin no 3 irrespective of input DC varying from
9V to 14V. The input dc shall be varying in the event of input ac at 230volts section varies in the
ratio of V1/V2=N1/N2.
The regulated 5V DC is further filtered by a small electrolytic capacitor of 10F for any
noise so generated by the circuit. One LED is connected of this 5V point in series with a resistor
of 330 to the ground i.e., negative voltage to indicate 5V power supply availability. The 12V
point is used for other applications as on when required.
STANDARD CONNECTIONS TO MICRO CONTROLLER
ATMEL series of 8051 family of micro controllers need certain standard connections.
The actual number of the Micro controller could be 89C51 , 89C52, 89S51, 89S52, as
regards to 20 pin configuration a number of 89C2051. The 4 set of I/O ports are used based on
the project requirement. Every micro controller requires a timing reference for its internal
program execution therefore an oscillator needs to be functional with a desired frequency to
obtain the timing reference as t =1/f.
A crystal ranging from 2 to 20 MHz is required to be used at its pin number 18 and 19 for
the oscillator. Typically 11.0592 MHz crystal is used in general for most of the circuits. Crystal
provides the reference frequency only and it is not a crystal oscillator as miss understood by
many but it oscillates at 11.0592MHz. Two small value ceramic capacitors of 33pF each is used
as a standard connection for the crystal as shown in the circuit diagram.
82
RESET
Pin no 9 is provided with an RESET arrangement by a combination of an electrolytic
capacitor and a register forming RC time constant. At the time of switch on, the capacitor gets
charged, after charging it behaves as a full short circuit from the positive to the pin number 9.
After the capacitor gets fully charged the current stops flowing and pin number 9 is pulled down
by a 10k resistor to the ground. This arrangement of reset pin 9 going high initially and then to
logic 0 i.e., low helps the program execution to start from the beginning. In absence of this the
program execution could have taken place habitually anywhere from the program cycle. A
pushbutton switch is connected across the capacitor so that at any given time as desired it can be
pressed that discharges the capacitor and while released the capacitor starts charging again and
then pin number 9 goes to high and then back to low, to enable the program execution from the
beginning. This operation of high to low of the reset pin takes place in fraction of a second as
decided by the time constant R and C.
For example: A 10F capacitor and a 10k resistor would render a 100ms time to pin number 9
from logic high to low, there after the pin number 9 remains low.
ULN2003
ULN2003 is an IC which is used to interface relay with the microcontroller. Since the
output of the micro controller is 5V and is not practicable to operate relay with that voltage.
ULN2003 is nothing but a set of inverters, if logic high is given to the IC as input then its output
will be logic low and vice-versa .Here in ULN2003 pin 1 to 7 are IC inputs and 10 to 16 are IC
outputs.
For example let us operate a load using a relay which is interfaced with microcontroller by
a ULN2003 IC.
Positive voltage i.e., 12V is given to 9th pin of the ULN2003 IC and also to one end of the
relay coil and the GND is connected to 8th pin. When microcontroller gives logic high to the
ULN2003, it gives an inverted output i.e., logic low which is connected to the other end of the
relay coil. Due to this current starts flowing through the coil which makes the relay ON and also
the load is switched ON.
83
84
85
OPERATION
Connections:
The output of the power supply which is 5v is connected to the 40 pin of MC & GND is
connected to its 20 pin. Port 2.0 to 2.7 of MC is connected to output pins 1 to 8 of ADC0808 i.e.,
Analog to Digital Converter. Port 3.0, 3.1 of MC is connected to 12 & 11 pins of Max232. Pin 13
& 14 of Max232 are connected to pin 2 and 9 of DB9 female connector. Port 3.2, 3.3, 3.4 pins of
MC are connected to 10, 6, 7 pins of ADC0808. Port 3.5 pin is connected to 9 th pin of ADC0808
port 3.6 pin is connected to 22 pin of ADC0808 port 1.0, 1.1, 1.2 of MC are connected to pin no
25,24,23 of ADC0808. Port pins 1.3, 1.4, 1.5, 1.6 of microcontroller are connected to pins 1, 2, 3,
4 of ULN2803. Pins 18, 17, 16, 15 of ULN2803 are connected to 4 relays input pins 26, 27, 28
and 1 of ADC0808 are given as to four temperature Sensors LM35. 12 th pin of ADC0808 is
given to 1K preset. 16th pin of ADC0808 is given to GND.
Working:
The idea of this project is to retrieve the real time data from the high temperature
furnaces on computer. Four heat Sensors i.e., LM35 are used to sense the heat and an analog to
digital converter IC ADC0808 is used to convert the data into digital from because
Microcontroller understands digital language. LM35 digital sensor has got 3 pins i.e., VCC,
GND and output pins when LM35 is heated the voltage at output pin increases, it is connected to
the analog to digital convertor IC (ADC). ADC converts this analog data to binary or digital
from. This digital form of data is fed of Microcontroller. Now Microcontroller process this data
and communicates with computer via RS232 communication and simultaneously switches ON &
OFF the relays. Max232 IC is used for RS232 communication and ULN2003 IC is used for relay
control.
Software is used for keeping the real time records of heat sensors in computer. This
software has a provision for eight sensors but only four have been used here.
86
7. PROJECT LAYOUT
8. BILL OF MATERIALS
87
QTY PART-REFS
VALUE
Resistors
1
R1
330R
R2
10k
R3-R6
1k
Capacitors
1
C1
470u
C2,C5-C9
10uF
C3,C4
33p
Integrated Circuits
1
U1
7805 REGULATOR
U2
AT89S52
U3
ADC0808
U4
ULN2803
U5
MAX232
Bases
1
40 pin base
16 pin base
28 pin base
Diodes
4
D1-D4
IN4007
Miscellaneous
1
DB9 FEMALE
L1-L5
CONN-D9F
LED-RED
88
RELAY1-RELAY4
RV1 POT
1k
S1
Push button
1 TRANSFORMER
12V
0-12V
X1
CRYSTAL 11.0592Mhz
LM35
Temperature sensors
MALE BURG
2PIN
FEMALE BURGE
2-PIN
HEAT SINK
PCB CONNECTOR
2-PIN
89
9. CODING
90
91
2.
3.
4.
92
5.
Save the Project by typing suitable project name with no extension in u r own folder
sited in either C:\ or D:\
6.
7.
8.
9.
10.
Then Click on OK
11.
12.
13.
94
14.
Now double click on the Target1, you would get another option Source group 1 as
shown in next page.
15.
Click on the file option from menu bar and select new.
16.
The next screen will be as shown in next page, and just maximize it by double
clicking on its blue boarder.
95
17.
18.
For a program written in Assembly, then save it with extension . asm and for
EMBEDDED C based program save it with extension .C
19.
Now right click on Source group 1 and click on Add files to Group Source.
96
20.
Now you will get another window, on which by default EMBEDDED C files will
appear.
21.
Now select as per your file extension given while saving the file
22.
23.
Now Press function key F7 to compile. Any error will appear if so happen.
97
24.
25.
26.
27.
Now click on the Peripherals from menu bar, and check your required port as shown
in fig below.
98
28.
29.
30.
99
9.2 CODING
/***********************************************************
************************************************************/
#include <reg51.h>
sbit start=P3^3;
sbit end=P3^4;
sbit oe=P3^5;
sbit ale=P3^6;
sbit clock=P3^2;
sbit relay1=P1^3;
sbit relay2=P1^4;
sbit relay3=P1^5;
sbit relay4=P1^6;
unsigned char temp;
unsigned char aray[]={'0','1','2','3','4','5','6','7','8','9'};
void delay()
{
int k,l;
for(k=0;k<40;k++)
100
for(l=0;l<80;l++);
}
void initSerial()
{
TMOD=0x22; // TIMER0 IN MODE2 & TIMER1 IN MODE2
TH1=0xFD;
EA=1;
ES=1;
}
void usDelay(int a)
{
TH0=256-(a/1.085); //LOAD TH0 VALUE TO GET THE DESIRED TIME
TR0=1;
ET0=1;
}
void timerRoutine() interrupt 1
{
clock=~clock; // GENERATE 160Khz CLOCK
}
void sendChar(unsigned char ch)
{
SBUF=ch;
while(!TI);
TI=0;
}
void serialRoutine() interrupt 4
ROUTINE
{
if(RI==1)
{
temp=SBUF;
switch(temp)
{
case('a'):
relay1=1;
// RELAY1 IS ON
break;
case('b'):
relay1=0;
// RELAY1 IS OFF
break;
case('c'):
relay2=1;
// RELAY2 IS ON
break;
102
case('d'):
relay2=0;
// RELAY2 IS OFF
break;
case('e'):
relay3=1;
// RELAY3 IS ON
break;
case('f'):
relay3=0;
// RELAY3 IS OFF
break;
case('g'):
relay4=1;
// RELAY4 IS ON
break;
case('h'):
relay4=0;
// RELAY1 IS OFF
}
RI=0;
}
}
void sendReading(unsigned char val)// TRANSMIT TEMPARATURE TO THE PC
{
unsigned char l,m;
l=val%10;
103
m=(val/10)%10;
sendChar(aray[m]);
sendChar(aray[l]);
sendChar(',');
}
void latch()
{
ale=0;
delay();
ale=1;
}
void startConv()
{
delay();
start=0;
delay();
start=1;
}
void wait()
{
while(end==1);
}
104
void get()
{
delay();
oe=0;
delay();
oe=1;
}
void main()
{
startConv();
wait();
get();
reading=P2;
sendReading(reading);
sensor++;
}
}
10 .HARDWARE TESTING
10.1 CONTINUITY TEST:
In electronics, a continuity test is the checking of an electric circuit to see if current flows
(that it is in fact a complete circuit). A continuity test is performed by placing a small voltage
(wired in series with an LED or noise-producing component such as a piezoelectric speaker)
across the chosen path. If electron flow is inhibited by broken conductors, damaged components,
or excessive resistance, the circuit is "open".
106
Devices that can be used to perform continuity tests include multi meters which measure
current and specialized continuity testers which are cheaper, more basic devices, generally with a
simple light bulb that lights up when current flows.
An important application is the continuity test of a bundle of wires so as to find the two ends
belonging to a particular one of these wires; there will be a negligible resistance between the
"right" ends, and only between the "right" ends.
This test is the performed just after the hardware soldering and configuration has been
completed. This test aims at finding any electrical open paths in the circuit after the soldering.
Many a times, the electrical continuity in the circuit is lost due to improper soldering, wrong and
rough handling of the PCB, improper usage of the soldering iron, component failures and
presence of bugs in the circuit diagram. We use a multi meter to perform this test. We keep the
multi meter in buzzer mode and connect the ground terminal of the multi meter to the ground.
We connect both the terminals across the path that needs to be checked. If there is continuation
then you will hear the beep sound.
107
108
11. RESULTS
109
12 .CONCLUSION
Hence SCADA circuit has been designed and data from different analog loads has been
acquisited and digitally displayed on PC. Several loads have been monitored on PC in real time.
SCADA stands for supervisory control and data acquisition. It generally refers to an
industrial control system: a computer system monitoring and controlling a process. The process
can be industrial, infrastructure or facility-based, which includes those of manufacturing,
production, power generation, fabrication, and refining, and may run in continuous, batch,
repetitive, or discrete modes.
Infrastructure processes may be public or private, and include water treatment and
distribution, wastewater collection and treatment, oil and gas pipelines, electrical power
transmission and distribution, civil defense siren systems, and large communication systems.
110
13. BIBLIOGRAPHY
TEXT BOOKS REFERED:
1. The 8051 Microcontroller and Embedded systems by Muhammad Ali Mazidi and Janice
Gillispie Mazidi , Pearson Education.
2. ATMEL 89S52 Data Sheets.
WEBSITES
www.atmel.com
www.beyondlogic.org
www.wikipedia.org
www.howstuffworks.com
www.alldatasheets.com
111