Password Based Circuit Breaker
Password Based Circuit Breaker
Password Based Circuit Breaker
Collage of Engineering
Electrical Engineering Department
Prepared By:
Supervised By:
October 2018
اآلية
طهِّ–ِّااليةِّ))114 سورة
i
DEDICATION
I dedicate this project with much love and appreciation;
To the candles of my lives. My beloved mother who have always been
there for me.
To my father who have always been the brick walls on whom me can learn
and depend on forever.
To my brothers and sister who mean the world to me.
To my friends, family, colleagues and teachers in the Past and presents and
to everyone that touch my heart.
ii
ACKNOWLEDGEMENT
Firstly, thanks to Allah, our creator above for being everything and
for giving us the ability and strength to do anything.
We wish to express our deepest gratitude and appreciation for our
supervisor for this project UST.MAHA OSMAN for her patience and
continuous guidance, advice and supervision through this work.
We would like to extend our gratitude to Eng abdelrahim hammed,
Mogtaba and UST. SUHA ALNEGGAR for their supports and
encouragement for the completion of this project.
Also thank and gratitude to all our teachers who contributed to our
education and to everyone who helped me in this study.
iii
ABSTRACT
iv
املستخلص
هذا المشروع صمم لحل هذه المشكلة عن طريق السماح للشخص المخول فقط بالتحكم في
الخطوط عن طريق كلمة مرور ،يعمل النظام تحت سيطرة ماكروكنترولر من النوع
،ATMEGA32واستُ ِّ
خد َمت لوحة المفاتيح الدخال كلمة المرور عندما يعمل النظام في الوضع
اليدوي.
استُ ِّ
خد َمت دائرة ال GSMللتحكم في النظام عن بعد،عن طريق ارسال كلمة المرور
الخاصة بالخط المعني في رسالة نصية،وذلك يعمل على تقليص الزمن الضائع في رجوع
المهندس الى المحطة لتوصيل وفصل الخطوط .ايضاً ُذ ِّود النظام بحماية ضد ارتفاع التيار عن
طريق حساسات زيادة التيار.
v
TABLE OF CONTENTS
Title Page
No
اإلستهالل i
DEDICATION ii
ACKNOWLEDGEMENT iii
ABSTRACT iv
المستخلص v
TABLE OF CONTENTS vi
LIST OF FIGURES viii
LIST OF ABBREVIATIONS ix
CHAPTER ONE
INTRODUCTION
1.1 Background 1
1.2 Problem Statement 1
1.3 Objectives 2
1.4 Methodology 2
1.5 Project Layout 2
CHAPTER TWO
CIRCUIT BREAKERS AND CONTROL SYSTEMS
2.1 Introduction 4
2.2 Types of circuit breakers 6
2.2.1 Air circuit breaker 6
2.2.2 SF6 circuit breakers and vacuum circuit breaker 7
2.3 Control Systems 10
2.3.1 Control system definition 10
2.3.2 Advantages of control system 10
2.4 System Configurations 11
2.4.1 Open loop system 12
2.4.2 Close loop (feedback) control system 13
CHAPTER THREE
COMPONENT OF THE SYSTEM
3.1 Microcontroller 14
3.2 Global System for Mobile Communications 15
3.3 Liquid Crystal Display 16
3.4 Relay 17
3.5 Relay driver 17
3.6 Keypad 18
3.7 Current Sensors 19
3.9 Power Supply 19
vi
3.10 Push Button Switch 19
3.11 Capacitor 20
3.12 Resistor 20
CHAPTER FOUR
IMPLEMENTATION AND RESULT
4.1 Simulation 22
4.1.1 BASCOM – AVR 22
4.1.2 Proteus introduction 22
4.2 Result 24
CHAPTER FIVE
CONCLUSION AND RECOMMENDATIONS
5.1 Conclusion 29
5.2 Recommendations 29
REFERENCES 29
Appendix: Microcontroller code 31
vii
LIST OF FIGURES
Figures Title page
2.1 Onset of an overhead line fault 5
2.2 Possible consequence of inadequate protection 5
2.3 Air break switchgear 6
2.4 External form of air circuit breaker 7
2.5 SF6 circuit breaker 8
2.6 Vacuum circuit breaker 9
2.7 Illustrates open loop system 12
2.8 Illustrates close loop system 13
3.1 The external form of microcontroller 15
3.2 Microcontroller pins 15
3.3 Illustrate GSM SIM800L 16
3.4 Illustrate GSM SIM900 16
3.5 Illustrates liquid crystal display 16
3.6 External Form of relay 17
3.7 Internal Circuit of relay 17
3.8 Illustrate internal form of ULN2003 18
3.9 Illustrate external form of ULN2003 18
3.10 4×4 keypad 18
3.11 Internal structure and pin notation 18
3.12 Current sensor 19
3.13 Push button switch 20
3.14 Capacitor 20
3.15 Resister 21
4.1 The circuit design 23
4.2 Operation begin 24
4.3 Desiring of password 24
4.4 Illustrate interring of password 25
4.5 Illustrates operating of line one 25
4.6 Connecting of GSM circuit 26
4.7 GSM ready 26
4.8 Shows phone number of sender 27
4.9 Password which interred 27
4.10 Illustrates operating of line three 27
4.11 Illustrates the project circuit 28
viii
LIST OF ABBREVATIONS
CB Circuit Breaker
LCD Liquid Crystal Display
GSM Global System for Mobile
SF6 Silver Hexafloride
GIS Gas Insulation Switchgear
CT Current Transformer
PT Potential Transformer
CEPT Conference Europe Eenneds Postes Telecommunication
OTP ROM One Time Programmable Read Only Memory
RC Resistor, Capacitor
DC Direct Current
ICs Integrated Circuits
AC Alternated Current
IDE Integrated Development Environment
BASSCOM Basic compiler
SMS Short Message Service
SD Secure Digital
SCADA Supervision Control And Data Acquisition
DCS Digital Control System
ix
CHAPTER ONE
INTRODUCTION
1.1 Background
Safety of human life is of a paramount importance. In high current
switching system, switch gear protects electrical circuit. ‘’Security is the
prime concern in our day to day life. Everyone needs to be securing as
much as possible. The electric line man safety system is designed to control
a switch gear by using a password for the safety of electric man. Critical
electrical accidents to line men are on the rise during electric line repair due
to lack of communication and co-ordination between the maintenance staff
and electric substation staff. This project offers a resolution that safeguards
safety of maintenance line men. The control to turn on or off the line will
be maintained by the line man only because this system has an arrangement
such that a password is required to operate the circuit breaker on/off [1].
The password can be entered manually by a keypad matrix, or
automatically by a sending a message to the GSM circuit include the
password. The GSM circuit enables remote control of the system. This
leads to address the problem of loss of time. Between the two circuits there
is a key to switch from manual mode to automatic mode and vice versa.
The system also provided protection against over current using the sensors.
1.2 Problem Statement
Nowadays, electrical accidents to the line are increasing, while
repairing the electrical lines due to the lack of communication between the
electrical substation and maintenance staff.
This project gives a solution to this problem to ensure line man safety. This
project is arranged in such a way that maintenance staff or line man has to
enter the password to ON/OFF the electrical line. The problem of loss of
1
time has also been addressed. So that the line man can be connect or
disconnected without coming back to the station.
1.3 Objectives
See the scientific journals and studies which related to the project
topic.
Drawing the block diagram of the system.
Search about a different type of controlling circuit and circuit
breakers .
Search about the model of circuit component.
Test the system using proteus program.
The Design of real circuit of the system will be proposed.
1.5 Project layout
2
Chapter four shows the System block diagram , simulation and
real circuit model .
Chapter five provides the conclusion and recommendations.
3
CHAPTER TWO
CIRCUIT BREAKERS AND CONTROL SYSTEMS
2.1 Introduction
The history of electrical-power technology throughout the world is
one of steady and, in recent years, rapid progress, which has made it
possible to design and construct economic and reliable power systems
capable of satisfying the continuing growth in the demand for electrical
energy, In this power system protection and control play a significant part,
and progress in design and development in these fields has necessarily had
to keep pace with advances in the design of primary plant,such as
generators, transformers, switchgear, overhead lines and underground
cables,indeed, progress in the fields of protection and control is a vital
prerequisite for the efficient operation and continuing development of
power supply systems as a whole.
The word 'protection' is used here to describe the whole concept of
protecting a power system. The term 'protective gear' or 'protective
equipment' is widely used in that sense [2]. The purpose of an electrical
power system is to generate and supply electrical energy to consumers. The
system should be designed and managed to deliver this energy to the
utilization points with both reliability and economy. Severe disruption to
the normal routine of modern society is likely if power outages are frequent
or prolonged, placing an increasing emphasis on reliability and security of
supply. As the requirements of reliability and economy are largely
opposed, power system designs inevitably a compromise.
Many items of equipment are very expensive, and so the complete power
system represents a very large capital investment. To maximize the return
on this outlay, the system must be utilized as much as possible within the
applicable constraints of security and reliability of supply. More
4
fundamental, however, is that the power system should operate in a safe
manner at all times, no matter how well designed, faults will always occur
on a power system, and these faults may represent a risk to life and/or
property. Figure 2.1 shows the onset of a fault on an overhead line. The
destructive power of a fault arc carrying a high current is very great; it can
burn through copper conductors or weld together core laminations in a
transformer or machine in a very short time – some tens or hundreds of
milliseconds. Even away from the fault arc itself, heavy fault currents can
cause damage to plant if they continue for more than a few seconds. The
provision of adequate protection to detect and disconnect elements of the
power system in the event of fault is therefore an integral part of power
system design. Only by so doing can the objectives of the power system be
met and the investment protected. Figure 2.2provides an illustration of the
consequences of failure to provide appropriate protection [3].
5
2.2 Types of Circuit Breakers
The types of breakers basically refer to the medium in which the
breaker opens and closes. The medium could be oil, air, vacuum
or SF6.
2.2.1 Air circuit breaker
Interrupting contacts situated in air instead of any other artificial
medium. Arc is chopped into a number of small arcs by the Arc-Shute as it
rises due to heat and magnetic forces, Figure 2.3. The air circuit breakers
are normally employed for 380~480V distribution. Figure 2.4 shows the
external form of air circuit breaker
6
Figure 2.4: external form of Air circuit breaker
2.2.2 SF6 and vacuum circuit breakers
Sulphur-hexaflouride SF6 is an inert insulating gas, which is
becoming increasingly popular in modern switchgear designs
both as an insulating as well as an arc-quenching
medium. Gas insulated switchgear GIS is a combination of
breaker, isolator, CT, PT, etc., and are used to replace outdoor
substations operating at the higher voltage levels, namely
66 kV and above For medium- and low-voltage installations, the
SF6 circuit breaker remains constructionally the same as that for
oil and air circuit breakers mentioned above, except for the arc
interrupting chamber which is of a special design, filled with
SF6.To interrupt an arc drawn when contacts of the circuit
breaker separate, a gas flow is required to cool the arcing zone at
current interruption i.e. current zero.This can be achieved by a gas
flow generated with a piston known as the ‘puffer’ principle, or
by heating the gas of constant volume with the arc’s energy. The
resulting gas expansion is directed through nozzles to provide the
required gas flow.
7
The pressure of the SF6 gas is generally maintained above
atmospheric; so good sealing of the gas chambers is vitally
important. Leaks will cause loss of insulating medium and
clearances are not designed for use in air.
9
2.3 Control Systems
Control systems are an integral part of modern society. Numerous
applications are all around us The rockets fire, and the space shuttle lifts off
to earth orbit; in splashing cooling water, a metallic part is automatically
machined; a self-guided vehicle delivering material to workstations in an
aerospace assembly plant glides along the floor seeking its destination.
These are just a few examples of the automatically controlled systems that
we can create. We are not the only creators of automatically controlled
systems; these systems also exist in nature. Within our own bodies are
numerous control systems, such as the pancreas, which regulates our blood
sugar. In time of ‘‘fight or flight,’’ our adrenaline increases along with our
heart rate, causing more oxygen to be delivered to our cells. Our eyes
follow a moving object to keep it in view; our hands grasp the object and
place it precisely at a predetermined location.
2.3.1 Control system definition
A control system consists of subsystems and processes or plants
assembled for obtaining a desired output with desired performance, given a
specified input.
10
The control systems building for four primary reasons
Power amplification
Remote control
Convenience of input form
Compensation for disturbances
For example, a radar antenna, positioned by the low-power rotation of
a knob at the input, requires a large amount of power for its output
rotation. A control system can produce the needed power
amplification, or power gain. Robots designed by control system
principles can compensate for human disabilities. Control systems are
also useful in remote or dangerous locations. For example, a remote-
controlled robot arm can be used to pick up material in a radioactive
environment. Figure 1.4shows a robot arm designed to work in
contaminated environments.
Control systems can also be used to provide convenience by
changing the form of the input. For example, in a temperature control
system, the input is a position on a thermostat. The output is heat.
Thus, a convenient position input yields a desired thermal output.
Another advantage of a control system is the ability to compensate for
disturbances. Typically, we control such variables as temperature in
thermal systems, position and velocity in mechanical systems, and
voltage, current, or frequency in electrical systems. The system must
be able to yield the correct output even with a disturbance [5].
11
2.4.1 Open-loop systems
A generic open-loop system is shown in Figure2.7. It starts
with a sub system called an input transducer, which converts the
form of the input to that used by the controller. The controller
drives a process or a plant. The input is sometimes called the
reference, while the output can be called the controlled variable.
Other signals, such as disturbances, are shown added to the
controller and process outputs via summing junctions, which
yield the algebraic sum of their input signals using associated
signs. For example, the plant can be a furnace or air conditioning
system, where the output variable is temperature. The controller
in a heating system consists of fuel valves and the electrical
system that operates the valves.
12
2.3.2 Closed-loop feedback Control systems
The disadvantages of open-loop systems, namely sensitivity to
disturbances and inability to correct for these disturbances, may be
overcome in closed-loop systems. The generic architecture of a closed-loop
system is shown in Figure 2.8.
The input transducer converts the form of the input to the form used
by the controller. An output transducer, or sensor, measures the output
response and converts it into the form used by the controller. For example,
if the controller uses electrical signals to operate the valves of a
temperature control system, the input position and the output temperature
are converted to electrical signals. The input position can be converted to a
voltage by a potentiometer, a variable resistor, and the output temperature
can be converted to a voltage by a thermistor, a device whose electrical
resistance changes with temperature.
13
CHAPTER THREE
SYSTEM COMPONENT
3.1 Microcontroller
Microcontroller is small computer on a single integrated circuit
containing a processor, memory, and programmable input/output
peripherals. Neither program memory in the form of NOR flash or OTP
ROM is also often included on chip, Figure3.1, as well as a typically small
amount of RAM. Microcontrollers are designed for embedded applications,
in contrast to the microprocessors used in personal computers or other
general purpose applications [1]. Figure 3.2: shows the Microcontroller pins.
14
3.2 Global System for Mobile Communications
At the beginning of the 1980s it was realized that the European
countries were using many different, incompatible mobile phone systems.
At the same time, the needs for telecommunication services were
remarkably increased. Due to this, founded a group to specify a common
mobile system for Western Europe. This group was named “Groupe
Special Mobile” and the system name GSM arose.
This abbreviation has since been interpreted in other ways, but the most
common expression nowadays is Global System for Mobile
communications at the beginning of the 1990s, the lack of a common
mobile system was seen to be a general, world -wide problem. For this
reason the GSM system has now spread also to the Eastern European
countries, Africa, Asia and Australia [6].Figure 3.3 and 3.4 shows the
SIM900 and GSM SIM800L .
Figure 3.3 illustrate GSM SIM800L Figure 3.4 illustrate GSM SIM900
15
GSM uses radio frequencies efficiently, and due to the digital radio
path, the system tolerates more inter cell disturbances.
The average quality of speech achieved is better than in analogue
systems.
Data transmission is supported throughout the GSM system.
Speech is encrypted and subscriber information security is
guaranteed.
International roaming is technically possible within all countries
using the GSM system.
The large market increases competition and lowers the prices both
for investments and usage [6].
3.3 Liquid Crystal Display
For ease of interaction with the user, this system uses an electronic
display module. Here, Figure 3.5, a 16x2 LCD is used. This means in two
lines it is possible to display 16 characters per line. Two registers are
associated with an LCD, such as data and command. These modules are
preferred since it is easily programmable. For providing visual assistance to
the lineman this module is unavoidable [1].
16
3.4 Relay
A relay an electromagnetic device which is used to isolate two
circuits electrically and connect them magnetically. They are very usefully
device and allow one circuit to switch another one while they are
completed separated. The required current to run the relay coil is more than
can be supplied by various integrated circuits like operation amplifier, etc.
[7].Figure 3.5illustrates relay device and Figure 3.7 Internal Circuit of
Relay.
Figure 3.6: External Form of Relay Figure 3.7: Internal Circuit of Relay
ULN2003 belongs to the family of ULN200X series of ICs. These ICs are
used when driving a wide range of loads and are used as relay drivers,
display drivers, line drivers etc. Each channel or Darlington pair in
ULN2003 is rated at 500mA and can withstand peak current of 600mA.
The inputs and outputs are provided opposite to each other in the pin
17
layout. Each driver also contains a suppression diode to dissipate voltage
spikes while driving inductive loads [8]. Figure 3.8 shows ULN2003
device and Figure 3.9 illustrate Internal form of ULN2003.
4*4 keypad Used to enter password when we want to operate the system
at manual mode. It is matrix contain rows and columns of switches. Figure
3.10 shows 4*4 keypad and Figure 3.11: Internal structure and pin
notation.
18
3.7 Current Sensors
Current sensors used to protect circuit against over current. Figure
3.12 shows current sensor device.
19
Figure 3.13: push Button Switch
3.10 Capacitor
A capacitor is an electrical device that can store energy in the electric
field between a pair of closely-spaced conductors called 'plates'. Capacitors
are used in electrical circuits as energy storage devices. They can also be
used to differentiate between high-frequency and low-frequency signals
and this makes them useful in electronic filters [1]. Figure 3.14 shows the
capacitor.
3.11 Resistor
The resistors act to reduce current flow, and, at the same time, act to
lower voltage levels within circuits. Resistors may have fixed resistances or
variable resistances, such as those found in thermistors trimmers, photo
20
resistors and potentiometers. The current through a resistor is in direct
proportion the voltage across the resistor’s terminals [1]. The resistors are
used in the circuit to protect circuit devices against high current. Figure
3.15 shows the resister.
21
CHAPTER FOUR
IMPLEMENTATION AND RESULT
4.1 Simulation
The simulator is an ideal tool for testing small parts of a program to
see if you achieved what you wanted to. The circuit was simulated by using
Proteus v7.7 to verify the software made by Bascom 1.11.9.5 . The
simulation allows to make any modification in the circuit before test the
embedded system in real life.
‘Frequency
1
1 4 7 A
1
2 5 8 B
1
3 6 9 C
* 0 # D
U1
LCD1 9 22
LM016L RESET PC0/SCL
23
PC1/SDA
13 24
XTAL1 PC2/TCK
12 25
XTAL2 PC3/TMS
26
PC4/TDO
40 27
PA0/ADC0 PC5/TDI
39 28 R1
PA1/ADC1 PC6/TOSC1
38 29
PA2/ADC2 PC7/TOSC2
37
PA3/ADC3 330
VDD
VSS
VEE
RW
36 14
RS
D0
D1
D2
D3
D4
D5
D6
D7
PA4/ADC4 PD0/RXD
E
35 15
PA5/ADC5 PD1/TXD
34 16
PA6/ADC6 PD2/INT0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
33
PA7/ADC7 PD3/INT1
17 RL1
18
TXD
RXD
CTS
RTS
PD4/OC1B 5V
1 19
PB0/T0/XCK PD5/OC1A
2 20
PB1/T1 PD6/ICP1
3 21
4
PB2/AIN0/INT2 PD7/OC2 D1
PB3/AIN1/OC0
5
PB4/SS
6
PB5/MOSI
7 32 R2
LED-RED
PB6/MISO AREF
8 30
PB7/SCK AVCC
330
ATMEGA32
U2 RL2
9 5V
COM
1 16
1B 1C
2 15
2B 2C
3 14
0 4
3B
4B
3C
4C
13
D2
5 12
5B 5C
6 11
6B 6C
7 10 R3
LED-RED
7B 7C
ULN2003A 330
RL3
5V
D3
LED-RED
23
4.2 Result
Now we see how the project works. First, when the power is turned
on, the LCD displays a welcome screen, Figure 4.2.
LCD1
LM016L
VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Figure 4.2: operation begin
Then asks you to enter the password to unlock it as shown in Figure 4.3
bellow.
LCD1
LM016L
VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
1
2
3
4
5
6
7
8
9
10
11
12
13
14
In our case, the password is fixed111 for the first relay. By using the
Keypad, the password is input and it is seen on the LCD as a shown in
Figure 4.4
24
LCD1
LM016L
VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Figure 4.4: illustrate interring of password
When the correct password is entered, the contacts of first relay is changes
as a shown in Figure 4.5.
R1
330
RL1
5V
D1
R2
LED-RED
330
RL2
5V
D2
R3
LED-RED
330
RL3
5V
D3
LED-RED
By applying the same steps above for the second and third relay, we get
same results.
25
In case of transferring from manual mode to GSM mode by push button
switch, the system shows "connecting" on LCD. As shown in Figure 4.6.
Then the system shows "STAND BY" to indicate GSM readiness for use
as shown in Figure 4.6
26
Figure 4.8: shows phone number of sender
Then the system displays password which sent as a shown in Figure 4.9
27
Figure 4.11shows final form of the project circuit, which designed in away
that allows control of three different lines, in addition to the protection
against over current for each line.
28
CHAPTER FIVE
CONCLUSION AND RECOMMENDATIONS
5.1 Conclusion
The project titled “PASSWORD BASED CIRCUIT BREAKER
WITH GSM MODULE” is a model for reducing fatal accidents with the
help of microcontroller and GSM modem.
For repairing the electric lines the lineman and his safety plays a major
role. Human safety is the most important factor.
Finally the aim of the project i.e. to avoid the fatal accidents for line
man.
5.2 Recommendations
29
References
[1] BLESSED OLALEKAN OYEBOLA,"password based electric load
switching gear for the safety of lineman" gateway ict polytechnic saapade,
nigeria, issn- 2456-8651, january, 2017
Issue 3.0
30
APPENDIX
Microcontroller code
"regfile = "m32def.dat$
crystal = 8000000$
baud = 9600$
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portb.4 , Db5 = Portb.5 , Db6 = Portb.6 , Db7
= Portb.7 , E = Portb.2 , Rs = Portb.0
Cls
Cursor Off
Dim C As Word
Dim D As Byte
Dim P As Byte
Dim S5 As Byte
Dim M As Byte
Dim H As Byte
31
Dim H1 As Byte
Dim H2 As Byte
H=0
H1 = 0
H2 = 0
varibles'
Dim I As Byte
Dim B As Byte
Dim W As Word
Dim J As Byte
Dim Yy As Byte
Yy = 0
Dim X As Byte
Dim Y As Byte
Dim T As Byte
T=0
Dim F As Word
32
Dim Z As Byte
Dim P1 As Word
P1 = 111
Dim P2 As Word
P2 = 222
Dim P3 As Word
P3 = 333
Locate 1 , 4
Wait 2
Cls
Man
Cls
Do
If Pina.0 = 0 Then
Portd.2 = 0
End If
If Pina.1 = 0 Then
Portd.3 = 0
End If
If Pina.2 = 0 Then
Portd.4 = 0
End If
Locate 1 , 3
33
"Lcd "ENTER PASS
If Pind.5 = 1 Then
Goto Aut
Else
M = Getkbd
Waitms 20
Locate 2 , 4
Lcd C
Wait 1
If D = 3 Then
If C = P1 And H = 0 Then
H=1
Portd.2 = 1
Waitms 200
D=0
C=0
Goto Man
H=0
Portd.2 = 0
Waitms 200
D=0
C=0
34
Goto Man
H1 = 1
Portd.3 = 1
Waitms 200
D=0
C=0
Goto Man
H1 = 0
Portd.3 = 0
Waitms 200
D=0
C=0
Goto Man
H2 = 1
Portd.4 = 1
Waitms 200
D=0
C=0
Goto Man
H2 = 0
35
Portd.4 = 0
Waitms 200
D=0
C=0
Goto Man
Else
D=0
C=0
Goto Man
End If
End If
End If
Loop
Aut
If Pind.5 = 0 Then
Goto Man
End If
Cls
Waitms 100
Locate 2 , 1
Wait 10
Cls
36
"Print "AT
Waitms 500
"Print "AT
Waitms 500
"Print "ATE0
Gosub Ss
Waitms 500
Cls
"Print "AT+CSMP=17,167,0,0
Gosub Ss
Waitms 500
"Print "AT+CNMI=0,1,2,0,0
Gosub Ss
Waitms 500
"Print "AT+CMGF=1
Gosub Ss
Waitms 500
"Print "AT+CMGD=1
Wait 2
CALL SUB'
Cls'
37
MAIN LOOP'
Main
Do
Locate 1 , 1
Wait 1
Cls
Waitms 200
Gosub Ss
Wait 1
"" , I = Instrs
If I > 0 Then
Phone = Lefts , I
End Select
End If
Loop
Portc.0 = 0
Cls Home
"," , I = Instrs
38
I=I+6
Phone = Mids , I , 9
Locate 1 , 1
Locate 2 , 1
Wait 6
Cls
I=0
I = I + 67
Gosub Sss
S2 = Mids , 67 , 3
Cls
Locate 1 , 2
Lcd S2
Wait 1
Goto M1
M1
Do
Waitms 200
"Print "AT+CMGD=1
Cls
39
H=1
Portd.2 = 1
Wait 1
Waitms 200
"Print "AT+CMGD=1
Cls
H=0
Portd.2 = 0
Wait 1
Waitms 200
"Print "AT+CMGD=1
Cls
H1 = 1
Portd.3 = 1
Wait 1
Waitms 200
"Print "AT+CMGD=1
Cls
H1 = 0
Portd.3 = 0
Wait 1
40
Elseif S2 = "333" And H2 = 0 Then
Waitms 200
"Print "AT+CMGD=1
Cls
H2 = 1
Portd.4 = 1
Wait 1
Waitms 200
"Print "AT+CMGD=1
Cls
H2 = 0
Portd.4 = 0
Wait 1
Else
Waitms 200
Cls
Flushbuf
"" = S
I=0
B=0
"" = Phone
W=0
41
"" = S1
"" = S2
"Print "AT+CMGD=1
Gosub Ss
Wait 1
Cls
End If
End Sub
Goto Main
Loop
Sss
"" = S
Do
B = Inkey
S = S + Chrb
S1 = Chrb
Loop
Return
Ss
'
"" = S
Do
42
B = Inkey
Select Case B
Case 0
Case Else
S = S + Chrb
End Select
Loop
Cls
Return
SUB 3 CLEAR'
Sub Flushbuf
Waitms 100
Do
B = Inkey
Loop Until B = 0
End Sub
Calculation
S5 = Lookupm , Dta
Incr D
P=D+6
C = C * 10
C = C + S5
43
Waitms 200
Return
Dta
Data 15 , 14 , 0 , 13 , 12 , 9 , 8 , 7 , 11 , 6 , 5 , 4 , 10 , 3 , 2 , 1
44