Vous êtes sur la page 1sur 95

CONTENTS

Page no.

LIST OF FIGURES:.........................................................................................................ii

LIST OF TABLES:..........................................................................................................iii

CHAPTER 1.......................................................................................................................1

INTRODUCTION.............................................................................................................1

1.1 INTRODUCTION.......................................................................................1

1.2. AIM ........................................................................................................1

1.3. METHODOLOGY .....................................................................................2

1.4. BLOCK DIAGRAM ...................................................................................2

1.5. SIGINIFICANCE OF THE WORK................................................................3

1.6. DESCRIPTION ABOUT THE PROJECT .......................................................3

1.7. ORGANISATION OF REPORT ................................................................4

1.8. CONCLUSION..........................................................................................5

INDUCTION MOTOR.....................................................................................................5

2.1. INTRODUCTION......................................................................................5

2.2. PRINCIPLE OF OPERATION......................................................................6

2.3.1. TYPES OF STARTERS...........................................................................7

2.4. GENERAL FAULTS IN INDUCTION............................................................8

2.4.1. EFFECTS OF UNBALANCED SUPPLY.....................................................8

2.5. APPLICATIONS......................................................................................10

2.6. CONCLUSION........................................................................................10

MICRO CONTROLLER................................................................................................10

3.1. INTRODUCTION....................................................................................10

3.2. Features of AT89S52............................................................................11

3.3. CENTRAL PROCESSING UNIT................................................................12


3.4. TIMERS/ COUNTERS.............................................................................12

3.5. MEMORY ORGANIZATION.....................................................................13

3.7. ADDRESSING MODES...........................................................................15

3.8. ARCHITECHTURE OF MICROCONTROLLER AT89S52.............................16

3.9. PIN CONFIGURATION............................................................................17

3.9.1. PIN DESCRIPTION OF AT89S52..........................................................18

3.11. INSTRUCTION SET OF MCS52.............................................................22

3.12. PROGRAMMABLE CLOCK OUT............................................................22

3.13. CONCLUSION......................................................................................22

AUTO-PROTECTION OF INDUCTION MOTOR AGAINST VOLTAGE


FLUCTUATIONS............................................................................................................23

4.1 INTRODUCTION.....................................................................................23

4.2 REGULATOR..........................................................................................23

4.2.1 PIN CONFIGURATION..........................................................................23

4.3 DUAL COMPARATOR (LM393)................................................................24

4.3.1 FEATURES.........................................................................................24

4.3.2. PIN DIAGRAM OF LM393....................................................................25

4.4 LIQUID CRYSTAL DISPLAY......................................................................26

4.5 PCB LAYOUT..........................................................................................27

4.5.1 FABRICATION DETAILS.......................................................................27

4.5.2 PCB FABRICATION PROCEDURE..........................................................28

4.6. FAULT DETECTION CIRCUIT..................................................................29

4.7. MAIN CIRCUIT DIAGRAM.......................................................................32

4.8. FLOW CHART........................................................................................34

4.9. PROGRAM............................................................................................35

EXPERMENTAL RESULTS AND CONCLUSION...................................................62


5.1RESULT...................................................................................................62

5.2 CONCLUSION.........................................................................................62

5.3 APPLICATION.........................................................................................63

5.4. FUTURE ENHANCEMENTS.....................................................................63


ABSTRACT
This Project aims at protection of the three phase Induction motors. The circuit
will take the full control of the motor and it will protect the motor from several faults
such us over voltage and under voltage and the circuit will switch on the motor under
safety conditions. This also protects induction motor from single phasing which is also a
major fault.

The circuit was fully controlled by the microcontroller and the microcontrollers
will continuously monitors the voltages of the three phases and if the voltage goes
abnormal then it will switch off the motor until they are normal. All the conditions are
displayed by it over the LCD display. In our project we are using the popular 8 bit
microcontroller AT89C52. It is a 40 pin microcontroller.

The protection of induction motor with microcontroller has flexibility to switch


off at required time, monitors phases of motor at every time and also every motoring
action is known through LCD display. It also protects motor from single phasing as its
maintenance cost is also cheap.

i
LIST OF FIGURES:

Figure No. Title Page No.


1.1 Block diagram of automatic voltage control of IM
using Microcontroller
3.1 Architecture of Microcontroller AT89S52

3.2 Pin diagram of AT89S52


4.1 Regulator
4.2 Dual comparator LM393
4.3 LCD Display
4.4 PCB Layout
4.5 Fault detection circuit
4.6 Three phase fault detection circuit
4.7 Circuit diagram of Automatic Voltage Control of
IM using Microcontroller
4.8 Flow Chart

ii
LIST OF TABLES:

Table No Title Page No


3.1 Interrupt source service routine starting address

3.2 Pin Description of AT89S52

3.3 Port 3 Alternate Functions

iii
CHAPTER 1

INTRODUCTION
1.1 INTRODUCTION
The manner in which the use of microcontrollers is shaping our lives in breath
taking. Today this versatile device can be found in a variety of control applications. TVs,
VCRs, CD players, microwave ovens, automotive engines are some of these.

A Microcontroller unit (MCU) uses microprocessor as its central processing unit


(CPU) and it Incorporates memory, Timing reference, I/O peripherals etc., on same chip.
Limited computational capabilities and enhanced I/O are special features.

In our project the microcontroller is used to control the three phase induction
motor.

The motor protection is required as day to day life induction motor usage
increases a lot as it has some specific merits. The circuit was fully controlled by the
microcontroller and the micro controllers will continuously monitors the voltages of the
three phase and if the voltages goes abnormal then it will switch off the motor until they
are normal.

Its not only protect motor from transient voltages, it also switch on the motor
automatically when power comes without manual requirement and off the motor after
predetermined time. This motor is manually monitoring is difficult so automatic
protection of induction motor has such an importance.

1.2. AIM
This Project aims protection of three phase Induction motors and to start and stop
the motor automatically. The circuit will take full control of the motor and it will protect
the motor from several faults such as over voltage and under voltage and the circuit will
switch on the motor under safety conditions. This also protects Induction motor from
single phasing which is also a major fault.

1
1.3. METHODOLOGY
In this project we are using dual comparator to compare over/under voltages with
the present voltage and send signal to microcontroller if the voltage goes beyond the
range. Here we are using LM393 dual comparator.

Addition to this we are using two switches one for auto on and another one for
auto off. Here the motor will run automatically when auto on is set and it will start the
motor automatically after a particular time if off is set.

According to the program written into the microcontroller the circuit will
automatically on/off the motor. The prime use of the microcontroller is to protect the
motor from over and under voltage and to start/stop the motor automatically.
Microcontroller send signal to the relay which is connected to starter of motor. According
to the signal from the controller the relay will start/stop the motor.

1.4. BLOCK DIAGRAM


The main block diagram of automatic voltage control of Induction motor using
microcontroller is shown in fig:

3 phase Start Relay Starter


over/und
er
voltage
detector Stop Relay Inductio
Micro n Motor
OFF Controller
Timer AT89S52
Switch LCD Display
2
3 phase Start Relay Starter
over/und
er
voltage
detector Stop Relay Inductio
Micro n Motor
OFF Controller
Timer AT89S52
Switch LCD Display

Fig 1.1 Block diagram of automatic voltage control of IM using microcontroller

1.5. SIGINIFICANCE OF THE WORK


This project can be used to project the motor from undesired voltages .The main
applications of the project is in industrial and agriculture fields to protect the motor and it
also starts and stop the motor automatically.

1.6. DESCRIPTION ABOUT THE PROJECT


Whenever over/under voltages occurs then the dual comparator LM393 will
predict and sends the signal to the microcontroller .The dual comparator LM393 is
initially set to the range between 180V to 260V, if the voltage goes beyond the specified
range it will send the signal to the microcontroller .According to the program written into
the microcontroller AT89S52 and it will send the signal to the relay, and then relay stops
the motor.

The circuit was fully controlled by the microcontroller and the microcontrollers
will continuously monitors the voltages of the three phase and if the voltage goes
abnormal then it will switch off the motor until they are normal. All the conditions are
displayed it over the LCD display.

3
Auto ON and Auto OFF switches are push to on switches, which will be ON only
until they are held at pressed state once they are released the switch gets opened. The
function of auto switch is that when it is pressed and released the motor is turned off after
providing a delay which is dictated by the positioning of the rotary switch. The physical
functioning of the auto on switch is that once the auto on switch is set and if the supply is
provided and also voltages are in normal condition then the motor start automatically.

1.7. ORGANISATION OF REPORT


Chapter -2 deals with Induction motor which includes construction and operation.
Types of faults in Induction motor, starting methods of Induction motor.

(Reference 1: Electrical machines by I J NAGRATH, D P KOTHARI)

(Reference 2: www.google.com)

(Reference 3: www.alldatasheets.com)

Chapter -3 Deals with micro controller which includes the pin description and instruction
set to develop the program for automatic voltages control of induction motor. Here We
are using the microcontroller AT89S52 for automatic voltages control of Induction
motor.

(Reference 1: www.electronicsforyou.com )

(Reference 2: www.google.com)

(Reference 3: www.alldatasheets.com)

(Reference 4: www.atmel.com )

(Reference 5: www.8052.com )

Chapter- 4 Deals with dual comparator, Regulator and LCD includes the circuit operation
of automatic voltages control of Induction motor using Microcontroller.

(Reference 1: www.microcontroller.net )

(Reference 2: www.google.com)

4
(Reference 3: www.electronicsforyou.com)

(Reference 4: www.alldatasheets.com)

(Reference 5: www.philipssemiconductors.com)

1.8. CONCLUSION
This project can be used with the three phase Induction motor. The circuit will
take full control of the motor and it will protect the motor from several faults such as over
voltage and under voltages and the circuit will switch on the motor under safety
conditions.

CHAPTER 2

INDUCTION MOTOR

2.1. INTRODUCTION
Induction Motor is one kind of AC motor where power is supplied to the rotating
device by induction. An electric motor converts electrical power to mechanical power in
its rotor (rotating part). There are several ways to supply power to the rotating part of the
motor. In a DC motor this power is supplied to the armature directly from a DC source.
But in an A.C. Motor this power is induced in the rotating device. An induction motor
can be called a rotating transformer because the stationary (stationary part) is essentially
the primary side of the transformer and the rotor (rotating part) is the secondary side.
Induction motors are widely used, especially polyphase induction motors, which are
frequently used in industrial drives.

5
Induction motors are now the preferred choice for industrial motors due to their
rugged construction, lack of brushes like in DC motors and they have ability to control
the speed due to rapid developments in power electronics.

There are two types of motors

1. Squirrel cage motor

2. Slip ring motor

Of the two the squirrel cage induction motor is most widely used because of its
simple construction, high reliability and low maintenance cost. The rotor bars in squirrel
cage induction motors are not straight but have some skew to reduce noise and harmonics
Due to the flexibility in the slip ring induction motor to vary the rotor resistance it is used
in the applications involving high starting torque and speed control .But it has high initial
cost, high maintenance cost.

2.2. PRINCIPLE OF OPERATION

The basic difference between an induction motor and a synchronous AC motor is


that in the latter a current is supplied into the rotor (usually a DC current) which in turn
creates a (circular uniform) magnetic field around the rotor. The rotating magnetic field
of the stator will impose an electromagnetic torque on the still magnetic field of the rotor
causing it to move (about a shaft) and rotation of the rotor is produced. It is called
synchronous because at steady state the speed of the rotor is the same as the speed of the
rotating magnetic field in the stator.

By way of contrast, the induction motor does not have any direct supply onto the
rotor; instead, a secondary current is induced in the rotor. To achieve this, stator windings
are arranged around the rotor so that when energized with a polyphase supply they create
a rotating magnetic field pattern which sweeps past the rotor. This changing magnetic
field pattern induces current in the rotor conductors. This current interacts with the

6
rotating magnetic field created by the stator and in effect causes a rotational motion on
the rotor.

However, for these currents to be induced, the speed of the physical rotor must be
less than the speed of the rotating magnetic field in the stator, or else the magnetic field
will not be moving relative to the rotor conductors and no currents will be induced. If by
some chance this happens, the rotor typically slows slightly until a current is re-induced
and then the rotor continues as before. This difference between the speed of the rotor and
speed of the rotating magnetic field in the stator is called slip. It is unit less and is the
ratio between the relative speed of the magnetic field as seen by the rotor (the slip speed)
to the speed of the rotating stator field. Due to this an induction motor is sometimes
referred to as an asynchronous machine.

2.3. STARTING OF INDUCTION

In a three phase induction motor, the induced emf in rotor circuit depends on the
slip of the induction motor and the magnitude of the rotor current depends upon this
induced emf. When the motor is started, the slip is equal to 1 as the rotor speed is zero, so
the induced emf in rotor is large. As a result, a very high current flows through the rotor.
This is similar to a transformer with the secondary coil short circuited, which causes the
primary coil to draw a high current is drawn by the stator, on the order of 5 to 9 times the
full load current. This high current can damage the motor windings and because it causes
heavy line voltage drop, other appliances connected to the same line may be affected by
the voltage fluctuation. To avoid such effects, the starting current should be limited. A
starter is a device which limits the starting current by providing reduced voltage to the
motor. Once the rotor speed increases, the full rated voltage is given to it.

2.3.1. TYPES OF STARTERS


 Direct on line starter

 Autotransformer starter

 Star Delta starter

7
 Stator Resistance starter

2.4. GENERAL FAULTS IN INDUCTION


There are various faults occurring in 3 phase induction motor, but in our project
we have protected the induction motor from the following faults only i.e.

1. Voltage imbalances.

2. Single phasing.

2.4.1. EFFECTS OF UNBALANCED SUPPLY


The effect of unbalanced voltages on polyphase induction motors is equivalent to
the introduction of 'negative sequence voltage' having a rotation opposite to that
occurring with balanced voltages. This negative sequence voltage produces in the air gap
a flux rotating against the rotation of the rotor, tending to produce high current. A small
negative sequence voltage may produce in the windings currents considerably in excess
of those present under balanced voltage conditions. "The voltage unbalance (or negative
sequence voltage) in percent may be defined as follows: Per cent voltage unbalance =
Max. Voltage deviation from Avg. voltage x 100 Average voltage.

Example: With voltages of 220, 215, and 210, the average is 215, the maximum deviation
from the average is and the percent unbalance is 5 x 100, or 2.3 per cent 215. A relatively
small unbalance in voltage will cause considerable increase in temperature rise in the
phase with the highest current; the percentage increase in temperature rise will be
approximately two times the square of the percentage voltage unbalance. The increase
losses and, consequently, the increase in average heating of the whole winding will be
slightly lower than the winding with the highest current. To illustrate the severity of this
condition, an approximate 3.5 percent voltage unbalance will cause an approximate 25
per cent increase in temperature rise. The locked rotor current will be unbalanced to the
same degree that the voltages are unbalanced but the locked rotor KVA will increase only
slightly. "The currents at normal operating speed with the unbalanced voltages will be
greatly unbalanced in the order of approximately 6 to 10 times the voltage unbalance.
This introduces a complex problem in selecting the proper overload protective devices,
particularly since devices selected for one set of unbalanced conditions may be

8
inadequate for a different set of unbalanced voltages, increasing the size of the overload
device is not the solution in as much as protection against heating from overload and
single phase operation is lost.”

If it is determined that the problem is one of voltage unbalance, the next step is to find
out what caused unbalanced condition. These are some of the causes:

 Unequal loading per phase on the transformer serving the motor;

 Single phasing, such as would be caused by Blown fuse on the primary of


the transformer serving the motor;

 Unequal Transformer tap settings;

 Unequal transformer impedances (impedances can range from 1.6 to 6 per


cent};

 Capacitor banks with fuse blown or with unequal capacity per phase;

 Voltage regulators out of step or calibration;

 Transformer bank connected in configuration that inherently provides poor


regulation, such as open delta or T-T connection. Of these, the most common
items are 1 and 2. Item 2 (open phase) can be quite difficult to detect if a high
percentage of the load connected to the transformer secondary is rotating
equipment, in such cases, the open phase may remain at approximately full
potential.

In fact, the large-scale negative sequence currents in induction motor result from
slight unbalanced voltage, causing overheating, shaft vibration, noise, derating and
additional losses, and hence reduce its lifetime and performance.

2.4.2 SINGLE PHASING

9
It is well known that a three-phase induction motor will continue to operate when
a disturbance of some sort causes the voltages supplied to the motor to become single-
phase. The single-phasing can occur as a result of a fuse blowing or protective device
opening on one phase of the motor. Other possibilities include feeder or step-down
transformer fuses blowing. Even though the motor will continue to operate in this
condition, the motor will heat up very quickly and it is essential that the motor be
removed from service by the opening of a motor circuit breaker or some other type of
protective device. This paper will describe three different ways in which an induction
motor will operate in a single-phase condition. For purposes of this paper "single-phase"
will include any condition in which the three line-to-line voltage phasors appear on the
same line.

2.5. APPLICATIONS
The induction motor has wide applicability as a motor in industry and its single
phase form in several domestic applications. A wide range of speed control is possible
only by circuitry using silicon controlled rectifiers.

2.6. CONCLUSION
The induction motor is an important class of electrical machine. Day to day it has
more than 85% of industrial usage because of its simple construction and reliable. By
having these advantages in agricultural and industrial fields we are protecting Induction
Motor from over/under voltages and single phasing.

CHAPTER 3

MICRO CONTROLLER

3.1. INTRODUCTION
The AT89S52 is a low-power, high-performance CMOS 8-bit microcomputer
with 8 Kbytes of Flash Programmable and Read Only Memory (PEROM). The device is
manufactured using Atmel’s high-density nonvolatile memory technology and is
compatible with the industry standard 80C51 instruction set and pinout. The on-chip

10
Flash allows the program memory to be reprogrammed in-system or by a conventional
nonvolatile memory programmer.

By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel
AT89S52 is a powerful microcontroller which provides a highly-flexible and cost
effective solution to many embedded control applications.

The AT89S52 provides the following standard features: 8K bytes of Flash, 256
bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit
timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, on-
chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic
for operation down to zero frequency and supports two software selectable power saving
modes.

The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial
port, and interrupt system to continue functioning. The Power-down mode saves the
RAM con-tents but freezes the oscillator, disabling all other chip functions until the next
interrupt or hardware reset.

3.2. Features of AT89S52


 Compatible with MCS-51 Products

 8K Bytes of In-System Programmable (ISP) Flash Memory

 Endurance: 1,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

11
 Interrupt Recovery from Power-down Mode

 Eight Interrupt Sources

 Full Duplex UART Serial Channel

 Low-power Idle and Power-down Modes

3.3. CENTRAL PROCESSING UNIT


The CPU is the brain of the microcontrollers reading user’s programs and
executing the expected task as per instructions stored there in. Its primary elements are an
8-bit Arithmetic Logic Unit (ALU), Accumulator (Acc), few more 8 bit registers, B
register, stack pointer (SP), Program Status Word (PSW) and 16 bit registers, Program
Counter (PC) and Data Pointer Register (DPTR).

The ALU (Acc) performs arithmetic and logic functions on 8 bit input variables.
Arithmetic operations include basic addition, subtraction, multiplication and division.
Logical operations are AND, OR, Exclusive OR as well as rotate, clear, complement and
etc. Apart from all the above, LAU is responsible in conditional branching decisions, and
provides a temporary place in data transfer operations within the device.

B register is mainly used in multiply and divide operations. During execution, B


register either keeps one of the two inputs or then retains a portion of the result. For other
instructions, it can be used as another general purpose register.

Program status word keeps the current status of the ALU in different bits.

3.4. TIMERS/ COUNTERS


8052 has three 16 bit Timers/ Counters capable of working in different modes.
Each consists of a ‘High’ byte and a ‘Low’ byte which can be accessed under software.
There is a mode control register and a control register to configure these timers/ counters
in number of ways.

These timers can be used to measure time intervals, determine pulse widths or
initiate events with one microsecond resolution up to a maximum of 65 millisecond

12
(corresponding to 65, 536 counts). Use software to get longer delays. Working counter,
they can accumulate occurrences of external events (from DC to 500 KHz) with 16 bit
precision.

3.5. MEMORY ORGANIZATION


The 8052 architecture provides both on-chip memory as well as off-chip memory
expansion capabilities. It supports several distinctive ‘physical’ address spaces,
functionally separated at the hardware level by different addressing mechanisms, read
and write controls signals or both:

 On chip Program Memory

 On chip Data Memory

 Off chip program memory

 Off chip Data Memory

 On chip Special Function Registers

The Program Memory area (EPROM incase of external memory or Flash/


EPROM in case of internal one) is extremely large and never lose information when the
power is removed. Program Memory is used for information needed each time power is
applied: Initialization values, calibration data, keyboard lookup tables etc., along with
the program itself. The program memory has a 16 bit address and any particular memory
location is addressed using the 16 bit program counter and instructions which generate a
16 bit address.

On chip data memory is smaller and therefore quicker than Program Memory and
it goes into a random state when power is removed. On chip RAM is used for variables
which are calculated when the program is executed.

In contrast to the Program Memory, On chip Data Memory accesses need a single
8 bit value (may be a constant or another variable) to specify a unique location. Since 8

13
bits are more than sufficient to address 128 RAM locations, the On chip RAM address
generating register is single byte wide.

Different addressing mechanisms are used to access these different memory


spaces and this greatly contributes to microcomputer’s operating efficiency.

The 64 Kbyte program memory space consists of an internal and an external


memory portion. If the EA pin is held high, the 8051 executes out of internal Program
Memory unless the address exceeds 0FFFH and locations 1000H through FFFFH are then
fetched from external Program Memory. If the EA pin held low, the 8051 fetches all
instructions from the External Program Memory. In either case, the 16 bit Program
Counter is the addressing mechanism.

The Data Memory address space consists if an internal and an external memory
space. External Data Memory is accessed when a MOVX instruction is executed.

Apart from On-chip Data Memory of size 128/256 bytes, total size of Data
Memory can be expanded up to 64K using external RAM devices.

Total internal Data Memory is divided into three blocks:

 Lower 128 bytes.

 Higher 128 bytes.

 Special Function Register space.

 Higher 128 bytes are available only in 8032/8052 devices.

Even through the upper RAM area and SFR area share address locations, they are
accessed through different addressing modes. Direct addresses higher than 7FH access
SFR memory space and indirect addressing above 7FH access higher 128 bytes (in
8032/8052).

3.6. INTERRUPTS

14
The 8052 has five interrupt sources: one from the serial port when a transmission
or reception operation is executed; two from the timers when overflow occurs and two
come from the two input pins INT0, INT1. Each interrupt may be independently enabled
or disabled to allow polling on same sources and each may be classified as high or low
priority.

A high priority source can override a low priority service routine. These options
are selected by interrupt enable and priority control registers, IE and IP.

When an interrupt is activated, then the program flow completes the execution of
the current instruction and jumps to a particular program location where it finds the
interrupt service routine. After finishing the interrupt service routine, the program flows
return to back to original place.

The Program Memory Address, 0003H is allocated to the first interrupt and next
seven bytes can be used to do any task associated with that interrupt.

INTERRUPT SOURCE SERVICE ROUTINE STARTING


ADDRESS
External 0 0003H
Timer/counter 0 000BH
External 1 0013H
Timer/counter 1 001BH
Serial port 0023H
Table 3.1 Interrupt source service routine starting address

3.7. ADDRESSING MODES


8052’s assembly language instruction set consists of an operation mnemonic and
zero to three operands separated by commas. In two byte instructions the destination is
specified first, and then the source. Byte wide mnemonics like ADD or MOV use the
Accumulator as a source operand and also to receive the result.

The 8052 supports five types of addressing modes:

15
 Register Addressing

 Direct Addressing

 Register Indirect Addressing

 Immediate Addressing

 Index Addressing

3.8. ARCHITECHTURE OF MICROCONTROLLER AT89S52

16
Fig 3.1 Architecture of Microcontroller AT89S52

3.9. PIN CONFIGURATION

17
Fig 3.2 pin diagram of AT89S52

3.9.1. PIN DESCRIPTION OF AT89S52

Pin. No Pin name Pin description


1,7 Port 1 Input/output Pins

18
9 RST Reset Input
10 RXD Receive Data
11 TXD Transmit Data
12 INT0 Interrupt 0
13 INT 1 Interrupt 1
14 T0 Timer 0 input
15 T1 Timer 1 input
16 WR Write Strobe
17 RD Read Strobe
18 XTAL 2 Crystal Input 2
19 XTAL 1 Crystal Input 1
20 Vss Ground
21 A8 Address 8
22 A9 Address 9
23 A10 Address 10
24 A11 Address 11
25 A12 Address 12
26 A13 Address 13
27 A14 Address 14
28 A15 Address 15
29 PSEN Program Store Enable
30 (PROG)ALE Address Latch Enable (EPROM Program Plus)
31 (Vpp)/EA External enable(EPROM Program voltage)
32 AD7 Address/Data 7
33 AD6 Address/Data 6
34 AD5 Address/Data 5
35 AD4 Address/Data 4
36 AD3 Address/Data 3
37 AD2 Address/Data 2
38 AD1 Address/Data 1
39 AD0 Address/Data 0
40 Vcc +5v

Table 3.2. Pin Description of AT89S52

19
3.10. PORTS

Port 0
Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can
sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high
impedance inputs. Port 0 can also be configured to be the multiplexed low-order
address/data bus during accesses to external program and data memory. In this mode, P0
has internal pull-ups. Port 0 also receives the code bytes during Flash programming and
outputs the code bytes during program verification. External pull-ups are required during
program verification.

Port 1

Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1 output
buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are
pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that
are externally being pulled low will source current (IIL) because of the internal pull-ups.
In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count
input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown
in the following table. Port 1 also receives the low-order address bytes during Flash
programming and verification.

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 uses 16-bit addresses (MOVX
@ DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s.
During accesses to external data memory that uses 8-bit addresses (MOVX @ RI), Port 2

20
emits the contents of the P2 Special Function Register. Port 2 also receives the high-order
address bits and some control signals during Flash programming and verification.

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. Port 3
receives some control signals for Flash programming and verification. Port 3 also serves
the functions of various special features of the AT89S52, as shown in the following table.

Port Pin Alternate Functions


P3.0 RXD (serial input port)

P3.1 TXD (serial output port)

P3.2 INT0 (external interrupt 0)

P3.3 INT1 (external interrupt 1)

P3.4 T0 (timer 0 external input)

P3.5 T1 (timer 1 external input)

P3.6 WR (external data memory write strobe)

P3.7 RD (external data memory read strobe)

Table 3.3 Port3 Alternate Functions

Port 3 also receives some control registers for Flash Programming and
Programming verification.

21
3.11. INSTRUCTION SET OF MCS52
1. ARITHEMATIC OPERATIONS

2. LOGICAL OPERATIONS

3. DATA TRANSFER

4. BOOLEAN VARIABLE MANIPULATIO

3.12. PROGRAMMABLE CLOCK OUT


A 50% duty cycle clock can be programmed to come out on P1.0. This pin,
besides being a regular I/O pin, has two alternate functions. It can be programmed to
input the external clock for Timer/Counter 2 or to output a 50% duty cycle clock ranging
from 61 Hz to 4 MHz (for a 16MHz operating frequency). To configure the
Timer/Counter 2 as a clock generator, bit C/T2 (T2CON.1) must be cleared and bit T20E
(T2MOD.1) must be set. Bit TR2 (T2CON.2) starts and stops the timer. The clock-out
frequency depends on the oscillator frequency and the reload value of Timer 2 capture
registers (RCAP2H, RCAP2L), as shown in following equation.

3.13. CONCLUSION
The AT89S52 is a low-power, high-performance CMOS 8-bit microcomputer
with 8 Kbytes of Flash Programmable and Read Only Memory (PEROM). It is easy to
develop the program for the protection of motor from over and under voltages. The
output of the microcontroller is applied to the relays to switch ON and OFF the motor.

22
CHAPTER 4

AUTO-PROTECTION OF INDUCTION MOTOR AGAINST


VOLTAGE FLUCTUATIONS

4.1 INTRODUCTION
The motor voltage control using the microcontroller mainly includes fault
detection circuit to detect abnormal voltage conditions and the circuit was fully controlled
by the microcontroller and the microcontroller will continuously monitors the voltages of
the three phases and if the voltages goes abnormal then it will switch off the motor until
they are normal.

4.2 REGULATOR
The LM7805 monolithic 3-terminal voltage regulator employs internal current-
limiting, thermal shutdown and safe-area compensation, making them essentially
indestructible. If adequate heat sinking is provided, they can deliver over 1.0A output
current.

4.2.1 PIN CONFIGURATION

Fig 4.1. Regulator

23
They are intended as fixed voltage regulators in wide range of applications
including local (on-card) regulation for elimination of noise and distribution of noise and
distribution problems associated with single-point regulation for elimination. In addition
to use as fixed voltage regulators, these devices can be used with external components to
obtain adjustable output voltages and currents. Considerable was expended to make the
entire series of regulators easy to use and minimize the number of external components.
It is not necessary to bypass the output, although this does improve transient response.
Input bypassing is needed only if the regulator is located far from the filter capacitor of
the power supply.

4.3 DUAL COMPARATOR (LM393)


The LM393 series consists of two independent precision voltage comparators with
an offset voltage specification as low as 2.0 mV max for two comparators which were
designed specifically to operate from a single power supply over a wide range of
voltages. Operation from split power supplies is also possible and the low power supply
current drain is independent of the magnitude of the power supply voltage. These
comparators also have unique characteristics in that the input common-mode voltage
range includes ground, even though operated from a single power supply voltage.

Application areas include limit comparators, simple analog to digital converters,


pulse, square wave and time delay generators, wide range VCO, MOS clock timers,
multivibrators and high voltage digital logic gates. The LM193 series was designed to
directly interface with TTL and CMOS. When operated from both plus and minus power
supplies, the LM193 series will directly interface with MOS logic where their low power
drain is a distinct advantages over standard comparators

4.3.1 FEATURES
 Wide supply

o --- Voltage range: 2.0V to 36V

o --- Single or dual supplies: ±1.0V to ±18V

 Very low supply current drain (0.4mA) --- independent of supply voltage

24
 Low input biasing current: 25nA

 Low input offset current: ±5nA

 Maximum offset voltage: ±3mV

 Input common-mode voltage range includes ground

 Different input voltage range equal to the power supply voltage

 Low output saturation voltage: 250mV at 4mA

 Output voltage compatible with TTL,DTL,ECL,MOS and CMOS logic systems

 Available in the 8-BUMP(12 mil) micro SMD package

4.3.2. PIN DIAGRAM OF LM393

Fig 4.2. Pin Diagram of Dual Comparator LM393

25
4.4 LIQUID CRYSTAL DISPLAY
The most commonly used Character based LCDs are based on Hitachi's HD44780
controller or other which are compatible with HD44580. In this tutorial, we will discuss
about character based LCDs, their interfacing with various microcontrollers, various
interfaces (8-bit/4-bit), programming, special stuff and tricks you can do with these
simple looking LCDs which can give a new look to your application.

Fig. 4.3. LCD Display

The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4
Line LCDs which have only 1 controller and support at most of 80 characters, whereas
LCDs supporting more than 80 characters make use of 2 HD44780 controllers.

Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has 16 Pins
(two pins are extra in both for back-light LED connections).

To send data we simply need to select the data register. Everything is same as the
command routine. Following are the steps:

 Move data to LCD port


 Select data register
 Select write operation

26
 Send enable signal
 Wait for LCD to process the data
Keeping these steps in mind we can write LCD command routine as.
The equivalent C code Keil C compiler. Similar code can be written for SDCC.

4.5 PCB LAYOUT

Fig. 4.4. PCB Layout.

4.5.1 FABRICATION DETAILS


The fabrication of all the demonstration units is carried in the following sequence.

1. Finalizing the total circuit diagram, listing out the components and their sources
of procurement.

2. Procuring the components and testing the components.

27
3. Making layout, preparing the interconnection diagram as per the circuit diagram,
preparing the drilling details, cutting the laminate to the required size

4. Drilling the holes on the board as per the components layout, painting the tracks
on the board as per the inter connection diagram.

5. Removing the un-wanted copper other than track portion. Then cleaning the board
with water, and solder coating the copper tracks to protect the tracks from rusting
or oxidation due to moisture.

6. Assembling the components as per the components layout of the circuit diagram
and soldering components

7. Integrating the total unit inter wiring the unit and final testing the unit. Keeping it
ready for demonstration.

4.5.2 PCB FABRICATION PROCEDURE


The basic material in the manufacture of PCB is copper cladded laminate. The
laminate consists of two or more layers insulating reinforced materials bonded together
under hat and pressure by thermo setting resins used are phenolic or epoxy. The
reinforced materials used are electrical grade paper or woven glass cloth. The laminates
are manufactured by impregnating thin sheets of reinforced materials with the required
resin. The laminates are divided in to various grades by national electrical manufacturers
association (NEMA). The nominal overall thickness of laminate normally used in PCB
industry is 1.6mm with copper cladding on one or two sides.

The next stage in the PCB fabrication is artwork preparation. The artwork (master
drawing) is essentially a manufacturing tool used in the fabrication of PCB’s. It defines
the pattern to be generated on the board. Since the artwork is the first of many process
steps in the fabrication of PCB’s. Normally, in industrial applications the artwork is
drawn on an enlarged scale and photographically reduced to required size. It is not only
easy to draw the enlarged dimensions but also the errors in the artwork correspondingly
get reduced during photo reduction. For ordinary application of simple single sided
boards artwork is made on ivory art paper using drafting aids. After taping on a art paper

28
and photography the image of the photo given is transformed on silk screen printing.
After drying the paint, the etching process is carried out. This is done after drilling of the
holes on the laminate as per the components layout. The etching is the process of
chemically removing unwanted copper from the board.

The next stage after PCB fabrication is solder making the board to prevent tracks
from corrosion and rust formation. Then the components will be assembled on the board
as per the components layout.

The next stage after assembling is the soldering the components. The soldering
may be defined as process where in joining between metal parts is produced by heating to
suitable temperatures using non ferrous filler metals has melting temperatures below the
melting temperatures of the metals to be joined. This non-ferrous intermediate metal is
called solder. The solders are the alloys of lead and tin.

4.6. FAULT DETECTION CIRCUIT

Fig 4.5 Fault detection circuit

The basic functioning of the fault detection circuit can be explained as follows.
The center tapped step down transformer is supplied on the primary side from one of

29
three phases of the supply and its output voltage is rectified by a full wave rectifier. The
output from the rectifier is fed to the two operational amplifiers through a capacitor.
During the normal working conditions without any faults the zener diode connected to
the inverting and non-inverting terminals of the operational amplifiers IC2a and IC2b
respectively will be charged to a voltage of 4.2v and the output voltage of the two
opamps will be zero. This voltage across zener diode which remains constant is supplied
to the two opamps as a reference voltage. Of the two opamps one will be operating in
inverting mode (IC2a) and the other in non-inverting mode (IC2b). When the condition of
over voltage occurs, the voltage at the non inverting terminal of the opamp, IC2b will be
more than 4.2 volts as a result of this the output voltage of this opamp will be high and
this error signal will be fed to the micro controller which trips the relay and thus
disconnects the motor from the supply. Similarly the opamp (IC2a) sends an error signal
during under voltage condition.

Similar circuits are used for other two phases. The total fault detection circuit
shown below.

30
Fig 4.6. Three phase fault detection circuit

31
4.7. MAIN CIRCUIT DIAGRAM

Fig 4.7. Circuit Diagram of Automatic Voltage Control of IM using Microcontroller

32
4.7.1. CIRCUIT EXPLANATION

The Circuit diagram consists of three voltage sensor circuits and a relay driver
circuit, power supply circuit and the Microcontroller circuit.

The Main part of the above circuit diagrams is the Microcontroller AT89S52. The
Microcontroller will switch on the motor only the following conditions are satisfied.

 If the three phase voltage was normal

 If all the phases are present

The Three phase voltages are checked by dual opamp IC LM393. It checks the
input voltage with the reference voltage. The off time was set by the rotary switch for ½
hr to 2hr.

For driver the relay we are using NPN transistor is used as an current amplifier.
The Microcontroller will control the whole circuit according to program burned on its
ROM. All the conditions are displayed over the LCD display.

The power supply section is the important one. It should deliver constant output
regulated power supply for successful working of the project. An 0-12V/500mA
transformer is used for our purpose the primary of this transformer is connected into main
supply through on/off switch and fuse for protecting from overload and short circuit
protection. The secondary is connected to the diodes convert from 12V AC to 12V DC
voltage. Which is further regulated to +5v, by using IC 7805.

33
4.8. FLOW CHART
START

SWITCH OFF MOTOR


AND ALL LEDs

CHECK
ABNORMAL SWITCH ON
PHASE
MOTOR OFF
VOLTAGE
RELAY
S

NORM
AL
CHECK PRESSE
AUTO
ON
CHECK
NOT
PHASE
VOLTAGE
ABNORMA
S
NORMAL

SWITCH ON
MOTOR ON
RELAY

CHECK PRESSE CHECK


AUTO ROTATOR
OFF SWITCH

NOT
CALL
APPROXIMATE
DELAY

Fig 4.8. Flow Chart

34
4.9. PROGRAM
The actual used for programming the micro controller is presented below.

INCLUDE REG_52.PDF

PH1 EQU P3.0

PH2 EQU P3.1

PH3 EQU P3.2

LED1 EQU P1.0 ; AUTO ON

LED2 EQU P1.1 ; AUTO OFF

LED3 EQU P1.2 ; MOTOR

; ONRLY EQU P2.0

OFFRLY EQU P2.1

AUTOON EQU P2.6

AUTOOFF EQU P2.7

TIM1 EQU P2.2

TIM2 EQU P2.3

TIM3 EQU P2.4

TIM4 EQU P2.5

; ***LCD CONTROL***

LCD_RS EQU P0.0 ; LCD REGISTER SELECT LINE

LCD_E EQU P0.1 ; LCD ENABLE LINE

35
LCD_DB4 EQU P0.3 ; PORT 1 IS USED FOR DATA

LCD_DB5 EQU P0.4 ; USED FOR DATA

LCD_DB6 EQU P0.5 ; FOR DATA

LCD_DB7 EQU P0.6 ; FOR DATA

; ***CURSOR CONTROL INSTRUCTIONS***

OFFCUR EQU 0CH

BLINKCUR EQU 0DH

; ***DISPLAY CONTROL INSTRUCTIONS***

CLRDSP EQU 01H

ONDSP EQU 0CH

; ***SYSTEM INSTRUCTIONS***

CONFIG EQU 28H ; 4-BIT DATA,2 LINES,5X7 MATRIX LCD

ENTRYMODE EQU 6 ; INCREMENT CURSOR DON'T SHIFT DISPLAY

; ---------==========----------==========---------=========---------

DSEG ; this is internal data memory

ORG 20H ; Bit addressable memory

36
FLAGS: DS 1

LD1 BIT FLAGS.0

LD2 BIT FLAGS.1

MOT BIT FLAGS.2

NEW: DS 1

NEW1 BIT NEW.0

NEW2 BIT NEW.1

NEW3 BIT NEW.2

NEW4 BIT NEW.3

NEW5 BIT NEW.4

MOTT BIT NEW.5

TIM: DS 1 ; scrolling display

SCRL: DS 1 ; count for scr disp

OFF_TIME: DS 1

CSEG ; Code begins here

;---------==========----------==========---------=========---------

; PROCESSOR INTERRUPT AND RESET VECTORS

;---------==========----------==========---------=========---------

ORG 00H ; Reset

JMP MAIN

37
ORG 001BH ; Timer Interrupt1

JMP SCROLL

; ---------==========----------==========---------=========---------

; Main routine. Program execution starts here.

; ---------==========----------==========---------=========---------

MAIN:

MOV SP,#60H

MOV FLAGS,#00H

MOV NEW,#00H

MOV OFF_TIME,#00H

CLR OFFRLY

SETB LED1

SETB LED2

SETB LED3

CALL RESETLCD4

CALL INITLCD4

CALL TITLES

SETB NEW2

MOV TMOD,#11H ; Scrolling Display

MOV TL1,#08H

MOV TH1,#01H

SETB ET1

MOV SCRL,#00H

38
MOV TIM,#120

SETB TR1

SETB EA

UP: SETB PH1 ;

SETB PH2

SETB PH3

SETB AUTOON

SETB AUTOOFF

; Chk if motor is on

JNB AUTOON, HJ1 ; chk auto on

JNB AUTOOFF, HJ2 ; chk auto off

CALL DISP

JNB MOT, UP

JNB PH1, MOTOR_OFF

JB PH2, MOTOR_OFF

JB PH3, MOTOR_OFF

AJMP UP

UP4: JNB AUTOON,$ ;DEBOUNCE FOR AUTO ON KEY

CALL DELAY1

JNB AUTOON,$

SETB LED1

39
AJMP UP

HJ1: JB MOT, UP

; AUTO ON

JNB AUTOON,$

CALL DELAY1

JNB AUTOON,$

CLR LED1

UP3: JNB AUTOON,UP4

SETB NEW4

CALL DISP

JNB PH1,UP3

JB PH2,UP3

JB PH3,UP3

SETB OFFRLY

SETB MOT ;set motor bit

CLR LED3

CLR LD1

SETB MOTT

AJMP UP

HJ2: ; AUTO OFF

JNB AUTOOFF,$

CALL DELAY1

40
JNB AUTOOFF,$

JNB MOT, UP1

SETB NEW5

CLR LED2

CALL DELAY

AJMP SET_TIMER

UP1: AJMP UP

MOTOR_OFF:

JB LD1, UP1 ; chk motor status skip if motor is in off

SETB LED1

SETB LED2

SETB LED3

CLR MOT

CLR TR0

CLR TF0

CLR OFFRLY

SETB LD1

CLR NEW5

CLR NEW4

CLR MOTT

AJMP UP

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SET_TIMER:

SETB TIM1

41
SETB TIM2

SETB TIM3

SETB TIM4

SETB PH1

SETB PH2

SETB PH3

SETB AUTOOFF

JB TIM1,VB1

MOV OFF_TIME,#01H

CALL HALF_HR_DELAY

AJMP MOTOR_OFF

VB1: JB TIM2,VB2

MOV OFF_TIME,#02H

CALL HALF_HR_DELAY

CALL HALF_HR_DELAY

AJMP MOTOR_OFF

VB2: JB TIM3,VB3

MOV OFF_TIME,#03H

CALL HALF_HR_DELAY

CALL HALF_HR_DELAY

CALL HALF_HR_DELAY

AJMP MOTOR_OFF

VB3: JB TIM4, VB4

MOV OFF_TIME,#04H

42
CALL HALF_HR_DELAY

CALL HALF_HR_DELAY

CALL HALF_HR_DELAY

CALL HALF_HR_DELAY

AJMP MOTOR_OFF

VB4: AJMP UP

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

HALF_HR_DELAY:

MOV TMOD, #11H ; time delay for 1/2 hour

MOV R5, #30 ; count for 1/2 hour (30 for 1/2 Hour)

TP1: MOV R6,#60 ;count for 1 min (60 FOR 1 MIN)

TP: CPL LED2

MOV R7,#20

; Start timer for 1 SEC (20 for 1 Sec


(50ms X 20=1 sec)

UP2: MOV TL0, #0AAH

MOV TH0, #3CH

SETB TR0

FGD: JNB AUTOOFF, DFS

JNB PH1, MOTOR_OFF1

JB PH2, MOTOR_OFF1

JB PH3, MOTOR_OFF1

JNB TF0, FGD

CLR TR0

43
CLR TF0

DJNZ R7, UP2

DJNZ R6, TP

DJNZ R5, TP1

RET

UPP: AJMP UP

MOTOR_OFF1:

JB LD1, UPP ; chk motor status skip if motor is in off

SETB LED3

SETB MOT

CLR OFFRLY

DFS: CLR TR0

CLR TF0

CLR MOTT

RET

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

DELAY:

MOV R1, #0FFH

RE1: MOV R2, #0FFH

RE: NOP

DJNZ R2, RE

DJNZ R1, RE1

RET

44
;**********************************************************

DELAY1:

MOV R1, #9FH

REA1: MOV R2, #0FFH

REA: NOP

DJNZ R2, REA

DJNZ R1, REA1

RET

;**********************************************************

;##########################################################

; DISPLAY ROUTINES

;##########################################################

TITLES:

MOV DPTR,#MSAG

CALL LCD_MSG

RET

MSAG:

DB 1H, 81H,'3 Phase Motor', 0C0H,'Protection @ LCD', 00H

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TITLE1:

MOV DPTR,#MSAG1

CALL LCD_MSG

RET

MSAG1:

45
DB 1H, 81H,'## R Phase: ##', 0C1H,'Voltage Normal', 00H

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TITLE2:

MOV DPTR, #MSAG2

CALL LCD_MSG

RET

MSAG2:

DB 1H, 81H,'## Y Phase: ##', 0C1H,'Voltage Normal', 00H

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TITLE3:

MOV DPTR, #MSAG3

CALL LCD_MSG

RET

MSAG3:

DB 1H, 81H,'## B Phase: ##', 0C1H,'Voltage Normal', 00H

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TITLE11:

MOV DPTR,#MSAG4

CALL LCD_MSG

RET

MSAG4:

DB 1H, 81H,'## R Phase: ##', 0C0H,'Voltage ABNormal', 00H

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TITLE21:

MOV DPTR,#MSAG5

CALL LCD_MSG

46
RET

MSAG5:

DB 1H, 81H,'## Y Phase: ##', 0C0H,'Voltage ABNormal', 00H

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TITLE31:

MOV DPTR, #MSAG6

CALL LCD_MSG

RET

MSAG6:

DB 1H, 81H,'## B Phase: ##', 0C0H,'Voltage ABNormal', 00H

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MOT_OFF:

MOV DPTR,#MSAG7

CALL LCD_MSG

RET

MSAG7:

DB 1H, 80H,'## MOTOR OFF ##',0C0H,'@@@@@@@@@@@@@@@@',00H

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MOT_ON:

MOV DPTR,#MSAG8

CALL LCD_MSG

RET

MSAG8:

DB 1H,80H,'$$$ MOTOR ON $$$',0C0H,'@@@@@@@@@@@@@@@@',00H

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

AUTO_OFF_ON:

47
MOV DPTR,#MSAG9

CALL LCD_MSG

RET

MSAG9:

DB 1H,81H,'## AUTO OFF ##',0C2H,'@@@ ON @@@',00H

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

AUTO_OFF_OFF:

MOV DPTR,#MSAG10

CALL LCD_MSG

RET

MSAG10:

DB 1H,81H,'## AUTO OFF ##',0C2H,'@@@ OFF @@@',00H

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

AUTO_ON_ON:

MOV DPTR,#MSAG11

CALL LCD_MSG

RET

MSAG11:

DB 1H,81H,'## AUTO ON ##',0C2H,'@@@ ON @@@',00H

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

AUTO_ON_OFF:

MOV DPTR,#MSAG12

CALL LCD_MSG

RET

MSAG12:

DB 1H, 81H,'## AUTO ON ##', 0C2H,’@@@ OFF @@@’, 00H

48
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TIMER1:

MOV DPTR,#MSAG13

CALL LCD_MSG

RET

MSAG13:

DB 1H,80H,'OFF Timer: 30Min',00H

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TIMER2:

MOV DPTR,#MSAG14

CALL LCD_MSG

RET

MSAG14:

DB 1H, 80H,'OFF Timer: 1Hr', 00H

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TIMER3:

MOV DPTR,#MSAG15

CALL LCD_MSG

RET

MSAG15:

DB 1H, 80H,'OFF Timer: 1:30', 00H

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TIMER4:

MOV DPTR,#MSAG16

CALL LCD_MSG

RET

49
MSAG16:

DB 1H, 80H,'OFF Timer: 2:00', 00H

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TIMER5:

MOV DPTR,#MSAG17

CALL LCD_MSG

RET

MSAG17:

DB 0C2H,’Time: ‘00H

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

;**********************************************************

; INITIALIZE THE LCD 4-BIT MODE

;**********************************************************

INITLCD4:

CLR LCD_RS ; LCD REGISTER SELECT LINE

CLR LCD_E ; ENABLE LINE

MOV R4, #CONFIG; FUNCTION SET - DATA BITS,

; LINES, FONTS

CALL WRLCDCOM4

MOV R4, #ONDSP; DISPLAY ON

CALL WRLCDCOM4

MOV R4, #ENTRYMODE; SET ENTRY MODE

CALL WRLCDCOM4; INCREMENT CURSOR RIGHT, NO SHIFT

MOV R4, #CLRDSP; CLEAR DISPLAY, HOME CURSOR

CALL WRLCDCOM4

RET

50
; **********************************************************

; SOFTWARE VERSION OF THE POWER ON RESET

; **********************************************************

RESETLCD4:

CLR LCD_RS ; LCD REGISTER SELECT LINE

CLR LCD_E ; ENABLE LINE

CLR LCD_DB7 ; SET BIT PATTERN FOR...

CLR LCD_DB6 ; ... POWER-ON-RESET

SETB LCD_DB5

SETB LCD_DB4

SETB LCD_E ; START ENABLE PULSE

CLR LCD_E ; END ENABLE PULSE

MOV A, #4 ; DELAY 4 MILLISECONDS

CALL MDELAY

SETB LCD_E ; START ENABLE PULSE

CLR LCD_E ; END ENABLE PULSE

MOV A, #1 ; DELAY 1 MILLISECOND

CALL MDELAY

SETB LCD_E ; START ENABLE PULSE

CLR LCD_E ; END ENABLE PULSE

MOV A, #1 ; DELAY 1 MILLISECOND

CALL MDELAY

CLR LCD_DB4 ; SPECIFY 4-BIT OPERATION

SETB LCD_E ; START ENABLE PULSE

CLR LCD_E ; END ENABLE PULSE

51
MOV A, #1 ; DELAY 1 MILLISECOND

CALL MDELAY

MOV R4, #CONFIG; FUNCTION SET

CALL WRLCDCOM4

MOV R4, #08H ; DISPLAY OFF

CALL WRLCDCOM4

MOV R4, #1 ; CLEAR DISPLAY, HOME CURSOR

CALL WRLCDCOM4

MOV R4,#ENTRYMODE ; SET ENTRY MODE

ACALL WRLCDCOM4

JMP INITLCD4

; **********************************************************

; SUB WRITES A COMMAND WORD TO THE LCD

; COMMAND MUST BE PLACED IN R4 BY CALLING PROGRAM

; **********************************************************

WRLCDCOM4:

CLR LCD_E

CLR LCD_RS ; SELECT SEND COMMAND

PUSH ACC ; SAVE ACCUMULATOR

MOV A, R4 ; PUT DATA BYTE IN ACC

MOV C, ACC.4 ; LOAD HIGH NIBBLE ON DATA BUS

MOV LCD_DB4, C ; ONE BIT AT A TIME USING...

MOV C, ACC.5 ; BIT MOVE OPERATOINS

MOV LCD_DB5, C

MOV C, ACC.6

52
MOV LCD_DB6, C

MOV C, ACC.7

MOV LCD_DB7, C

SETB LCD_E ; PULSE THE ENABLE LINE

CLR LCD_E

MOV C, ACC.0 ; SIMILARLY, LOAD LOW NIBBLE

MOV LCD_DB4, C

MOV C, ACC.1

MOV LCD_DB5, C

MOV C, ACC.2

MOV LCD_DB6, C

MOV C, ACC.3

MOV LCD_DB7, C

CLR LCD_E

SETB LCD_E ; PULSE THE ENABLE LINE

CLR LCD_E

CALL MADELAY

POP ACC

RET

; **********************************************************

; SUB TO WRITE A DATA WORD TO THE LCD

; DATA MUST BE PLACED IN R4 BY CALLING PROGRAM

; **********************************************************

WRLCDDATA:

CLR LCD_E

SETB LCD_RS ; SELECT SEND DATA

53
PUSH ACC ; SAVE ACCUMULATOR

MOV A, R4 ; PUT DATA BYTE IN ACC

MOV C, ACC.4 ; LOAD HIGH NIBBLE ON DATA BUS

MOV LCD_DB4, C ; ONE BIT AT A TIME USING...

MOV C, ACC.5 ; BIT MOVE OPERATOINS

MOV LCD_DB5, C

MOV C, ACC.6

MOV LCD_DB6, C

MOV C, ACC.7

MOV LCD_DB7, C

SETB LCD_E ; PULSE THE ENABLE LINE

CLR LCD_E

MOV C, ACC.0 ; SIMILARLY, LOAD LOW NIBBLE

MOV LCD_DB4, C

MOV C, ACC.1

MOV LCD_DB5, C

MOV C, ACC.2

MOV LCD_DB6, C

MOV C, ACC.3

MOV LCD_DB7, C

CLR LCD_E

SETB LCD_E ; PULSE THE ENABLE LINE

CLR LCD_E

NOP

NOP

POP ACC

54
RET

; **********************************************************

; SUB TAKES THE STRING IMMEDIATELY FOLLOWING THE CALL AND

; DISPLAYS ON THE LCD. STRING MUST BE TERMINATED WITH A

; NULL (0).

; **********************************************************

LCD_MSG:

CLR A ; Clear Index

MOVC A,@A+DPTR ; Get byte pointed by Dptr

INC DPTR ; Point to the next byte

JZ LCD_Msg9 ; Return if found the zero (end of strings)

CJNE A,#001H,Lcd_Msg1 ; Check if is a Clear Command

MOV R4, A

CALL WRLCDCOM4 ; If yes, write it as command to LCD

JMP LCD_MSG ; Go get next byte from strings

Lcd_Msg1: CJNE A, #0FFH, FLL ; Check for displaying full character

MOV R4, A

CALL WRLCDDATA

JMP LCD_MSG

FLL: CJNE A, #080h,$+3 ; Data or Address? If => 80h then is address.

JC Lcd_Msg_Data ; Carry will be set if A < 80h (Data)

MOV R4, A

CALL WRLCDCOM4 ; Carry not set if A=>80, it is address

JMP Lcd_Msg_Data ; Go get next byte from strings

55
Lcd_Msg_Data:

MOV R4, A

CALL WRLCDDATA ; It was data, write it to LCDs

JMP Lcd_Msg ; Go get next byte from strings

Lcd_Msg9:

RET ; Return to Caller

; **********************************************************

; 1 MILLISECOND DELAY ROUTINE

; **********************************************************

MDELAY:

PUSH ACC

MOV A,#0A6H

MD_OLP:

INC A

NOP

NOP

NOP

NOP

NOP

NOP

NOP

NOP

JNZ MD_OLP

NOP

56
POP ACC

RET

MADELAY:

PUSH ACC

MOV A,#036H

MAD_OLP:

INC A

NOP

NOP

NOP

NOP

NOP

NOP

NOP

NOP

JNZ MAD_OLP

NOP

POP ACC

RET

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SCROLL:

DJNZ TIM, GAHJ1

CLR TR1

INC SCRL

DCDF: MOV A, SCRL

CJNE A,#01H,DFV1

57
JB NEW1, DFF1 ; CHK R VOL

CALL TITLE1

AJMP GAG

GAHJ1: AJMP GAHJ

DFF1: CALL TITLE11

AJMP GAG

DFV1: CJNE A,#02H,DFV2

JB NEW2, DFF2 ; CHK Y VOL

CALL TITLE2

AJMP GAG

DFF2: CALL TITLE21

AJMP GAG

DFV2: CJNE A,#03H,DFV3

JB NEW3,DFF3 ;CHK B VOL

CALL TITLE3

AJMP GAG

DFF3: CALL TITLE31

AJMP GAG

DFV3: CJNE A,#04H,DFV4 ;MOTOR NO/OFF

JB MOTT,DFF4

CALL MOT_OFF

AJMP GAG

DFF4: CALL MOT_ON

AJMP GAG

58
DFV4: CJNE A, #05H, DFV5 ; AUTO ON

JNB NEW4, DFF5

CALL AUTO_ON_ON

AJMP GAG

DFF5: CALL AUTO_ON_OFF

AJMP GAG

DFV5: CJNE A,#06H,DFV6 ;AUTO OFF

JNB NEW5, DFF6

CALL AUTO_OFF_ON

AJMP GAG

DFF6: CALL AUTO_OFF_OFF

AJMP GAG

DFV6: MOV SCRL, #00H

GAG: MOV TIM, #75

GAHJ: MOV TL1, #08H

MOV TH1, #01H

SETB TR1

RETI

DISP: SETB PH1

59
SETB PH2

SETB PH3

JNB PH1, DRE1

CLR NEW1

AJMP DEE1

DRE1: SETB NEW1

DEE1: JB PH2, DRE2

CLR NEW2

AJMP DEE2

DRE2: SETB NEW2

DEE2: JB PH3, DRE3

CLR NEW3

RET

DRE3: SETB NEW3

RET

END

4.10. CONCLUSION
Fault detection circuit is used for detection of the over and under voltages. From
the fault detection circuit output is given to microcontroller, by the program stored in the
microcontroller it activates the ON relay or OFF relay. The output of the microcontroller
is applied to the relays to switch ON and OFF the motor.

60
61
CHAPTER 5

EXPERMENTAL RESULTS AND CONCLUSION


5.1RESULT
This project concerns with experimental studies on the protection of induction
motor form over and under voltage and single phasing.

The experimental is conducted by connecting wires form experimental kit to


starter of the motor .our end result is the effective and reliable protection of three phase
induction motor from the faults of unbalanced supply voltages and single phasing.

5.2 CONCLUSION
In this project we are using LM 393 dual comparator to compare over/under
voltage.

Addition to this we are using two switches one for auto on and another for auto
off. Here the motor will run automatically when auto on is set and it will stop the motor
automatically after a particular time if auto off is set.

According to the program written in to the microcontroller the circuit will


automatically ON/OFF the motor .The prime use of the microcontroller is to protect the
motor from over and under voltages and to start and stop the motor automatically.

Microcontroller sends the signal to relays which is connected to the starter of


motor. According to the signal from controller the relay will start /stop the motor.

We have successfully completed the code required for the protection of the three
phase induction motor from the faults of unbalanced supply voltages and signal phasing.

The circuit is fabricated, the code is copied in to the microcontroller and we got
the desired results.

62
5.3 APPLICATION
This project can be used in any type of three phase motors, and the motor with any rating
can be easily adopted by just connecting the relay connections to the starter of the motor.

 Agricultural motors

 Industrial motors

5.4. FUTURE ENHANCEMENTS


 A real time clock can be added so that the ON time and the OFF
time of the motor can be entered and the system will switch ON the motor
and it will switch OFF at the predetermined time.

 An electronic lock can be provided so that unauthorized persons


can‘t use the motor.

 Higher application.

 Wireless implementation by FM/RF.

 This project can be extend to protect the induction motor form


phasor faults and phase reversal.

63
BIBLIOGRAPHY:
1. P.S Bimbhra, Electric Machinery, Khanna Publishers, Edition Seventh 2004
August

2. Samsung, E-book -Networking and Internetworking with Microcontrollers

3. www.8051projects.info

4. www.lmphotonics.com

5. www.taylorandfrancis.com

6. www.metapress.com_protection techniques

7. www.ia.omron.com_relays

64
Appendix 1
LM7805 Regulator
LM78LXX SERIES
3-TERMINAL POSITIVE REGULATORS
GENERAL DESCRIPTION
The LM78LXX series of three terminal positive regulators is available with several fixed
output voltages making them useful in a wide range of applications. When used as a
zener diode/resistor combination replacement, the LM78LXX usually results in an
effective output impedance improvement of two orders of magnitude, and lower
quiescent current. These regulators can provide local on card regulation, eliminating the
distribution problems associated with single point regulation. The voltages available
allow the LM78LXX to be used in logic systems, instrumentation, HiFi, and other solid
state electronic equipment.
The LM78LXX is available in the plastic TO-92 (Z) package, the plastic SO-8 (M)
package and a chip sized package (8-Bump micro SMD) using National’s micro SMD
package technology. With adequate heat sinking the regulator can deliver 100mA output
current. Current limiting is included to limit the peak output current to a safe value. Safe
area protection for the output transistors is provided to limit internal power dissipation. If
internal power dissipation becomes too high for the heat sinking provided, the thermal
shutdown circuit takes over preventing the IC from overheating.
Features
• LM78L05 in micro SMD package
• Output voltage tolerances of ±5% over the temperature range
• Output current of 100mA
• Internal thermal overload protection n Output transistor
safe area protection n Internal short circuit current limit
• Available in plastic TO-92 and plastic SO-8 low profile packages
• No external components
• Output voltages of 5.0V, 6.2V, 8.2V, 9.0V, 12V, 15V n See AN-1112
for micro SMD considerations

65
CONNECTION DIAGRAMS

SO-8 Plastic (M) (TO-92)


Plastic
(Narrow Body) Package (Z)

Bottom
View
Top View

Micro SMD Marking


Orientation
8-Bump micro SMD

00774424

Top View
(Bump Side Down)
00774433

Top View

66
Typical Performance Characteristics
Maximum Average Power Dissipation (Z Package) Peak Output Current

00774414
00774416

Dropout Voltage Ripple Rejection

00774417

00774418

Output Impedance Quiescent Current

67
TYPICAL APPLICATIONS
Fixed Output Regulator

00774408
*Required if the regulator is located more than 3" from the power supply filter.
**See (Note 4) in the electrical characteristics table.

Adjustable Output Regulator

00774409

VOUT = 5V + (5V/R1 + IQ) R2


3 IQ, load regulation (Lr) ≈ [(R1 + R2)/R1] (Lr of LM78L05)

Current Regulator

00774410

IOUT = (VOUT/R1) + IQ
>IQ = 1.5mA over line and load changes

5V, 500mA Regulator with Short Circuit Protection

68
00774411

*Solid tantalum. **Heat sink Q1. ***Optional: Improves ripple rejection and transient response. Load Regulation: 0.6% 0 ≤ IL ≤ 250mA pulsed with

tON = 50ms

±15V, 100mA Dual Power Supply

Variable Output Regulator 0.5V-18V

Solid tatalum
VOUT = VG + 5V, R1 = (−VIN/IQ LM78L05)

VOUT = 5V (R2/R4) for (R2 + R3) = (R4 + R5)

A 0.5V output will correspond to (R2/R4) = 0.1(R3/R4) = 0.9

69
Appendix 2
THEORY OF MICROCONTROLLER

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

1. DESCRIPTION
The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K
bytes of in-system programmable Flash memory. The device is manufactured using
Atmel’s high-density nonvolatile memory technology and is compatible with the indus-
try-standard 80C51 instruction set and pinout. The on-chip Flash allows the program
memory to be reprogrammed in-system or by a conventional nonvolatile memory pro-
grammer. By combining a versatile 8-bit CPU with in-system programmable Flash on a
monolithic chip, the Atmel AT89S52 is a powerful microcontroller which provides a
highly-flexible and cost-effective solution to many embedded control applications.

The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of
RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-
vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and
clock circuitry. In addition, the AT89S52 is designed with static logic for operation down
to zero frequency and supports two software selectable power saving modes. The Idle

70
Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt
system to continue functioning. The Power-down mode saves the RAM con-tents but
freezes the oscillator, disabling all other chip functions until the next interrupt or
hardware reset.

AUXR: Auxiliary
Register

Address = Reset Value =


AUXR 8EH XXX00XX0B
Not Bit
Addressable

- DISA
– - – WDIDLE DISRTO – – LE

Bit 7 6 5 4 3 2 1 0

Reserved for
– future expansion
DISAL Disable/Enable
E ALE
DISAL Operatin
E g Mode
0 ALE is emitted at a constant rate of 1/6 the oscillator frequency
1 ALE is active only during a MOVX or MOVC instruction
DISRTO Disable/Enable Reset out
DISRTO
0 Reset pin is driven High after WDT times out
1 Reset pin is input only
WDIDLE Disable/Enable WDT in IDLE mode
WDIDLE
0 WDT continues to count in IDLE mode
1 WDT halts counting in IDLE mode

Dual Data Pointer Registers: To facilitate accessing both internal and external data
memory, two banks of 16-bit Data Pointer Registers are provided: DP0 at SFR address
locations 82H-83H and DP1 at 84H-85H. Bit DPS = 0 in SFR AUXR1 selects DP0 and
DPS = 1 selects DP1. The user should ALWAYS initialize the DPS bit to the appropriate
value before accessing the respective Data Pointer Register.

71
Power off Flag: The Power Off Flag (POF) is located at bit 4 (PCON.4) in the PCON
SFR. POF is set to “1” during power up. It can be set and rest under software control and
is not affected by reset

AUXR1: Auxiliary
Register 1

AUXR Address = Reset Value =


1 A2H XXXXXXX0B
Not Bit
Addressable

-- -- -- -- -- -- -- DPS

B
i
t 7 6 5 4 3 2 1 0

Reserved for future


– expansion
Data Pointer
DPS Register Select
DPS
0 Selects DPTR Registers DP0L, DP0H
1 Selects DPTR Registers DP1L, DP1H

72
T2MOD – Timer 2 Mode Control Register

T2MOD Address =
0C9H Reset Value = XXXX XX00B
Not Bit
Addressable

– – – – – – T2OE DCEN

Bit 7 6 5 4 3 2 1 0

Symbol
Function


Not implemented, reserved for future

T2OE Timer 2 Output Enable bit

DCEN When set, this bit allows Timer 2 to be configured as an up/down counter

Figure 1 shows Timer 2 automatically counting up when DCEN = 0. In this mode, two
options are selected by bit EXEN2 in T2CON. If EXEN2 = 0, Timer 2 counts up to
0FFFFH and then sets the TF2 bit upon overflow. The overflow also causes the timer
registers to be reloaded with the 16-bit value in RCAP2H and RCAP2L. The values in
Timer in Capture ModeRCAP2H and RCAP2L are preset by software. If EXEN2 = 1, a
16-bit reload can be triggered either by an overflow or by a 1-to-0 transition at external
input T2EX. This transition also sets the EXF2 bit. Both the TF2 and EXF2 bits can

73
generate an interrupt if enabled. Setting the DCEN bit enables Timer 2 to count up or
down, as shown in Figure 10-2. In this mode, the T2EX pin controls the direction of the
count. Logic 1 at T2EX makes Timer 2 count up. The timer will overflow at 0FFFFH and
set the TF2 bit. This overflow also causes the 16-bit value in RCAP2H and RCAP2L
to be reloaded into the timer registers, TH2 and TL2,respectively.
Logic 0 at T2EX makes Timer 2 count down. The timer underflows when
TH2 and TL2 equal the values stored in RCAP2H and RCAP2L. The underflow sets the
TF2 bit and causes 0FFFFH to be reloaded into the timer registers.

The EXF2 bit toggles whenever Timer 2 overflows or underflows and can be used as a
17th bit of resolution. In this operating mode, EXF2 does not flag an interrupt.

Table 2 Interrupt Enable (IE) Register


(MSB) (LSB)

EA – ET2 ES ET1 EX1 ET0 EX0

Enable Bit = 1 enables the interrupt.


Enable Bit = 0 disables the interrupt.

Symbol Position Function

Disables all interrupts. If EA = 0, no interrupt is acknowledged.


If EA = 1, each
EA IE.7 interrupt source is individually enabled or disabled by setting or
clearing its enable bit.

– IE.6 Reserved.

ET2 IE.5 Timer 2 interrupt enable bit.

ES IE.4 Serial Port interrupt enable bit.

ET1 IE.3 Timer 1 interrupt enable bit.

EX1 IE.2 External interrupt 1 enable bit.

74
ET0 IE.1 Timer 0 interrupt enable bit.

EX0 IE.0 External interrupt 0 enable bit.

User software should never write 1s to reserved bits, because they may be used in future AT89
products.

Figure 13 .1.Interrupt Sources

0 IE
0
INT1
1

TF0

0
IE
INT1 0

TF1

T1

R1

TF2

EXF
2

75
Table 3. Serial Programming Instruction Set

Instruction
Format

Instruction Byte 1 Byte 2 Byte 3 Byte 4 Operation

xxx
1010 1100 0101 0011 xxxx xxxx xxxx x
Enable Serial
Programming 0110 1001 Programming
Enable
(Output on while RST is high
MISO)

xxx
1010 1100 100x xxxx xxxx xxxx xxxx x Chip Erase Flash memory
Chip Erase
array

4A7A6A5A

D3D2D1D0
A3A2A1A0

D7D6D5D4
Read Program
Memory 0010 0000 xxx Read data from Program
A9A8
A11A10
A12

(Byte Mode) memory in the byte mode


0A3A2A1A

Write Program

D3D2D1D0
A7A6A5A4

D7D6

Memory 0100 0000 xxx Write data to Program


D5D4
A9A8
A11A10
A12

(Byte Mode) memory in the byte mode

Write Lock xxx Write Lock bits. See Note


Bits (1) 1010 1100 1110 00B 1B 2 xxxx xxxx xxxx x (1).
xx
LB2LB1

0010 0100 xxxx xxxx xxxx xxxx x xx Read back current status of
LB3

Read Lock the lock bits (a


Bits programmed
lock bit reads back as a
“1”)

A
7
x
x
A9A8
A11A10

Read Signature 0010 1000 xxx x xxx0 Signature Byte Read Signature Byte
A12

Bytes

Read Program
A11A1
A9A8
A12

Memory 0011 0000 xxx Byte 0 Byte 1... Read data from Program

76
0
Byte 255 memory in the Page Mode
(Page Mode)
(256 bytes)

0101 0000 xxx Byte 0 Byte 1... Write data to Program

A9A8
A11A10
Write Program

A12
Memory
Byte 255 memory in the Page Mode
(Page Mode)
(256 bytes)

After Reset signal is high, SCK should be low for at least 64 system clocks before it goes
high to clock in the enable data bytes. No pulsing of Reset signal is necessary. SCK
should be no faster than 1/16 of the system clock at XTAL1.
For Page Read/Write, the data always starts from byte 0 to 255. After the command byte
and upper address byte are latched, each byte thereafter is treated as data until all 256
bytes are shifted in/out. Then the next instruction will be ready to be decoded.

28. AC Characteristics
Under operating conditions, load capacitance for Port 0, ALE/PROG, and PSEN = 100
pF; load capacitance for all other outputs = 80 pF.

28.1 External Program and Data Memory Characteristics


Symbol Parameter Min Max Min Max Units

1/t
CLCL Oscillator Frequency 0 33 MHz
t
LHLL ALE Pulse Width 127 2tCLC L-40 ns
t
AVLL Address Valid to ALE Low 43 tC LCL-25 ns
t
LLAX Address Hold After ALE Low 48 tC LCL-25 ns
t
LLIV ALE Low to Valid Instruction In 233 4tCL CL-65 ns
t
LLPL ALE Low to PSEN Low 43 tC LCL-25 ns
t
PLPH PSEN Pulse Width 205 3tCLC L-45 ns
t
PLIV PSEN Low to Valid Instruction In 145 3tCL CL-60 ns
t
PXIX Input Instruction Hold After PSEN 0 0 ns
t
PXIZ Input Instruction Float After PSEN 59 tCL CL-25 ns
t t
PXAV PSEN to Address Valid 75 CLCL-8 ns
t
AVIV Address to Valid Instruction In 312 5tCL CL-80 ns

77
t
PLAZ PSEN Low to Address Float 10 10 ns
t
RLRH RD Pulse Width 400 6tCLCL-100 ns
t
WLW
H WR Pulse Width 400 6tCLCL-100 ns
t
RLDV RD Low to Valid Data In 252 5tCL CL-90 ns
t
RHDX Data Hold After RD 0 0 ns
t
RHDZ Data Float After RD 97 2tCL CL-28 ns
t
LLDV ALE Low to Valid Data In 517 8tCLCL-150 ns
t
AVDV Address to Valid Data In 585 9tCLCL-165 ns
t
LLWL ALE Low to RD or WR Low 200 300 3tCLC L-50 3tCLC L+50 ns
t
AVWL Address to RD or WR Low 203 4tCLC L-75 ns
t
QVWX Data Valid to WR Transition 23 tC LCL-30 ns
t
QVWH Data Valid to WR High 433 7tCLCL-130 ns

t
WHQX Data Hold After WR 33 tC LCL-25 ns

t
RLAZ

RD Low to Address Float 0 ns


0

t
WHLH RD or WR High to ALE High 43 123 tC LCL-25 tC LCL+25 ns

78
Appendix 3
LM193/LM293/LM393/LM2903

Low Power Low Offset Voltage Dual Comparators

General Description
The LM193 series consists of two independent precision voltage comparators with an
offset voltage specification as low as 2.0 mV max for two comparators which were
designed specifically to operate from a single power supply over a wide range of
voltages. Operation from split power supplies is also possible and the low power supply
current drain is independent of the magnitude of the power supplyvoltage. These
comparators also have a unique characteristic in that the input common-mode voltage
range includes ground, even though operated from a single power supplyvoltage.
Application areas include limit comparators, simple analog to digital converters; pulse,
squarewave and time delay generators; wide range VCO; MOS clock timers;
multivibrators and high voltage digital logic gates. The LM193 series was designed to
directly interface with TTL and CMOS. When operated from both plus and minus power
supplies, the LM193 series will directly interface with MOS logic where their low power
drain is a distinct advantage over standard comparators. The LM393 and LM2903 parts
are available in National’s innovative thin micro SMD package with 8 (12 mil) large
bumps.
Advantages

 High precision comparators


 Reduced VOS drift over temperature
 Eliminates need for dual supplies
 Allows sensing near ground
 Compatible with all forms of logic
 Power drain suitable for battery operation

79
Features
 Wide supply
 Voltage range: 2.0V to 36V
 Single or dual supplies: ±1.0V to ±18V
 Very low supply current drain (0.4 mA) — independent
 of supply voltage
 Low input biasing current: 25 nA
 Low input offset current: ±5 nA
 Maximum offset voltage: ±3 mV
 Input common-mode voltage range includes ground
 Differential input voltage range equal to the power
 supply voltage
 Low output saturation voltage,: 250 mV at 4 mA
 Output voltage compatible with TTL, DTL, ECL, MOS
 and CMOS logic systems
 Available in the 8-Bump (12 mil) micro SMD package
 See AN-1112 for micro SMD considerations

Squarewave Oscillator Non-Inverting Comparator with Hysteresis

80
Diagrams

Metal Can Package Dual-In-Line/SOIC Package


micro SMD Marking

00570902

Metal

Dual-In-
Line/SOIC
Package

S
c Miro SMD
h Micro SMD Maring
e
m
at
ic
a
n
d
C
o
n
n
ec
ti
Top View Top View
o
n

81
82
Typical Performance Characteristics

83
Application Hints
The LM193 series are high gain, wide bandwidth devices which, like most
comparators, can easily oscillate if the output lead is inadvertently allowed to capacitively
couple to the inputs via stray capacitance. This shows up only during the output voltage
transition intervals as the comparator change states. Power supply bypassing is not
required to solve this problem. Standard PC board layout is helpful as it reduces stray
input-output coupling. Reducing the input re-sistors to < 10 kΩ reduces the feedback
signal levels and finally, adding even a small amount (1.0 to 10 mV) of positive feedback
(hysteresis) causes such a rapid transition that oscillations due to stray feedback are not
possible. Simply socketing the IC and attaching resistors to the pins will cause input-
output oscillations during the small transition intervals unless hysteresis is used. If the
input signal is a pulse waveform, with relatively fast rise and fall times, hysteresis is not
required.
All input pins of any unused comparators should be tied to the negative supply.
The bias network of the LM193 series establishes a drain current which is independent of
the magnitude of the power supply voltage over the range of from 2.0 VDC to 30 VDC.
It is usually unnecessary to use a bypass capacitor across the power supply line.
The differential input voltage may be larger than V+ without damaging the device (Note
8). Protection should be provided to prevent the input voltages from going negative more
than −0.3 VDC (at 25˚C). An input clamp diode can be used as shown in the applications
section.
The output of the LM193 series is the uncommitted collector of a grounded-emitter NPN
output transistor. Many collectors can be tied together to provide an output OR’ing
function. An output pull-up resistor can be connected to any available power supply
voltage within the permitted supply voltage range and there is no restriction on this
voltage due to the magnitude of the voltage which is applied to the V + terminal of the
LM193 package. The output can also be used as a simple SPST switch to ground (when a
pull-up resistor is not used). The amount of current which the output device can sink is
limited by the drive available (which is independent of V+) and the β of this device. When
the maximum current limit is reached (approximately 16mA), the output transistor will
come out of saturation and the output voltage will rise very rapidly. The output saturation

84
voltage is limited by the ap-proximately 60Ω rSAT of the output transistor. The low offset
voltage of the output transistor (1.0mV) allows the output to clamp essentially to ground
level for small load currents.

Typical Applications (V+=5.0 VDC)

Pulse Generator Crystal Controlled Oscillator


Squarewave Oscillator

Basic Comparator Non-Inverting Comparator with Hysteresis

85
Typical Applications (V+=5.0 VDC) (Continued)
Inverting Comparator with Hysteresis Output Strobing

AND Gate OR Gate

Large Fan-in AND Gate Limit Comparator

86
Typical Applications (V+=5.0 VDC) (Continued)
Comparing Input Voltages of Opposite Polarity ORing the Outputs

Zero Crossing Detector (Single Power Supply)

One-Shot Multivibrator

Bi-Stable Multivibrator One-Shot Multivibrator with Input Lock Out

87
Zero Crossing Detector Comparator With a Negative Reference

88
Typical Applications (V+=5.0 VDC) (Continued)

Time Delay Generator

Split-Supply Applications (V+=+15 VDC and V−=−15 VDC)

MOS Clock Driver

89