You are on page 1of 71


Science and technology with all its miraculous advancements has fascinated human life to a great extent that imagining a world without these innovations is hardly possible. While technology is on the raising slope, we should also note the increasing immoral activities. With a technical view, Power Theft is a non ignorable crime that is highly prevalent, and at the same time it directly affects the economy of a nation. This pro!ect is designed to find out such power theft in the normal distribution lines. "ven though there are certain practical problems in implementing this #ind of systems in future there is a scope for development of these types of systems. This pro!ect is using the principle of the differential protection scheme for the identification of the power theft. The differential protection scheme consists of two $Ts %current transformers& connected at both the terminals of the load. 'f there is no fault in the load then the secondary currents of both the $Ts will be same. (sing the same principle one $T is connected at the starting end of the distributor and the remaining other $T is connected to the different loads which are legal. 'f there is no power theft in the line then the vector sum of all the ct)s which are connected to the load will be e*ual to the current in the main ct. if there is a difference then we can ma#e out that it should either be the power theft or a fault in the line. This consists of the following components+ ,& -. dc generation unit+ This unit will give -v dc from the /01v ac, which is used as the internal supply voltage in the circuit.

/& 2easuring circuit+ This section is built with op amps this will get the data from the entire $T and ma#e the vector sum of the entire $T. 3ll the mathematical operation is performed in this section by using 4P 3mps.

5eneration, transmission and distribution of electrical energy involve many losses. Whereas, losses implicated in generation can be technically defined, but transmission and distribution losses cannot be precisely *uantified with the sending end information. 4verall technical losses occur naturally and are caused because of power dissipation in transmission lines, transformers, and other power system components. Technical losses in T67 are computed with the information about total load and the total energy billed .Total loss cannot be precisely computed, but can be estimated from the difference between the total energy supplied to the customers and the total energy billed, losses are caused by the factors external to the power system. 8owadays power theft is happening in most of the countries. This causes ma!or crisis for the government and it tends to increase the demand also. 'n these days when generation of power is not met up to the need of men, there is large number of power thefts from domestic and industrial supply lines. This Pro!ect is to limit such thefts, by letting the "lectricity 9oard to #now the theft. 9y this pro!ect, we introduce a new system of power connection, i.e., instead of driving the power straight away from the transformer, we drive it through a current transformer which is monitored by a 2icrocontroller. The embedded system is in contact with the "lectricity 9oard through wires. :ence when large amount of load is pulled up by a particular household connection, the "9 is #ept #nown about this and it could cut the power supply to that particular :ouse 4n receiving this particular signal, the controller cuts off the connection of current transformer disabling to pull load from the transformer line. When the load of the transformer exceeds, even when all the houses under it were using exact amount of supply allotted to them, the "9 can monitor the theft directly from the transformer line and cut off the transformer supply entirely to catch the convicted behind the theft. Thus, this pro!ect helps the "lectricity 9oard to trace out the power thefts and bloc# them instantly.


The software application and the hardware implementation help the microcontroller %3T;<S-/& to monitor all the parameters continuously and display it on the =$7. The system is totally designed using embedded systems technology. 3T;<S-/ is the microcontroller and forms the heart of the system. The $ontrolling unit has an application program to allow the microcontroller read the incoming data through the current transformers and change the status of the load accordingly. The performance of the design is maintained by controlling unit. 3T;<S-/continuously receives the data from the transformers, after processing in the 37$ section, the data is displayed on the =$7. 9ased on this information 3T;<S-/ controls the loads.


'n view of the proposed thesis wor# explanation of theoretical aspects and algorithms used in this wor# are presented as per the se*uence described below.

$hapter,+ 7escribes a brief review of the ob!ectives and 3im of the pro!ect. $hapter/+ 7iscusses the introduction of embedded systems and specifications and design of embedded systems in detail. $hapter0+ 7escribes the 9loc# diagram of the pro!ect and its description. The construction and description of various modules used for the application are described in detail. $hapter>+ "xplains the Software tools re*uired for the pro!ect, compilation process of the code in detail.

$hapter-+ Wor#ing procedure and schematic diagram of the hardware. $hapter?+ 4verall conclusions of this pro!ect along with wor#ing procedure are given.


3n embedded system can be defined as a computing device that does a specific focused !ob. 3ppliances such as the air conditioner, .$7 player, 7.7 player, printer, fax machine, mobile phone etc. are examples of embedded systems. "ach of these appliances will have a processor and special hardware to meet the specific re*uirement of the application along with the embedded software that is executed by the processor for meeting that specific re*uirement. The embedded software is also called firm ware. The des#top@laptop computer is a general purpose computer. Aou can use it for a variety of applications such as playing games, word processing, accounting, software development and so on. 'n contrast, the software in the embedded systems is always fixed listed below+ B "mbedded systems do a very specific tas#, they cannot be programmed to do different things. . "mbedded systems have very limited resources, particularly the memory. 5enerally, they do not have secondary storage devices such as the $7C42 or the floppy dis#. "mbedded systems have to wor# against some deadlines. 3 specific !ob has to be completed within a specific time. 'n some embedded systems, called real time systems, the deadlines are stringent. 2issing a deadline may cause a catastrophe loss of life or damage to property. "mbedded systems are constrained for power. 3s many embedded systems operate through a battery, the power consumption has to be very low. B Some embedded systems have to operate in extreme environmental conditions such as very high temperatures and humidity.

Appli !"i#$ A%&!' 8early << per cent of the processors manufactured end up in embedded systems. The embedded system mar#et is one of the highest growth areas as these systems are used in very mar#et segment consumer electronics, office automation, industrial automation, biomedical engineering, wireless communication,

data communication, telecommunications, transportation, military and so on.

C#$'()&% !ppli!$ &'+ 3t home we use a number of embedded systems which include digital camera, digital diary, 7.7 player, electronic toys, microwave oven, remote controls for T. and air conditioner, .$4 player, video game consoles, video recorders etc. Today)s high tech car has about /1 embedded systems for transmission control, engine spar# control, air conditioning, navigation etc. "ven wristwatches are now becoming embedded systems. The palmtops are powerful embedded systems using which we can carry out many general purpose tas#s such as playing games and word processing.

O**i & !("#)!"i#$+ The office automation products using em embedded systems are copying machine, fax machine, #ey telephone, modem, printer, scanner etc.

I$,('"%i!l !("#)!"i#$+ Today a lot of industries use embedded systems for process control. These include pharmaceutical, cement, sugar, oil exploration, nuclear energy, electricity generation and transmission. The embedded systems for industrial use are designed to carry out specific tas#s such as monitoring the temperature, pressure, humidity, voltage, current etc., and then ta#e appropriate action based on the monitored levels to control other devices or to send information to a centraliDed monitoring station. 'n haDardous industrial environment, where human presence has to be avoided, robots are used, which are programmed to do specific !obs. The robots are now becoming very powerful and carry out many interesting and complicated tas#s such as hardware assembly.

M&,i !l &l& "%#$i '+ 3lmost every medical e*uipment in the hospital is an embedded system. These e*uipments include diagnostic aids such as "$5, ""5, blood pressure measuring devices, E ray scannersF e*uipment used in blood analysis, radiation, colonscopy, endoscopy etc. 7evelopments in medical electronics have paved way for more accurate diagnosis of diseases.

C#)p("&% $&"-#%.i$/+ $omputer networ#ing products such as bridges, routers, 'ntegrated Services 7igital 8etwor#s %'S78&, 3synchronous Transfer 2ode %3T2&, E./- and frame relay switches are embedded systems which implement the necessary data communication protocols. Gor example, a router interconnects two networ#s. The two networ#s may be running different protocol stac#s. The router)s function is to obtain the data pac#ets from incoming pores, analyDe the pac#ets and send them towards the destination after doing necessary protocol conversion. 2ost networ#ing e*uipments, other than the end systems %des#top computers& we use to access the networ#s, are embedded systems . T&l& #))($i !"i#$'+ 'n the field of telecommunications, the embedded systems can be categoriDed as subscriber terminals and networ# e*uipment. The subscriber terminals such as #ey telephones, 'S78 phones, terminal adapters, web cameras are embedded systems. The networ# e*uipment includes multiplexers, multiple access systems, Pac#et 3ssemblers 7issemblers %P37s&, sate,,ite modems etc. 'P phone, 'P gateway, 'P gate#eeper etc. are the latest embedded systems that provide very low cost voice communication over the 'nternet. Wi%&l&'' "& 0$#l#/i&'+ 3dvances in mobile communications are paving way for many interesting applications using embedded systems. The mobile phone is one of the marvels of the last decade of the /1)h century. 't is a very powerful embedded system that provides voice communication while we are on the move. The Personal 7igital 3ssistants and the palmtops can now be used to access multimedia services over embedded systems. the 'nternet. 2obile communication infrastructure such as base station controllers, mobile switching centers are also powerful

I$'&)i$!"i#$+ Testing and measurement are the fundamental re*uirements in all scientific and engineering activities. The measuring e*uipment we use in laboratories to measure parameters such as weight, temperature, pressure, humidity, voltage, current etc. are all embedded systems. Test e*uipment such as oscilloscope, spectrum analyDer, logic analyDer, protocol analyDer, radio

communication test set etc. are embedded systems built around powerful processors. Than# to miniaturiDation, the test and measuring e*uipment are now becoming portable facilitating easy testing and measurement in the field by field personnel.

S& (%i"1+ Security of persons and information has always been a ma!or issue. We need to protect our homes and officesF and also the information we transmit and store. 7eveloping embedded systems for security applications is one of the most lucrative businesses nowadays. Security devices at homes, offices, airports etc. for authentication and verification are embedded systems. "ncryption devices are nearly << per cent of the processors that are manufactured end up inH embedded systems. "mbedded systems find applications in . every industrial segment consumer electronics, transportation, avionics, biomedical engineering, manufacturing, process control and industrial automation, data communication, telecommunication, defense, security etc. (sed to encrypt the data@voice being transmitted on communication lin#s such as telephone lines. 9iometric systems using fingerprint and face recognition are now being extensively used for user authentication in ban#ing applications as well as for access control in high security buildings. Fi$!$ &+ Ginancial dealing through cash and che*ues are now slowly paving way for transactions using smart cards and 3T2 %3utomatic Teller 2achine, also expanded as 3ny Time 2oney& machines. Smart card, of the siDe of a credit card, has a small micro controller and memoryF and it interacts with the smart card readerI 3T2 machine and acts as an electronic wallet. Smart card technology has the capability of ushering in a cashless society. Well, the list goes on. 't is no exaggeration to say that eyes wherever you go, you can see, or at least feel, the wor# of an embedded systemI

O2&%2i&- #* E)3&,,&, S1'"&) A% 0i"& "(%& "very embedded system consists of custom built hardware built around a $entral Processing (nit %$P(&. This hardware also contains memory chips onto which the software is loaded. The software residing on the memory chip is also called the Jfirmware). The embedded system architecture can be represented as a layered architecture as shown in Gig. The operating system runs above the hardware, and the application software runs above the

operating system. The same architecture is applicable to any computer including a des#top computer. :owever, there are significant differences. 't is not compulsory to have an operating system in every embedded system. Gor small appliances such as remote control units, air conditioners, toys etc., there is no need for an operating system and you can write only the software specific to that application. Gor applications involving complex processing, it is advisable to have an operating system. 'n such a case, you need to integrate the application software with the operating system and then transfer the entire software on to the memory chip. 4nce the software is transferred to the memory chip, the software will continue to run for a long time you don)t need to reload new software. 8ow, let us see the details of the various building bloc#s of the hardware of an embedded system. 3s shown in Gig. the building bloc#s areF

B $entral Processing (nit %$P(& B 2emory %Cead only 2emory and Candom 3ccess 2emory& B 'nput 7evices B 4utput devices B $ommunication interfaces B 3pplication specific circuitry

C&$"%!l P%# &''i$/ U$i" 4CPU5+ The $entral Processing (nit %processor, in short& can be any of the following+ microcontroller, microprocessor or 7igital Signal Processor %7SP&. 3 micro controller is a low cost processor. 'ts main attraction is that on the chip itself, there will be many other components such as memory, serial communication interface, analog to digital converter etc. So, for small applications, a micro controller is the best choice as the number of external components re*uired will be very less. 4n the other hand, microprocessors are more powerful, but you need to use many external components with them. 7-P is used mainly for applications in which signal processing is involved such as audio and video processing.

M&)#%1+ The memory is categoriDed as Candom 3ccess ,,emory %C32& and Cead 4nly 2emory %C42&. The contents of the C32 will be erased if power is switched off to the chip, whereas C42 retains the contents even if the power is switched off. So, the firmware is stored in the C42. When power is switched on, the processor reads the C42F the program is program is executed.

I$p(" ,&2i &'+ (nli#e the des#tops, the input devices to an embedded system have very limited capability. There will be no #eyboard or a mouse, and hence interacting with the embedded system is no easy tas#. 2any embedded systems will have a small #eypad you press one #ey to give a specific command. 3 #eypad may be used to input only the digits. 2any embedded systems used in process control do not have any input device for user interactionF they ta#e inputs from sensors or transducers ,)fnd produce electrical signals that are in turn fed to other systems.

O("p(" ,&2i &'+ The output devices of the embedded systems also have very limited capability. Some embedded systems will have a few =ight "mitting 7iodes %="7s& to indicate the health status of the system modules, or for visual indication of alarms. 3 small =i*uid $rystal 7isplay %=$7& may also be used to display some important parameters.

C#))($i !"i#$ i$"&%*! &'+ The embedded systems may need to, interact with other embedded systems at they may have to transmit data to a des#top. To facilitate this, the embedded systems are provided with one or a few communication interfaces such as CS/0/, CS>//, CS>;-, (niversal Serial 9us %(S9&, '""" ,0<>, "thernet etc.

Appli !"i#$6'p& i*i

i% (i"%1+

Sensors, transducers, special processing and control circuitry may be re*uired fat an embedded system, depending on its application. This circuitry interacts with the processor to carry out the necessary wor#. The entire hardware has to be given power supply either through the /01 volts main supply or through a battery. The hardware has to design in such a way that the power consumption is minimiDed.

C0!p"&% 3 H!%,-!%& I)pl&)&$"!"i#$ #* "0& P%#7& "

This chapter briefly explains about the :ardware 'mplementation of the pro!ect. 't discusses the design and wor#ing of the design with the help of bloc# diagram and circuit diagram and explanation of circuit diagram in detail. 't explains the features, timer programming, serial communication, interrupts of 3T;<S-/ microcontroller. 't also explains the various modules used in this pro!ect.

3.1 P%#7& " D&'i/$

The implementation of the pro!ect design can be divided in two parts. :ardware implementation Girmware implementation

:ardware implementation deals in drawing the schematic on the plane paper according to the application, testing the schematic design over the breadboard using the various '$)s to find if the design meets the ob!ective, carrying out the P$9 layout of the schematic tested on breadboard, finally preparing the board and testing the designed hardware.

The firmware part deals in programming the microcontroller so that it can control the operation of the '$)s used in the implementation. 'n the present wor#, we have used the 4rcad design software for P$9 circuit design, the Keil Lv0 software development tool to write and compile the source code, which has been written in the $ language. The Proload programmer has been used to write this compile code into the microcontroller. The firmware implementation is explained in the next chapter.

The pro!ect design and principle are explained in this chapter using the bloc# diagram and circuit diagram. The bloc# diagram discusses about the re*uired components of the design and wor#ing condition is explained using circuit diagram and system wiring diagram. INTRODUCTION TO MICROCONTROLLER 9ased on the Processor side "mbedded Systems is mainly divided into 0 types 1. Mi %# P%# &''#% + 6 are for general purpose eg+ our personal computer 2. Mi %# C#$"%#ll&%+6 are for specific applications, because of cheaper cost we will go for these 3. DSP 4 Di/i"!l Si/$!l P%# &''#% 5+6 are for high and sensitive application purpose MICROCONTROLLER 8ERSUS MICROPROCESSOR 3 system designer using a general purpose microprocessor such as the Pentium or the ?;1>1 must add C32, C42, '@4 ports, and timers externally to ma#e them functional. 3lthough the addition of external C32, C42, and '@4 ports ma#es these systems bul#ier and much more expensive, they have the advantage of versatility such that the designer can decide on the amount of C32, C42 and '@4 ports needed to fit the tas# at hand.

3 2icrocontroller has a $P( %a microprocessor& in addition to a fixed amount of C32, C42, '@4 ports, and a timer all on a single chip. 'n other words, the processor, the C32, C42, '@4 ports and the timer are all embedded together on one chipF therefore, the designer cannot add any external memory, '@4 ports, or timer to it. The fixed amount of on chip C42, C32, and number of '@4 ports in 2icrocontrollers ma#es them ideal for many applications in which cost and space are critical.

CPU pl!"*#%)+ "mbedded processors can be bro#en into two distinct categories+ microprocessors %MP& and microcontrollers %M$&. 2icrocontrollers have built in peripherals on the chip, reducing siDe of the system.

There are many different $P( architectures used in embedded designs such as 3C2, 2'PS, $oldfire@?;#, PowerP$, x;?, P'$, ;1-,, 3tmel 3.C, Cenesas :;, S:, .;-1, GC ., 20/C, N;1, N;, etc. This in contrast to the des#top computer mar#et, which is currently limited to !ust a few competing architectures. P$@,1> and P$@,1>O are a typical base for small, low volume embedded and ruggediDed system design. These often use 74S, =inux, 8et9S7, or an embedded real time operating system such as P8E or .xWor#s. 3 common configuration for very high volume embedded systems is the system on a chip %So$&, an application specific integrated circuit %3S'$&, for which the $P( core was purchased and added as part of the chip design. 3 related scheme is to use a field programmable gate array %GP53&, and program it with all the logic, including the $P(. "mbedded systems are based on the concept of the microcontroller, a single integrated circuit that contains all the technology re*uired to run an application. 2icrocontrollers ma#e integrated systems possible by combining several features together into what is effectively a complete computer on a chip, including+ Q $entral Processing (nit Q 'nput@4utput interfaces %such as serial ports& Q Peripherals %such as timers& Q C42, ""PC42 or Glash memory for program storage Q C32 for data storage Q $loc# generator 9y integrating all of these features into a single chip it is possible to greatly reduce the number of chips and wiring necessary to control an electronic device, dramatically reducing its complexity, siDe and cost. Q Si9& : W&i/0"+ 2icrocontrollers are designed to deliver maximum performance for minimum siDe and weight. 3 centraliDed on board computer system would greatly outweigh a collection of microcontrollers.

Q E**i i&$ 1+ 2icrocontrollers are designed to perform repeated functions for long periods of time without failing or re*uiring service. MICRO CONTROLLER+ is a chip through which we can connect many other devices and also those are controlled by the program the program which burn into that chip 3.1.1 Bl# . Di!/%!) #* "0& P%#7& " !$, i"' D&' %ip"i#$ The bloc# diagram of the design is as shown in Gig 0.,. 't consists of power supply unit, microcontroller, sensor module, 37$, =$7, and the cooling system with its driver circuit. The brief description of each unit is explained as follows.

3.2 P#-&% S(ppl1+

The input to the circuit is applied from the regulated power supply. The a.c. input i.e., /01. from the mains supply is step down by the transformer to ,/. and is fed to a rectifier. The output obtained from the rectifier is a pulsating d.c voltage. So in order to get a pure d.c voltage, the output voltage from the rectifier is fed to a filter to remove any a.c components present even after rectification. 8ow, this voltage is given to a voltage regulator to obtain a pure constant dc voltage.

T%!$'*#%)&%+ (sually, 7$ voltages are re*uired to operate various electronic e*uipment and these voltages are -., <. or ,/.. 9ut these voltages cannot be obtained directly. Thus the a.c input available at the mains supply i.e., /01. is to be brought down to the re*uired voltage level. This is done by a transformer. Thus, a step down transformer is employed to decrease the voltage to a re*uired level. R& "i*i&%+ The output from the transformer is fed to the rectifier. 't converts 3.$. into pulsating 7.$. The rectifier may be a half wave or a full wave rectifier. 'n this pro!ect, a bridge rectifier is used because of its merits li#e good stability and full wave rectification. Fil"&%+ $apacitive filter is used in this pro!ect. 't removes the ripples from the output of rectifier and smoothens the 7.$. 4utput received from this filter is constant until the mains voltage and load is maintained constant. :owever, if either of the two is varied, 7.$. voltage received at this point changes. Therefore a regulator is applied at the output stage.

8#l"!/& %&/(l!"#%+ 3s the name itself implies, it regulates the input applied to it. 3 voltage regulator is an electrical regulator designed to automatically maintain a constant voltage level. 'n this pro!ect, power supply of -. and ,/. are re*uired. 'n order to obtain these voltage levels, R;1- and R;,/ voltage regulators are to be used. The first number R; represents positive supply and the numbers 1-, ,/ represent the re*uired output voltage levels.

3.3 Mi %# #$"%#ll&%'+ 2icroprocessors and microcontrollers are widely used in embedded systems products. 2icrocontroller is a programmable device. 3 microcontroller has a $P( in addition to a fixed amount of C32, C42, '@4 ports and a timer embedded all on a single chip. The fixed amount of on chip C42, C32 and number of '@4 ports in microcontrollers ma#es them ideal for many applications in which cost and space are critical. The 'ntel ;1-, is :arvard architecture, single chip microcontroller %L$& which was developed by 'ntel in ,<;1 for use in embedded systems. 't was popular in the ,<;1s and early ,<<1s, but today it has largely been superseded by a vast range of enhanced devices with ;1-, compatible processor cores that are manufactured by more than /1 independent manufacturers including 3tmel, 'nfineon Technologies and 2axim 'ntegrated Products. ;1-, is an ; bit processor, meaning that the $P( can wor# on only ; bits of data at a time. 7ata larger than ; bits has to be bro#en into ; bit pieces to be processed by the $P(. ;1-, is available in different memory types such as (. "PC42, Glash and 8. C32.

Features of AT89S52:

8K Bytes of Re-programmable Flash Memory. RAM is 256 bytes. .!" to 5.5" #perati$g Ra$ge. F%lly &tati' #peratio$: ! () to ** M()+s ,hree-le-el .rogram Memory /o'0. 256 1 8-bit 2$ter$al RAM. *2 .rogrammable 23# /i$es. ,hree 46-bit ,imer35o%$ters. 6ight 2$terr%pt &o%r'es. F%ll 7%ple1 8AR, &erial 5ha$$el. /ow-power 2dle a$d .ower-dow$ Modes. 2$terr%pt re'o-ery from power dow$ mode. 9at'hdog timer. 7%al data poi$ter. .ower-off flag. Fast programmi$g time. Fle1ible 2&. programmi$g :byte a$d page mode;.

Description: ,he A,8<s52 is a low--oltage= high-performa$'e 5M#& 8-bit mi'ro'omp%ter with 8K bytes of Flash programmable memory. ,he de-i'e is ma$%fa't%red %si$g Atmel+s high de$sity $o$-olatile memory te'h$ology a$d is 'ompatible with the i$d%strysta$dard M5&-54 i$str%'tio$ set. ,he o$ 'hip flash allows the program memory to be reprogrammed i$ system or by a 'o$-e$tio$al $o$ -olatile memory programmer. By 'ombi$i$g a -ersatile 8-bit 5.8 with Flash o$ a mo$olithi' 'hip= the Atmel A,8<s52 is a powerf%l mi'ro'omp%ter= whi'h pro-ides a highly fle1ible a$d 'ost-effe'ti-e sol%tio$ to ma$y embedded 'o$trol appli'atio$s.

2$ additio$= the A,8<s52 is desig$ed with stati' logi' for operatio$ dow$ to )ero fre>%e$'y a$d s%pports two software sele'table power sa-i$g modes. ,he 2dle Mode stops the 5.8 while allowi$g the RAM= timer3'o%$ters= serial port a$d i$terr%pt system to 'o$ti$%e f%$'tio$i$g. ,he power-dow$ mode sa-es the RAM 'o$te$ts b%t free)es the os'illator disabli$g all other 'hip f%$'tio$s %$til the $e1t hardware reset.

Pin description: Vcc .i$ ! pro-ides s%pply -oltage to the 'hip. ,he -oltage so%r'e is ?5".

GND .i$ 2! is the gro%$d.

Port 0 .ort ! is a$ 8-bit ope$ drai$ bidire'tio$al 23# port. As a$ o%tp%t port= ea'h pi$ 'a$ si$0 eight ,,/ i$p%ts. 9he$ 4s are writte$ to port ! pi$s= the pi$s 'a$ be %sed as high impeda$'e i$p%ts. .ort ! 'a$ also be 'o$fig%red to be the m%ltiple1ed low-order address3data b%s d%ri$g a''esses to e1ter$al program a$d data memory. 2$ this mode= .! has i$ter$al p%ll-%ps. .ort ! also re'ei-es the 'ode bytes d%ri$g Flash programmi$g a$d o%tp%ts the 'ode bytes d%ri$g .rogram -erifi'atio$. 61ter$al p%ll-%ps are re>%ired d%ri$g program -erifi'atio$. Port 1 .ort 4 is a$ 8-bit bidire'tio$al 23# port with i$ter$al p%ll-%ps. ,he .ort 4 o%tp%t b%ffers 'a$ si$03so%r'e fo%r ,,/ i$p%ts. 9he$ 4s are writte$ to .ort 4 pi$s= they are p%lled high by the i$ter$al p%ll-%ps a$d 'a$ be %sed as i$p%ts. As i$p%ts= .ort 4 pi$s that are e1ter$ally bei$g p%lled low will so%r'e '%rre$t :22/; be'a%se of the i$ter$al p%ll-%ps. 2$ additio$= .4.! a$d .4.4 'a$ be 'o$fig%red to be the timer3'o%$ter 2 e1ter$al 'o%$t i$p%t :.4.!3,2; a$d the timer3'o%$ter 2 trigger i$p%t :.4.43,26@;= respe'ti-ely= as show$ i$ the followi$g table. .ort 4 also re'ei-es the low-order address bytes d%ri$g Flash programmi$g a$d -erifi'atio$.

Port 2 .ort 2 is a$ 8-bit bidire'tio$al 23# port with i$ter$al p%ll-%ps. ,he .ort 2 o%tp%t b%ffers 'a$ si$03so%r'e fo%r ,,/ i$p%ts. 9he$ 4s are writte$ to .ort 2 pi$s= they are p%lled high by the i$ter$al p%ll-%ps a$d 'a$ be %sed as i$p%ts. As i$p%ts= .ort 2 pi$s that are e1ter$ally bei$g p%lled low will so%r'e '%rre$t :22/; be'a%se of the i$ter$al p%ll-%ps. .ort 2 emits the high-order address byte d%ri$g fet'hes from e1ter$al program memory a$d d%ri$g a''esses to e1ter$al data memory that %ses 46-bit addresses :M#"@ A 7.,R;. 2$ this appli'atio$= .ort 2 %ses stro$g i$ter$al p%ll-%ps whe$ emitti$g 4s. 7%ri$g a''esses to e1ter$al data memory that %ses 8-bit addresses :M#"@ A R2;= .ort 2 emits the 'o$te$ts of the .2 &pe'ial F%$'tio$ Register. ,he port also re'ei-es the high-order address bits a$d some 'o$trol sig$als d%ri$g Flash programmi$g a$d -erifi'atio$. Port 3 .ort * is a$ 8-bit bidire'tio$al 23# port with i$ter$al p%ll-%ps. ,he .ort * o%tp%t b%ffers 'a$ si$03so%r'e fo%r ,,/ i$p%ts. 9he$ 4s are writte$ to .ort * pi$s= they are p%lled high by the i$ter$al p%ll-%ps a$d 'a$ be %sed as i$p%ts. As i$p%ts= .ort * pi$s that are e1ter$ally bei$g p%lled low will so%r'e '%rre$t :22/; be'a%se of the p%ll-%ps. .ort * re'ei-es some 'o$trol sig$als for Flash programmi$g a$d -erifi'atio$. .ort * also ser-es the f%$'tio$s of -ario%s spe'ial feat%res of the A,8<&52= as show$ i$ the followi$g table.

ST eset input A high o$ this pi$ for two ma'hi$e 'y'les while the os'illator is r%$$i$g resets the de-i'e. ,his pi$ dri-es high for <8 os'illator periods after the 9at'hdog times o%t. ,he 72&R,# bit i$ &FR A8@R :address 86(; 'a$ be %sed to disable this feat%re. 2$ the defa%lt state of bit 72&R,#= the R6&6, (2B( o%t feat%re is e$abled. A!"#P $G Address !atc% "na&'e :A/6; is a$ o%tp%t p%lse for lat'hi$g the low byte of the address d%ri$g a''esses to e1ter$al memory. ,his pi$ is also the program p%lse i$p%t :.R#B; d%ri$g Flash programmi$g. 2$ $ormal operatio$= A/6 is emitted at a 'o$sta$t rate of 436 the os'illator fre>%e$'y a$d may be %sed for e1ter$al timi$g or 'lo'0i$g p%rposes. Cote= howe-er= that o$e A/6 p%lse is s0ipped d%ri$g ea'h a''ess to e1ter$al data memory. 2f desired= A/6 operatio$ 'a$ be disabled by setti$g bit ! of &FR lo'atio$ 86(. 9ith the bit set= A/6 is a'ti-e o$ly d%ri$g a M#"@ or M#"5 i$str%'tio$. #therwise= the pi$ is wea0ly p%lled high. &etti$g the A/6-disable bit has $o effe't if the mi'ro'o$troller is i$ e1ter$al e1e'%tio$ mode.

PS"N Pro(ra) Store "na&'e :.&6C; is the read strobe to e1ter$al program memory. 9he$ the A,8<&52 is e1e'%ti$g 'ode from e1ter$al program memory= .&6C is a'ti-ated twi'e ea'h ma'hi$e 'y'le= e1'ept that two .&6C a'ti-atio$s are s0ipped d%ri$g ea'h a''ess to e1ter$al data memory.

"A#VPP "*terna' Access "na&'e 6A m%st be strapped to BC7 i$ order to e$able the de-i'e to fet'h 'ode from e1ter$al program memory lo'atio$s starti$g at !!!!( %p to FFFF(. Cote= howe-er= that if lo'0 bit 4 is programmed= 6A will be i$ter$ally lat'hed o$ reset. 6A sho%ld be strapped to "55 for i$ter$al program e1e'%tio$s. ,his pi$ also re'ei-es the 42-olt programmi$g e$able -oltage :"..; d%ri$g Flash programmi$g.

+TA!1 2$p%t to the i$-erti$g os'illator amplifier a$d i$p%t to the i$ter$al 'lo'0 operati$g 'ir'%it.

+TA!2 #%tp%t from the i$-erti$g os'illator amplifier.

@,A/4 a$d @,A/2 are the i$p%t a$d o%tp%t= respe'ti-ely= of a$ i$-erti$g amplifier that 'a$ be 'o$fig%red for %se as a$ o$-'hip os'illator. 6ither a >%art) 'rystal or 'erami' reso$ator may be %sed. ,o dri-e the de-i'e from a$ e1ter$al 'lo'0 so%r'e= @,A/2 sho%ld be left %$'o$$e'ted while @,A/4 is dri-e$. ,here are $o re>%ireme$ts o$ the d%ty 'y'le of the e1ter$al 'lo'0 sig$al= si$'e the i$p%t to the i$ter$al 'lo'0i$g 'ir'%itry is thro%gh a di-ide-by-two flip-flop= b%t mi$im%m a$d ma1im%m -oltage high a$d low time spe'ifi'atio$s m%st be obser-ed.

Specia' Function e(isters A map of the o$-'hip memory area 'alled the &pe'ial F%$'tio$ Register :&FR; spa'e is show$ i$ the followi$g table. 2t sho%ld be $oted that $ot all of the addresses are o''%pied a$d %$o''%pied addresses may $ot be impleme$ted o$ the 'hip. Read a''esses to these addresses will i$ ge$eral ret%r$ ra$dom data= a$d write a''esses will ha-e a$ i$determi$ate effe't. 8ser software sho%ld $ot write 4s to these %$listed lo'atio$s= si$'e they may be %sed i$ f%t%re prod%'ts to i$-o0e $ew feat%res. 2$ that 'ase= the reset or i$a'ti-e -al%es of the $ew bits will always be !.

Ti)er 2 e(isters:

5o$trol a$d stat%s bits are 'o$tai$ed i$ registers ,25#C a$d ,2M#7 for ,imer 2. ,he register pair :R5A.2(= R5A.2/; is the 5apt%re3Reload register for ,imer 2 i$ 46-bit 'apt%re mode or 46-bit a%to-reload mode.

,nterrupt e(isters: ,he i$di-id%al i$terr%pt e$able bits are i$ the 26 register. ,wo priorities 'a$ be set for ea'h of the si1 i$terr%pt so%r'es i$ the 2. register. Dua' Data Pointer e(isters: ,o fa'ilitate a''essi$g both i$ter$al a$d e1ter$al data memory= two ba$0s of 46-bit 7ata .oi$ter Registers are pro-ided: 7.! at &FR address lo'atio$s 82(-8*( a$d 7.4 at 8 ( a$d 85(. Bit 7.& D ! i$ &FR A8@R4 sele'ts 7.! a$d 7.& D 4 sele'ts 7.4. ,he %ser sho%ld A/9AE& i$itiali)e the 7.& bit to the appropriate -al%e before a''essi$g the respe'ti-e 7ata .oi$ter Register.

Po-er off F'a(: ,he .ower off Flag :.#F; is lo'ated at bit by reset. .e)or/ $r(ani0ation M5&-54 de-i'es ha-e a separate address spa'e for .rogram a$d 7ata Memory. 8p to 6 K bytes ea'h of e1ter$al .rogram a$d 7ata Memory 'a$ be addressed. :.5#C. ; i$ the .5#C &FR. .#F is set to F4G

d%ri$g power %p. 2t 'a$ be set a$d rest %$der software 'o$trol a$d is $ot affe'ted

Pro(ra) .e)or/ 2f the 6A pi$ is 'o$$e'ted to BC7= all program fet'hes are dire'ted to e1ter$al memory. #$ the A,8<&52= if 6A is 'o$$e'ted to "55= program fet'hes to addresses !!!!( thro%gh 4FFF( are dire'ted to i$ter$al memory a$d fet'hes to addresses 2!!!( thro%gh FFFF( are to e1ter$al memory.

Data .e)or/ ,he A,8<&52 impleme$ts 256 bytes of o$-'hip RAM. ,he %pper 428 bytes o''%py a parallel address spa'e to the &pe'ial F%$'tio$ Registers. ,his mea$s that the %pper 428 bytes ha-e the same addresses as the &FR spa'e b%t are physi'ally separate from &FR spa'e. 9he$ a$ i$str%'tio$ a''esses a$ i$ter$al lo'atio$ abo-e address HF(= the address mode %sed i$ the i$str%'tio$ spe'ifies whether the 5.8 a''esses the %pper 428 bytes of RAM or the &FR spa'e. 2$str%'tio$s whi'h %se dire't addressi$g a''ess the &FR spa'e. For e1ample= the followi$g dire't addressi$g i$str%'tio$ a''esses the &FR at lo'atio$ !A!( :whi'h is .2;. M#" !A!(= Idata ,he i$str%'tio$s that %se i$dire't addressi$g a''ess the %pper 428 bytes of RAM. For e1ample= the followi$g i$dire't addressi$g i$str%'tio$= where R! 'o$tai$s !A!(= a''esses the data byte at address !A!(= rather tha$ .2 :whose address is !A!(;. M#" AR!= Idata 2t sho%ld be $oted that sta'0 operatio$s are e1amples of i$dire't addressi$g= so the %pper 428 bytes of data RAM are a-ailable as sta'0 spa'e.

1atc%do( Ti)er 2$ne3ti)e "na&'ed -it% eset3out4 ,he 97, is i$te$ded as a re'o-ery method i$ sit%atio$s where the 5.8 may be s%bJe'ted to software %psets. ,he 97, 'o$sists of a 4 -bit 'o%$ter a$d the 9at'hdog ,imer Reset :97,R&,; &FR. ,he 97, is defa%lted to disable from e1iti$g reset. ,o e$able the 97,= a %ser m%st write !46( a$d !64( i$ se>%e$'e to the 97,R&, register :&FR lo'atio$ !A6(;. 9he$ the 97, is e$abled= it will i$'reme$t e-ery ma'hi$e 'y'le while the os'illator is r%$$i$g. ,he 97, timeo%t period is depe$de$t o$ the e1ter$al 'lo'0 fre>%e$'y. ,here is

$o way to disable the 97, e1'ept thro%gh reset :either hardware reset or 97, o-erflow reset;. 9he$ 97, o-erflows= it will dri-e a$ o%tp%t R6&6, (2B( p%lse at the R&, pi$. 5A T The 3tmel ;1-, 2icrocontrollers implement three general purpose, ,? bit timers@ counters. They are identified as Timer 1, Timer , and Timer / and can be independently configured to operate in a variety of modes as a timer or as an event counter. When operating as a timer, the timer@counter runs for a programmed length of time and then issues an interrupt re*uest. When operating as a counter, the timer@counter counts negative transitions on an external pin. 3fter a preset number of counts, the counter issues an interrupt re*uest. The various operating modes of each timer@counter are described in the following sections.

3 basic operation consists of timer registers T:x and T=x %xS 1, ,& connected in cascade to form a ,? bit timer. Setting the run control bit %TCx& in T$48 register turns the timer on by allowing the selected input to increment T=x. When T=x overflows it increments T:xF when T:x overflows it sets the timer overflow flag %TGx& in T$48 register. Setting the TCx does not clear the T:x and T=x timer registers. Timer registers can be accessed to obtain the current count or to enter preset values. They can be read at any time but TCx bit must be cleared to preset their values, otherwise the behavior of the timer@counter is unpredictable.

The $@T control bit %in T$48 register& selects timer operation or counter operation, by selecting the divided down peripheral cloc# or external pin Tx as the source for the counted signal. TCx bit must be cleared when changing the mode of operation, otherwise the behavior of the timer@counter is unpredictable. Gor timer operation %$@TxT S 1&, the timer register counts the divided down peripheral cloc#. The timer register is incremented once every peripheral cycle %? peripheral cloc# periods&. The timer cloc# rate is GP"C @ ?, i.e. G4S$ @ ,/ in standard mode or G4S$ @ ? in E/ mode. Gor counter operation %$@TxT S ,&, the timer register counts the negative

transitions on the Tx external input pin. The external input is sampled every peripheral cycle. When the sample is high in one cycle and low in the next one, the counter is incremented.

Since it ta#es / cycles %,/ peripheral cloc# periods& to recogniDe a negative transition, the maximum count rate is GP"C @ ,/, i.e. G4S$ @ /> in standard mode or G4S$ @ ,/ in E/ mode. There are no restrictions on the duty cycle of the external input signal, but to ensure that a given level is sampled at least once before it changes, it should be held for at least one full peripheral cycle. 'n addition to the timer or counter selection, Timer 1 and Timer , have four operating modes from which to select which are selected by bit pairs %2,, 21& in T247. 2odes 1, ,and / are the same for both timer@counters. 2ode 0 is different.

The four operating modes are described below. Timer /, has three modes of operation+ Jcapture), Jauto reload) and Jbaud rate generator).

Ti)&% ; Timer 1 functions as either a timer or event counter in four modes of operation. Timer 1 is controlled by the four lower bits of the T247 register and bits 1, ,, > and - of the T$48 register. T247 register selects the method of timer gating %53T"1&, timer or counter operation %T@$1T& and mode of operation %2,1 and 211&. The T$48 register provides timer 1 control functions+ overflow flag %TG1&, run control bit %TC1&, interrupt flag %'"1& and interrupt type control bit %'T1&.

Gor normal timer operation %53T"1S 1&, setting TC1 allows T=1 to be incremented by the selected input. Setting 53T"1 and TC1 allows external pin '8T1T to control timer operation.

Timer 1 overflow %count rolls over from all ,s to all 1s& sets TG1 flag, generating an interrupt re*uest. 't is important to stop timer@counter before changing mode.

M#,& ; 41363i" Ti)&%5 2ode 1 configures timer 1 as a ,0 bit timer which is set up as an ; bit timer %T:1 register& with a modulo 0/ prescaler implemented with the lower five bits of the T=1 register. The upper three bits of T=1 register are indeterminate and should be ignored. Prescaler overflow increments the T:1 register.

3s the count rolls over from all ,)s to all 1)s, it sets the timer interrupt flag TG1. The counted input is enabled to the Timer when TC1 S , and either 53T" S 1 or '8T1 S ,. %Setting 53T" S , allows the Timer to be controlled by external input '8T1, to facilitate pulse width measurements&. TC1 is a control bit in the Special Gunction register T$48. 53T" is in T247.

The ,0 bit register consists of all ; bits of T:1 and the lower - bits of T=1. The upper 0 bits of T=1 are indeterminate and should be ignored. Setting the run flag %TC1& does not clear the registers.

2ode 1 operation is the same for Timer 1 as for Timer ,. There are two different 53T" bits, one for Timer , %T247.R& and one for Timer 1 %T247.0&.

6aud ate Generator ,imer 2 is sele'ted as the ba%d rate ge$erator by setti$g ,5/K a$d3or R5/K i$ ,25#C. Cote that the ba%d rates for tra$smit a$d re'ei-e 'a$ be differe$t if ,imer 2 is %sed for

the re'ei-er or tra$smitter a$d ,imer 4 is %sed for the other f%$'tio$. &etti$g R5/K a$d3or ,5/K p%ts ,imer 2 i$to its ba%d rate ge$erator mode. ,he ba%d rate ge$erator mode is similar to the a%to-reload mode= i$ that a rollo-er i$ ,(2 'a%ses the ,imer 2 registers to be reloaded with the 46-bit -al%e i$ registers R5A.2( a$d R5A.2/= whi'h are preset by software. ,he ba%d rates i$ Modes 4 a$d * are determi$ed by ,imer 2+s o-erflow rate a''ordi$g to the followi$g e>%atio$.

,he ,imer 'a$ be 'o$fig%red for either timer or 'o%$ter operatio$. 2$ most appli'atio$s= it is 'o$fig%red for timer operatio$ :5.3,2 D !;. ,he timer operatio$ is differe$t for ,imer 2 whe$ it is %sed as a ba%d rate ge$erator. Cormally= as a timer= it i$'reme$ts e-ery ma'hi$e 'y'le :at 4342 the os'illator fre>%e$'y;. As a ba%d rate ge$erator= howe-er= it i$'reme$ts e-ery state time :at 432 the os'illator fre>%e$'y;. ,he ba%d rate form%la is gi-e$ below.

where :R5A.2(= R5A.2/; is the 'o$te$t of R5A.2( a$d R5A.2/ ta0e$ as a 46-bit %$sig$ed i$teger. ,imer 2 as a ba%d rate ge$erator is show$ i$ the below fig%re. ,his fig%re is -alid o$ly if R5/K or ,5/K D 4 i$ ,25#C. Cote that a rollo-er i$ ,(2 does $ot set ,F2 a$d will $ot ge$erate a$ i$terr%pt. Cote too= that if 6@6C2 is set= a 4-to-! tra$sitio$ i$ ,26@ will set 6@F2 b%t will $ot 'a%se a reload from :R5A.2(= R5A.2/; to

:,(2= ,/2;. ,h%s= whe$ ,imer 2 is i$ %se as a ba%d rate ge$erator= ,26@ 'a$ be %sed as a$ e1tra e1ter$al i$terr%pt. 2t sho%ld be $oted that whe$ ,imer 2 is r%$$i$g :,R2 D 4; as a timer i$ the ba%d rate ge$erator mode= ,(2 or ,/2 sho%ld $ot be read from or writte$ to. 8$der these 'o$ditio$s= the ,imer is i$'reme$ted e-ery state time= a$d the res%lts of a read or write may $ot be a''%rate. ,he R5A.2 registers may be read b%t sho%ld $ot be writte$ to= be'a%se a write might o-erlap a reload a$d 'a%se write a$d3or reload errors. ,he timer sho%ld be t%r$ed off :'lear ,R2; before a''essi$g the ,imer 2 or R5A.2 registers. ,nterrupts ,he A,8<&52 has a total of si1 i$terr%pt -e'tors: two e1ter$al i$terr%pts :2C,! a$d 2C,4;= three timer i$terr%pts :,imers != 4= a$d 2; a$d the serial port i$terr%pt. ,hese i$terr%pts are all show$ i$ the below fig%re. 6a'h of these i$terr%pt so%r'es 'a$ be i$di-id%ally e$abled or disabled by setti$g or 'leari$g a bit i$ &pe'ial F%$'tio$ Register 26. 26 also 'o$tai$s a global disable bit= 6A= whi'h disables all i$terr%pts at o$'e. ,he below table shows that bit positio$ 26.6 is %$impleme$ted. 8ser software sho%ld $ot write a 4 to this bit positio$= si$'e it may be %sed i$ f%t%re A,8< prod%'ts. ,imer 2 i$terr%pt is ge$erated by the logi'al #R of bits ,F2 a$d 6@F2 i$ register ,25#C. Ceither of these flags is 'leared by hardware whe$ the ser-i'e ro%ti$e is -e'tored to. 2$ fa't= the ser-i'e ro%ti$e may ha-e to determi$e whether it was ,F2 or 6@F2 that ge$erated the i$terr%pt= a$d that bit will ha-e to be 'leared i$ software. ,he ,imer ! a$d ,imer 4 flags= ,F! a$d ,F4= are set at &5.2 of the 'y'le i$ whi'h the timers o-erflow. ,he -al%es are the$ polled by the 'ir'%itry i$ the $e1t 'y'le. (owe-er= the ,imer 2 flag= ,F2= is set at &2.2 a$d is polled i$ the same 'y'le i$ whi'h the timer o-erflows.

3.< ADC;=;=

The 37$1;1;, 37$1;1< data ac*uisition component is a monolithic $24S device with an ; bit analog to digital converter, ; channel multiplexer and microprocessor compatible control logic. The ; bit 3@7 converter uses successive approximation as the conversion techni*ue. The converter features a high impedance chopper stabiliDed comparator, a /-?C voltage divider with analog switch tree and a successive approximation register. The ; channel multiplexer can directly access any of ; single ended analog signals.

F&!"(%&' "asy interface to all microprocessors 4perates ratiometrically or with - .7$ or analog span ad!usted voltage reference 8o Dero or full scale ad!ust re*uired ; channel multiplexer with address logic 1. to -. input range with single -. power supply 4utputs meet TT= voltage level specifications Standard hermetic or molded /; pin 7'P pac#age /; pin molded chip carrier pac#age 37$1;1; e*uivalent to 22R>$<>< 37$1;1< e*uivalent to 22R>$<>< ,

K&1 Sp& i*i !"i#$' Cesolution ; 9its Total (nad!usted "rror U,V/ =S9 and U, =S9 Single Supply - .7$ =ow Power ,- mW $onversion Time ,11 Ms

F($ "i#$!l D&' %ip"i#$

M(l"ipl&>&%. The device contains an ; channel single ended analog signal multiplexer. 3 particular input channel is selected by using the address decoder. The below table shows the input states for the address lines to select any channel. The address is latched into the decoder on the low to high transition of the address latch enable signal.

CON8ERTER CHARACTERISTICS T0& C#$2&%"&% The heart of this single chip data ac*uisition system is its ; bit analog to digital converter. The converter is designed to give fast, accurate, and repeatable conversions over a wide range of temperatures. The converter is partitioned into 0 ma!or sections+ the /-?C ladder networ#, the successive approximation register, and the comparator. The converter)s digital outputs are positive true. The /-?C ladder networ# approach %Gigure ,& was chosen over the conventional C@/C ladder because of its inherent monotonicity, which guarantees no missing digital codes. 2onotonicity is particularly important in closed loop feedbac# control systems. 3 non monotonic relationship can cause oscillations that will be catastrophic for the system. 3dditionally, the /-?C networ# does not cause load variations on the reference voltage.

The 3@7 converter)s successive approximation register %S3C& is reset on the positive edge of the start conversion %S$& pulse. The conversion is begun on the falling edge of the start conversion pulse. 3 conversion in process will be interrupted by receipt of a new start conversion pulse. $ontinuous conversion may be accomplished by tying the end of conversion %"4$& output to the S$ input. 'f used in this mode, an external start conversion pulse should be applied after power up. "nd of conversion will go low between 1 and ; cloc# pulses after the rising edge of start conversion. The most important section of the 3@7 converter is the comparator. 't is this section which is responsible for the ultimate accuracy of the entire converter. 't is also the comparator drift which has the greatest influence on the repeatability of the device. 3 chopper stabiliDed comparator provides the most effective method of satisfying all the converter re*uirements.

I?O Pi$'

ADDRESS LINE A@ B@ C+ The device contains ; channels. 3 particular channel is selected by using the address decoder line. The above table shows the input states for address lines to select any channel.

A,,%&'' L!" 0 E$!3l& ALE+ The address is latched on the =ow W :igh transition of 3=".

START+ The 37$)s Successive 3pproximation Cegister %S3C& is reset on the positive edge i.e. =ow :igh of the Start $onversion pulse. Whereas the conversion is begun on the falling edge i.e. high W =ow of the pulse.

O("p(" E$!3l&+ Whenever data has to be read from the 37$, 4utput "nable pin has to be pulled high thus enabling the TC' ST3T" outputs, allowing data to be read from the data pins 71 7R.

E$, #* C#$2&%'i#$ 4EOC5+ This Pin becomes high when the conversion has ended, so the controller comes to #now that the data can now be read from the data pins.

Cl# .+ "xternal cloc# pulses are to be given to the 37$F this can be given either from =2 --in 3stable mode or the controller can also be used to give the pulses. Al/#%i"0) ,. Start. /. Select the channel. 0. 3 =ow W :igh transition on 3=" to latch in the address. >. 3 =ow W :igh transition on Start to reset the 37$)s S3C. -. 3 :igh W =ow transition on 3=". ?. 3 :igh W =ow transition on start to start the conversion. R. Wait for "nd of cycle %"4$& pin to become high. ;. 2a#e 4utput "nable pin :igh. <. Ta#e 7ata from the 37$)s output ,1. 2a#e 4utput "nable pin =ow. ,,. Stop The cloc# can also be provided through the controller thus eliminating the need of external circuit for cloc#.

C!l (l!"i$/ S"&p Si9& 37$ 1;1; is an ; bit 37$ i.e. it divides the voltage applied at .refO 6 .ref into /; i.e. /-? steps. S"&p Si9& A 48%&*B 6 8%&*65?2CD Suppose .refO is connected to .cc i.e. -. 6 .ref is connected to the ground, then the step siDe will be Step siDeS %- 1&@/-?S ,<.-0 mv.

C!l (l!"i$/ D#(" The data we get at the 71 7R depends upon the step siDe 6 the 'nput voltage i.e. .in. D#(" A 8i$ ?'"&p Si9&. ADC i$"&%*! & -i"0 "0& Mi %# #$"%#ll&%

The address and data pins of 37$ can be connected to any of the ports of ;1-,

3.C TRANSFORMERS 3 "%!$'*#%)&% is a device that transfers electrical energy from one circuit to another through inductively coupled conductors the transformerXs coils. 3 varying current in the first or primary winding creates a varying magnetic flux in the transformerXs core and thus a varying magnetic field through the se'o$darywinding. This varying magnetic field induces a varying electromotive force %"2G&, or YvoltageY, in the secondary winding. This effect is called inductive coupling. 'f a load is connected to the secondary, current will flow in the secondary winding, and electrical energy will be transferred from the primary circuit through the transformer to the load. 'n an ideal transformer, the induced voltage in the secondary winding %"s& is in proportion to the primary voltage %"p& and is given by the ratio of the number of turns in the secondary %Cs& to the number of turns in the primary %Cp& as follows+

9y appropriate selection of the ratio of turns, a transformer thus enables an alternating current %3$& voltage to be Ystepped upY by ma#ing Cs greater than Cp, or Ystepped downY by ma#ing Cs less than Cp. 'n the vast ma!ority of transformers, the windings are coils wound around a ferromagnetic core, air core transformers being a notable exception. Transformers range in siDe from a thumbnail siDed coupling transformer hidden inside a stage microphone to huge units weighing hundreds of tons used to interconnect portions of power grids. 3ll operate on the same basic principles, although the range of designs is wide. While new technologies have eliminated the need for transformers in some electronic circuits, transformers are still found in nearly all electronic devices designed for household %YmainsY& voltage. Transformers are essential for high voltage electric power transmission, which ma#es long distance transmission economically practical. The transformer is based on two principles+ first, that an electric current can produce amagnetic field %electromagnetism& and second that a changing magnetic field within a coil of wire induces a voltage across the ends of the coil %electromagnetic induction&. $hanging the current in the

primary coil changes the magnetic flux that is developed. The changing magnetic flux induces a voltage in the secondary coil. 3n ideal transformer is shown in the ad!acent figure. $urrent passing through the primary coil creates a magnetic field. The primary and secondary coils are wrapped around a core of very high magnetic permeability, such asiron, so that most of the magnetic flux passes through both the primary and secondary coils. 'f a load is connected to the secondary winding, the load current and voltage will be in the directions indicated, given the primary current and voltage in the directions indicated %each will be alternating current in practice&. I,&!l p#-&% &E(!"i#$

'f the secondary coil is attached to a load that allows current to flow, electrical power is transmitted from the primary circuit to the secondary circuit. 'deally, the transformer is perfectly efficient. 3ll the incoming energy is transformed from the primary circuit to the magnetic field and into the secondary circuit. 'f this condition is met, the input electric power must e*ual the output power+

giving the ideal transformer e*uation

This formula is a reasonable approximation for most commercial built transformers today. 'f the voltage is increased, then the current is decreased by the same factor. The impedance in one circuit is transformed by the s>%are of the turns ratio. Gor example, if an impedance Ks is attached across the terminals of the secondary coil, it appears to the primary circuit to have an impedance of %Cp@Cs&/Ks. This relationship is reciprocal, so that the impedance Kp of the primary circuit appears to the secondary to be %Cs@Cp&/Kp. I,&!l p#-&% &E(!"i#$

'f the secondary coil is attached to a load that allows current to flow, electrical power is transmitted from the primary circuit to the secondary circuit. 'deally, the transformer is perfectly efficient. 3ll the incoming energy is transformed from the primary circuit to the magnetic field and into the secondary circuit. 'f this condition is met, the input electric power must e*ual the output power+

giving the ideal transformer e*uation

This formula is a reasonable approximation for most commercial built transformers today.

'f the voltage is increased, then the current is decreased by the same factor. The impedance in one circuit is transformed by the s>%are of the turns ratio. Gor example, if an impedance Ks is attached across the terminals of the secondary coil, it appears to the primary circuit to have an impedance of %Cp@Cs&/Ks. This relationship is reciprocal, so that the impedance Kp of the primary circuit appears to the secondary to be %Cs@Cp&/Kp.

D&"!il&, #p&%!"i#$
The simplified description above neglects several practical factors, in particular, the primary current re*uired to establish a magnetic field in the core, and the contribution to the field due to current in the secondary circuit. 2odels of an ideal transformer typically assume a core of negligible reluctance with two windings of Dero resistance. When a voltage is applied to the primary winding, a small current flows, driving flux around the magnetic circuit of the core.+ The current re*uired to create the flux is termed the mag$eti)i$g '%rre$t. Since the ideal core has been assumed to have near Dero reluctance, the magnetiDing current is negligible, although still re*uired, to create the magnetic field. The changing magnetic field induces an electromotive force %"2G& across each winding. Since the ideal windings have no impedance, they have no associated voltage drop, and so the voltages .Pand .S measured at the terminals of the transformer, are e*ual to the corresponding "2Gs. The primary "2G, acting as it does in opposition to the primary voltage, is sometimes termed the Ybac# "2GY. This is in accordance with =enDXs law, which states that induction of "2G always opposes development of any such change in magnetic field. E$&%/1 l#''&' 3n ideal transformer would have no energy losses, and would be ,11Z efficient. 'n practical transformers, energy is dissipated in the windings, core, and surrounding structures. =arger transformers are generally more efficient, and those rated for electricity distribution usually perform better than <;Z. "xperimental transformers using superconducting windings achieve efficiencies of <<.;-Z. The increase in efficiency can save considerable energy, and hence money, in a large heavily loaded

transformerF the trade off is in the additional initial and running cost of the superconducting design. =osses in transformers %excluding associated circuitry& vary with load current, and may be expressed as Yno loadY or Yfull loadY loss. Winding resistance dominates load losses, whereas hysteresis andeddy currents losses contribute to over <<Z of the no load loss. The no load loss can be significant, so that even an idle transformer constitutes a drain on the electrical supply and a running cost. 7esigning transformers for lower loss re*uires a larger core, good *uality silicon steel, or even amorphous steel for the core and thic#er wire, increasing initial cost so that there is a trade off between initial cost and running cost %also see energy efficient transformer&. Transformer losses are divided into losses in the windings, termed copper loss, and those in the magnetic circuit, termed iron loss. =osses in the transformer arise from+ Wi$,i$/ %&'i'"!$ & $urrent flowing through the windings causes resistive heating of the conductors. 3t higher fre*uencies, s#in effect and proximity effect create additional winding resistance and losses. H1'"&%&'i' l#''&' "ach time the magnetic field is reversed, a small amount of energy is lost due to hysteresis within the core. Gor a given core material, the loss is proportional to the fre*uency, and is a function of the pea# flux density to which it is sub!ected. E,,1 (%%&$"' Gerromagnetic materials are also good conductors and a core made from such a material also constitutes a single short circuited turn throughout its entire length. "ddy currents therefore circulate within the core in a plane normal to the flux, and are responsible for resistive heating of the core material. The eddy current loss is a complex function of the s*uare of supply fre*uency and inverse s*uare of the material thic#ness. "ddy current losses can be reduced by ma#ing the core of a stac# of plates electrically insulated from each other, rather than a solid bloc#F all transformers operating at low fre*uencies use laminated or similar cores.

M!/$&"#'"%i "i#$ 2agnetic flux in a ferromagnetic material, such as the core, causes it to physically expand and contract slightly with each cycle of the magnetic field, an effect #nown as magnetostriction. This produces the buDDing sound commonly associated with transformers that can cause losses due to frictional heating. This buDDing is particularly familiar from low fre*uency %-1 :D or ?1 :D& mains hum, and high fre*uency %,-,R0> :D %8TS$& or ,-,?/- :D %P3=&& $CT noise. M& 0!$i !l l#''&' 'n addition to magnetostriction, the alternating magnetic field causes fluctuating forces between the primary and secondary windings. These incite vibrations within nearby metalwor#, adding to the buDDing noise and consuming a small amount of power. S"%!1 l#''&' =ea#age inductance is by itself largely lossless, since energy supplied to its magnetic fields is returned to the supply with the next half cycle. :owever, any lea#age flux that intercepts nearby conductive materials such as the transformerXs support structure will give rise to eddy currents and be converted to heat. There are also radiative losses due to the oscillating magnetic field but these are usually small.


=$7 stands for Li*uid Crystal Display. =$7 is finding wide spread use replacing ="7s %seven segment ="7s or other multi segment ="7s& because of the following reasons+ ,. The declining prices of =$7s. /. The ability to display numbers, characters and graphics. This is in contrast to ="7s, which are limited to numbers and a few characters. 0. 'ncorporation of a refreshing controller into the =$7, thereby relieving the $P( of the tas# of refreshing the =$7. 'n contrast, the ="7 must be refreshed by the $P( to #eep displaying the data.

>. "ase of programming for characters and graphics. These components are specialiDed for being used with the microcontrollers, which means that they cannot be activated by standard '$ circuits. They are used for writing different messages on a miniature =$7.

3 model described here is for its low price and great possibilities most fre*uently used in practice. 't is based on the :7>>R;1 microcontroller %(ita'hi& and can display messages in two lines with ,? characters each. 't displays all the alphabets, 5ree# letters, punctuation mar#s, mathematical symbols etc. 'n addition, it is possible to display symbols that user ma#es up on its own. 3utomatic shifting message on display %shift left and right&, appearance of the pointer, bac#light etc. are considered as useful characteristics.

Pins Functions

There are pins along one side of the small printed board used for connection to the microcontroller. There are total of ,> pins mar#ed with numbers %,? in case the bac#ground light is built in&. Their function is described in the table below+

Function Ground

Pin Number 1

Name Vss

Logic State -

Description 0V

Power supply Contrast Control of operating

2 3

Vdd Vee

0 1

+5V 0 Vdd !0 !" are interpreted as #o$$ands !0 !" are interpreted as data !0 !" are interpreted as #o$$ands !0 !" are interpreted as data &rite data 'fro$ #ontroller to (C!) Read data 'fro$ (C! to #ontroller) -##ess to (C! disa.led /or$al operating !ata%#o$$ands are transferred to (C! 0it 0 ( 0 0it 1 0it 2 0it 3 0it 4 0it 5 0it * 0it " 3 0

0 1

Control of operating


0 1

0 1 ,ro$ 1 to 0 0%1 0%1 0%1 0%1 0%1 0%1 0%1 0%1

" 1 2 10 !ata % #o$$ands 11 12 13 14

!0 !1 !2 !3 !4 !5 !* !"

LCD screen:

=$7 screen consists of two lines with ,? characters each. "ach character consists of -xR dot matrix. $ontrast on display depends on the power supply voltage and whether messages are displayed in one or two lines. Gor that reason, variable voltage 1 .dd is applied on pin mar#ed as

.ee. Trimmer potentiometer is usually used for that purpose. Some versions of displays have built in bac#light %blue or green diodes&. When used during operating, a resistor for current limitation should be used %li#e with any =" diode&.

LCD B!'i C#))!$,' 3ll data transferred to =$7 through outputs 71 7R will be interpreted as commands or as data, which depends on logic state on pin CS+ CS S , 9its 71 7R are addresses of characters that should be displayed. 9uilt in processor addresses built in map of characters and displays corresponding symbols. 7isplaying position is determined by 77C32 address. This address is either previously defined or the address of previously transferred character is automatically incremented. CS S 1 9its 71 7R are commands which determine display mode. =ist of commands which =$7 recogniDes are given in the table below+
Command Clear display Cursor 5o$e RS RW D7 D6 D5 D4 D3 D 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 D! D" 0 1 1 6 #$ecution %ime 14*43s 14*4$

+ntry $ode set !isplay on%off #ontrol Cursor%!isplay 5ift ,un#tion set et CGR-3 address et !!R-3 address Read 908 :; flag '0,) &rite to CGR-3 or !!R-3 Read fro$ CGR-3 or !!R-3

0 0 0 0 0 0 0 1 1

0 0 0 0 0 0

0 0 0 0 0 1

0 0 0 0 1

0 0 0

0 0

0 1

1 7%! ! 8 0 6 6

40u 40u 40u 40u 40u 40u 40u 40u

1 !%C R%( 6 , 6

1 !( /

CGR-3 address !!R-3 address !!R-3 address

1 0,

0 !" !* !5 !4 !3 !2 !1 !0 1 !" !* !5 !4 !3 !2 !1 !0

'@7 , S 'ncrement %by ,& 1 S 7ecrement %by ,& S , S 7isplay shift on 1 S 7isplay shift off 7 , S 7isplay on 1 S 7isplay off ( , S $ursor on 1 S $ursor off 9 , S $ursor blin# on 1 S $ursor blin# off

C@= , S Shift right 1 S Shift left 7= , S ; bit interface 1 S > bit interface 8 , S 7isplay in two lines 1 S 7isplay in one line G , S $haracter format -x,1 dots 1 S $haracter format -xR dots 7@$ , S 7isplay shift 1 S $ursor shift

LCD C#$$& "i#$ 7epending on how many lines are used for connection to the microcontroller, there are ; bit and > bit =$7 modes. The appropriate mode is determined at the beginning of the process in a phase called initialiDation. 'n the first case, the data are transferred through outputs 71 7R as it has

been already explained. 'n case of > bit ="7 mode, for the sa#e of saving valuable '@4 pins of the microcontroller, there are only > higher bits %7> 7R& used for communication, while other may be left unconnected. $onse*uently, each data is sent to =$7 in two steps+ four higher bits are sent first %that normally would be sent through lines 7> 7R&, four lower bits are sent afterwards. With the help of initialiDation, =$7 will correctly connect and interpret each data received. 9esides, with regards to the fact that data are rarely read from =$7 %data mainly are transferred from microcontroller to =$7& one more '@4 pin may be saved by simple connecting C@W pin to the 5round. Such saving has its price. "ven though message displaying will be normally performed, it will not be possible to read from busy flag since it is not possible to read from display. LCD I$i"i!li9!"i#$ 4nce the power supply is turned on, =$7 is automatically cleared. This process lasts for approximately ,-mS. 3fter that, display is ready to operate. The mode of operating is set by default. This means that+ ,. 7isplay is cleared /. 2ode 7= S , $ommunication through ; bit interface 8 S 1 2essages are displayed in one line G S 1 $haracter font - x ; dots 0. 7isplay@$ursor on@off 7 S 1 7isplay off ( S 1 $ursor off 9 S 1 $ursor blin# off >. $haracter entry '7 S , 3ddresses on display are automatically incremented by , S S 1 7isplay shift off

3utomatic reset is mainly performed without any problems. 'f for any reason power supply voltage does not reach full value in the course of ,1mS, display will start perform completely unpredictably. 'f voltage supply unit cannot meet this condition or if it is needed to provide completely safe operating, the process of initialiDation by which a new reset enabling display to operate normally must be applied. 3lgorithm according to the initialiDation is being performed depends on whether connection to the microcontroller is through > or ; bit interface. 3ll left over to be done after that is to give basic commands and of course to display messages.

C#$"%!'" #$"%#l+ To have a clear view of the characters on the =$7, contrast should be ad!usted. To ad!ust the contrast, the voltage should be varied. Gor this, a preset is used which can behave li#e a variable voltage device. 3s the voltage of this preset is varied, the contrast of the =$7 can be ad!usted.

Potentiometer Varia.le resistors used as potentio$eters 5a<e all t&ree termina's #onne#ted4 =5is arrange$ent is nor$ally used to (ar) (o'tage> for e6a$ple to set t5e swit#5ing point of a #ir#uit wit5 a sensor> or #ontrol t5e <olu$e 'loudness) in an a$plifier #ir#uit4 7f t5e ter$inals at t5e ends of t5e tra#? are #onne#ted a#ross t5e power supply> t5en t5e wiper ter$inal will pro<ide a <oltage w5i#5 #an .e <aried fro$ @ero up to t5e $a6i$u$ of t5e supply4

Presets =5ese are $iniature <ersions of t5e standard <aria.le resistor4 =5ey are designed to .e $ounted dire#tly onto t5e #ir#uit .oard and adAusted only w5en t5e #ir#uit is .uilt4 ,or e6a$ple> to set t5e freBuen#y of an alar$ tone or t5e sensiti<ity of a lig5t-sensiti<e #ir#uit> a s$all s#rewdri<er or si$ilar tool is reBuired to adAust presets4 Presets are $u#5 #5eaper t5an standard <aria.le resistors so t5ey are so$eti$es used in proAe#ts w5ere a standard <aria.le resistor would nor$ally .e used4

M(l"i"(%$ p%&'&"' are used where very precise ad!ustments must be made. The screw must be turned many times %,1O& to move the slider from one end of the trac# to the other, giving very fine control.

LCD i$"&%*! & -i"0 "0& )i %# #$"%#ll&% 4<63i" )#,&5+

3.G TRIAC BT13D G&$&%!l D&' %ip"i#$ 5lass passivated, sensitive gate triacs in a plastic envelope, intended for use in general purpose bidirectional switching and phase control applications, where high voltages sensitivity is re*uired in all four *uadrants.

3.= TRIAC DRI8ER MOC3;21 The 24$01,E2 and 24$01/E2 series are optically isolated triac driver devices. These devices consist of gallium arsenide infrared emitting diodes, optically coupled to silicon bilateral switch and are designed for applications re*uiring isolated triac triggering, lowWcurrent isolated ac switching, high electrical isolation %to R-11 .3$ pea#&, high detector standoff voltage, small siDe, and low cost. This series is designed for interfacing between electronic controls and power triacs to control resistive and inductive loads for ,,-@/>1. 3$ operations.

F&!"(%&'+ =ow input current re*uired %typically -m3&. :igh isolation voltage minimum R-11 .3$ pea#

Appli !"i#$'+ TC'3$ driver 'ndustrial controls Traffic lights .ending machines 2otor control Solid state relay Solenoid@valve controls Static 3$ power switch 'ncandescent lamp dimmers =amp ballasts

C0!p"&% < Fi%)-!%& I)pl&)&$"!"i#$ #* "0& p%#7& " ,&'i/$

This chapter briefly explains about the firmware implementation of the pro!ect. The re*uired software tools are discussed in section >./. Section >.0 shows the flow diagram of the pro!ect design. Section >.> presents the firmware implementation of the pro!ect design. <.1 S#*"-!%& T##l' R&E(i%&, Keil Lv0, Proload are the two software tools used to program microcontroller. The wor#ing of each software tool is explained below in detail. <.1.1 P%#/%!))i$/ Mi %# #$"%#ll&% 3 compiler for a high level language helps to reduce production time. To program the 3T;<S-/ microcontroller the Keil Lv0 is used. The programming is done strictly in the embedded $ language. Keil Lv0 is a suite of executable, open source software development tools for the microcontrollers hosted on the Windows platform. The compilation of the $ program converts it into machine language file %.hex&. This is the only language the microcontroller will understand, because it contains the original program code converted into a hexadecimal format. 7uring this step there are some warnings about eventual errors in the program. This is shown in Gig >.,. 'f there are no errors and warnings then run the program, the system performs all the re*uired tas#s and behaves as expected the software developed. 'f not, the whole procedure will have to be repeated again. Gig >./ shows expected outputs for given inputs when run compiled program. 4ne of the difficulties of programming microcontrollers is the limited amount of resources the programmer has to deal with. 'n personal computers resources such as C32 and processing speed are basically limitless when compared to microcontrollers. 'n contrast, the code on microcontrollers should be as low on resources as possible.

K&il C#)pil&%+
Keil compiler is software used where the machine language code is written and compiled. 3fter compilation, the machine source code is converted into hex code which is to be dumped into the microcontroller for further processing. Keil compiler also supports $ language code.

Proload is software which accepts only hex files. 4nce the machine code is converted into hex code, that hex code has to be dumped into the microcontroller and this is done by the Proload. Proload is a programmer which itself contains a microcontroller in it other than the one which is to be programmed. This microcontroller has a program in it written in such a way that it accepts the hex file from the Keil compiler and dumps this hex file into the microcontroller which is to be programmed. 3s the Proload programmer #it re*uires power supply to be operated, this power supply is given from the power supply circuit designed above. 't should be noted that this programmer #it contains a power supply section in the board itself but in order to switch on that power supply, a source is re*uired. Thus this is accomplished from the power supply board with an output of ,/volts.


Supports ma!or 3tmel ;< series devices 3uto 'dentify connected hardware and devices "rror chec#ing and verification in built =oc# of programs in chip supported to prevent program copying /1 and >1 pin N'G soc#et on board 3uto "rase before writing and 3uto .erify after writing 'nformative status bar and access to latest programmed file Simple and "asy to use Wor#s on -R?11 speed

D&' %ip"i#$ 't is simple to use and low cost, yet powerful flash microcontroller programmer for the 3tmel ;< series. 't will Program, Cead and .erify $ode 7ata, Write =oc# 9its, "rase and 9lan# $hec#. 3ll fuse and loc# bits are programmable. This programmer has intelligent onboard firmware and connects to the serial port. 't can be used with any type of computer and re*uires no special hardware. 3ll that is needed is a serial communication ports which all computers have. 3ll devices have signature bytes that the programmer reads to automatically identify the chip. 8o need to select the device type, !ust plug it in and goI 3ll devices also have a number of loc# bits to provide various levels of software and programming protection. These loc# bits are fully programmable using this programmer. =oc# bits are useful to protect the program to be read bac# from microcontroller only allowing erase to reprogram the microcontroller. The

programmer connects to a host computer using a standard CS/0/ serial port. 3ll the programming XintelligenceX is built into the programmer so you do not need any special hardware to run it. Programmer comes with window based software for easy programming of the devices.

P%#/%!))i$/ S#*"-!%& $omputer side software called HP%#l#!, 8<.1H is executed that accepts the 'ntel :"E format file generated from compiler to be sent to target microcontroller. 't auto detects the hardware connected to the serial port. 't also auto detects the chip inserted and bytes used. Software is developed in 7elphi R and re*uires no overhead of any external 7==.



This pro!ect is designed to find out such power theft in the normal distribution lines. "ven though there are certain practical problems in implementing this #ind of systems in future

there is a scope for development of these types of systems. This pro!ect is using the principle of the differential protection scheme for the identification of the power theft. The differential protection scheme consists of two $Ts %current transformers& connected at both the terminals of the load. 'f there is no fault in the load then the secondary currents of both the $Ts will be same. (sing the same principle one $T is connected at the starting end of the distributor and the remaining other $T is connected to the different loads which are legal. 'f there is no power theft in the line then the vector sum of all the ct)s which are connected to the load will be e*ual to the current in the main ct. if there is a difference then we can ma#e out that it should either be the power theft or a fault in the line.

The current drawn from the both ends of the transformers are given to the 37$1;1; to convert that analog values into the digital and the that converted digital values are displayed on the =$7 screen.

C0!p"&% D R&'(l"' !$, Di' (''i#$'

D.1 R&'(l"' 3ssemble the circuit on the P$9 as shown in Gig -.,. 3fter assembling the circuit on the P$9, chec# it for proper connections before switching on the power supply. D.2 C#$ l('i#$ The implementation of Power Theft 'dentification System in 7istribution =ines (sing 7ifferential Power 2easurement is done successfully. 'n this way we are going to design the microcontroller based power theft identifier. The purpose of designing such system will ultimately reduce the illegal used of electricity and saves money because it directly affects the economy of nation, because power theft is non ignorable crime which has to be controlled. This system will be beneficial to consumer as well as for government. 3nd it will re*uire only one time installation cost and can be used further. 3nd the big advantage of this system is that it will increase the revenue.The design of electricity theft monitoring system has been generated using the embedded system Technology.

The communication is properly done without any interference between different modules in the design. 7esign is done to meet all the specifications and re*uirements. Software tools li#e Keil (vision Simulator, Proload to dump the source code into the microcontroller, 4rcad =ite for the schematic diagram have been used to develop the software code before realiDing the hardware.

$ircuit is implemented in 4rcad and implemented on the microcontroller board. The performance has been verified both in software simulator and hardware design. The total circuit is completely verified functionally and is following the application software.

I" !$ 3& #$ l(,&, "0!" "0& ,&'i/$ i)pl&)&$"&, i$ "0& p%&'&$" -#%. p%#2i,& p#%"!3ili"1@ *l&>i3ili"1 !$, "0& ,!"! "%!$')i''i#$ i' !l'# ,#$& -i"0 l#- p#-&% #$'()p"i#$.

,. Gield Programmability, Glexibility /. :ighly secured and easy to install 0. The dailies report that "lectricity 9oard suffers a total loss of // Z in revenue due to power theft every year, which can be controlled now. >. -. The consumer will also get benefit because in most of the cases consumer does not aware of that someone is tapped his line and he has to pay extra charge. With the help of this pro!ect we can reduce the total illegal use of power 6 saves electricity. Di'!,2!$"!/&+6 The disadvantages of this pro!ect is that only it has high installation cost. 9ut it can be bearable because it re*uires only once installation cost and can be used for life time.

APPLICATIONS+ Power monitoring at homes, apartments 'ndustrial power monitoring

REFERENCES[documents@doc,<,<.pdf;1-,@Software@#eil[tutorial.pdf[crossing datas%eets.ma1imi$tegrated.'om (%%&$"['&$'&[article.pdf e$.wi0ipedia.org3wi0i3T ,A7 www.all,!"!'0&&".com@,!"!'0&&" pdf@pdf@>-,;@...@MCT2E.html \ ... \ "ngineering \ "lectronics "ngineering \ T(T4C'3= \ ;1-, Tutorial,?x/ l , module datasheetwww.microscale]...!, ;=;= .


,. "mbedded Systems 3rchitecture Programming and 7esign by Ca! Kamal. /. "mbedded 3nd Ceal Time systems by K . Prasad. 0. "lectronic 2easurement 3nd 'nstruments by 9a#shi.