Академический Документы
Профессиональный Документы
Культура Документы
Project Report
CH APTER 1
INTRODUCTION
Nowadays, excessive or inappropriate speed is a significant factor in serious road
accidents. Road safety authorities around the world devote considerable resources to addressing
the speeding problem. The current legal system involves procedure in which the driver is charged
with a ticket for speeding. But if in any case there is a delay in either the arrival of the notice or
payment of fine, the person will get punishment for this speeding. So the implementation of this
speed governing system can avoid the above complications.
1.1 EXPLANATION
The proposed system consist of 3 sections namely control room section, road section and
vehicle section. The control room gives the information about the speed limit to be followed in
that region using GSM modem. Here in this project we also implemented the vehicle accident
information system. This system is capable of immediate reporting of emergency, like accidents,
to a central monitoring station and also for investigation purpose. Every vehicle equipped with
this reporting unit can be easily located and help can be extended without any delay. The alarm
data generated by the micro controller is sending to a central monitoring station using GSM
network. Also the location of accident is finding with the help of GPS module.
This project is based on Embedded System. Embedded System can be defined as the combination
of both software and hardware. An embedded system has specific requirements and performs predefined tasks unlike a general purpose personal computer. An embedded system is a combination
of computer hardware and software and perhaps additional mechanical or other parts, designed to
perform a dedicated function. This system is proposed to implement in road.
Department of ECE
SETCEM
Project Report
Department of ECE
SETCEM
Project Report
In 1990s Carl.H.Smith and Robert.W.Schneider introduced that most speed limits are
fixed and apply at all times. A variable speed limit is one that can be altered to respond to
changing traffic and road conditions, such as bad weather conditions including rain, ice or
wind, a crash or traffic congestion. Whatever the speed limit is set to, it is still a regulatory
speed limit and must not be exceeded. Under the Australian Road Rules, electronic speed limit
signs are treated the same as static speed signs. The sign sets a maximum speed limit and
invariably a lower safer speed will be required. Remember it's a driver's responsibility to drive
to the traffic and road conditions. Variable speed limits are set using high-visibility electronic
signs that can display different speeds. They are similar to the signs you might have seen
operating in school speed zones in Tasmania and on roads in other parts of Australia. The
speed limit is displayed with white numbers surrounded by five red circles. Most of the time,
the speed limits shown on the electronic signs will reflect the existing speed limit for that
section of the highway, and during this time the five red circle will be static. When the speed
limit is reduced three of the five circles will continually flash until the limit returns to the
normal limit. Variable speed limits have been shown to improve safety and improve traffic
flow. In heavy traffic conditions, lowering the speed limit can help smooth traffic flow, as
vehicle speeds tend to even out, lane changing is reduced and drivers are less frustrated by
irregular traffic flow. Changing the speed limit to match the prevailing conditions alerts
drivers to potential hazards. These may be hazards that are not readily visible, either because
of the curve of the road, or weather conditions such as ice or gale-force winds, or a stationary
traffic queue has formed further ahead. Importantly, lowering the speed of traffic approaching
a crash site reduces the likelihood of secondary crashes. The variable speed limit zone will
apply to the Tasman Highway between Liverpool St Hobart and the Cambridge Road
Interchange, including the Tasman Bridge. There will be signs at the entry points to the
variable speed limit zone advising drivers that they have entered the zone and alerting them to
be aware that the speed limit might change.
Department of ECE
SETCEM
Project Report
In 1990, Datta and Das proposed a system based on a fuel management system. It is
used to control the speed of the vehicle but can be fitted to only diesel vehicles. It consists of a
speed motor, ECU, and a solenoid valve. It is installed between fuel pump and fuel filter. The
ECU is preprogrammed at a fixed speed and the driver cant increase the speed limit. Fuel
management systems are designed to effectively measure and manage the use of fuel within
the transportation and construction industries. They are typically used for fleets of vehicles,
including railway vehicles and aircraft, as well as any vehicle that requires fuel to operate.
They employ various methods and technologies to monitor and track fuel inventories, fuel
purchases and fuel dispensed. They may also employ more sophisticated systems that utilize
remote data collection to gather specific technical information about the vehicle usage and
performance characteristics such as mileage, hours of operation and engine idling time.
In 1989 A.J Johny Abraham and Jason Philip introduced a system that, the legal speed
limit is stored at geographical location .Here the driver gets a warning or a notification only
when he exceeds the speed limit. This system makes use of GPS system which is of high cost.
Department of ECE
SETCEM
Project Report
CHAPTER 2
SPECIFICATIONS
2.1 EMBEDDED SYSTEMS
An embedded system is a special purpose computer system, which is completely
encapsulated by the device it controls. It is called embedded because the micro controller is
inside some other system. An embedded system has specific requirements and performs predefined tasks unlike a general purpose personal computer. An embedded system is a
combination of computer hardware and software and perhaps additional mechanical or other
parts, designed to perform a dedicated function.
Features of Embedded Systems
They are designed around a micro controller which integrates memory and
peripherals.
Sophisticated functionality.
Real time operation.
Low manufacturing cost.
Low power consumption.
Eliminates necessity of complex circuitry.
Smarter products.
Smaller size.
Department of ECE
SETCEM
Project Report
A project manager.
A make facility.
Tool configuration.
Editor.
A powerful debugger.
Vision adds many new features to the Editor like Text Templates, Quick Function
Navigation, Syntax Coloring with brace highlighting, Configuration Wizard for dialog based
startup and debugger setup.
2.2.1 Building an Application in Vision
To build (compile, assemble, and link) an application in Vision, you must:
1. Select Project - Open Project (for EG: \C166\EXAMPLES\HELLO\HELLO.UV2).
2. Select Project - Rebuild all target files or Build target.
Vision2 compiles, assembles, and links the files in your project.
2.2.2 Creating Your Own Application in Vision2
To create a new project in Vision, you must:
1. Select Project - New Project.
2. Select a directory and enter the name of the project file.
3. Select Project - Select Device and select an AT89C51 device from the Device
Database.
4. Create source files to add to the project.
Department of ECE
SETCEM
Project Report
5. Select Project - Targets, Groups, and Files. Add/Files, select Source Group1, and add
the source files to the project.
6. Select Project - Options and set the tool options. Note when you select the target
device from the Device Database all special options are set automatically. You
typically only need to configure the memory map of your target hardware. Default
memory model settings are optimal for most applications.
7. Select Project - Rebuild all target files or Build target.
2.2.3 Debugging an Application in Vision2
To debug an application created using Vision2, you must:
1. Select Debug - Start/Stop Debug Session.
2. Use the Step toolbar buttons to single-step through your program. You may enter G,
main in the Output Window to execute to the main C function.
3. Open the Serial Window using the Serial #1 button on the toolbar.
4. Debug your program using standard options like Step, Go, Break, and so on.
2.2.4 Device Database
A unique feature of the Keil Vision2 IDE is the Device Database which contains
information about more than 400 supported microcontrollers. When you create a new
Vision2 project and select the target chip from the database, Vision2 sets all assembler,
compiler, linker, and debugger options for you. The only option you must configure is the
memory map.
As new devices become available, they are added to the database along with data sheets
and header files.
Department of ECE
SETCEM
Project Report
CHAPTER 3
BLOCK DIAGRAM AND DESCRIPTION
The block diagram consists of three sections namely, control room, road section and vehicle
section.
Department of ECE
SETCEM
Project Report
Microcontroller
The block diagram consists of the main part of the system is the microcontroller
PIC16F877A. All the processes and control actions are done on the microcontroller. The
microcontroller is interfaced with the GSM Modem. Through the GSM modem, the control
room receives the alert accident information from the vehicle side. Also control room should
forward the road zone details to the road section using the control switches. The GSM Modem
will interfaced with the microcontroller is through a level converter IC. The alert accident
information is display on the Control room.
GSM Modem
The GSM Modem is used for receiving the alert information from the vehicle section.
Also the zonal information will be send to the road section. The GSM modem is interfaced
with the microcontroller is through a level converter IC.
GSM (Global System for Mobile communications) is the most popular standard for
mobile phones in the world. GSM differs from its predecessors in that both signaling and
speech channels are digital, and thus is considered a second generation (2G) mobile phone
system. This has also meant that data communication was easy to build into the system. GSM
also pioneered a low-cost (to the network carrier) alternative to voice calls, the short message
service (SMS, also called "text messaging"), which is now supported on other mobile
standards as well.
Level Converter
The level converter is used for the interfacing of GSM modem with the
microcontroller. The microcontroller has the TTL logic, but the GSM modem has RS232
logic. For this conversion, ie. TTL logic levels are converted into the RS232 logic levels and
vice versa. The level converter IC used here is MAX232.
Department of ECE
SETCEM
Project Report
Microcontroller
The block diagram consists of the main part of the system is the microcontroller
PIC16F877A. All the processes and control actions are done on the microcontroller. The
microcontroller is interfaced with the RF receiver modem and continuously transmits the
zonal ID. The switches are used to produce that ID. The GSM Modem is interfaced with the
microcontroller is by using zonal information from the control room. The GSM Modem is
interfaced by the microcontroller is through a level converted IC. All the operations should
display on the LCD screen.
Department of ECE
10
SETCEM
Project Report
RF transmitter
The zonal data are transmitted using an RF transmitter. This RF unit has an ASK
modulator which will convert the data into suitable signal prior to transmission. The RF
transmitter is a low power 433MHz unit which has 100ft range in line of sight. The
transmitted data from the microcontroller is firstly encoded using an encoded IC. This data is
given into the RF transmitter module. Here we used the encoder IC is HT 12E.
GSM Modem
The GSM Modem is used for receiving the zonal information from the control room.
I.e. if the zone is active or not. The GSM Modem is interfaced with the microcontroller is
through a level converter IC namely MAX232.
LCD:
LCDS serves as a useful interface for the user. The most common type of LCD
controller is the Hitachi 44780 which provides a relatively simple interface between
microcontroller and LCD. The LCD has 16 character x 2 line display facility. The message to
be displayed is send to the LCD through data-bus. A set of control lines are needed to proper
displaying of the characters in LCD. All the operations should display on the LCD Module.
Department of ECE
11
SETCEM
Project Report
Microcontroller
The block diagram consists of the main part of the system is the microcontroller
PIC16F877A. All the processes and control actions are done on the microcontroller. The
microcontroller is interfaced with the RF receiver Module for receiving the zonal details.
According to the zonal details the vehicle speed will be reduced. When the vehicle section
receives the zonal details, then the system produce a voice announcement for alerting the
Department of ECE
12
SETCEM
Project Report
driver. For voice announcement, there is voice generator and loud speaker will connect. After
a few minutes, if the driver will not gear down the speed, then the system will automatically
down the speed into that zonal area. The wheel of the vehicle will connect with the gear
motors. When the system will adjust the speed, then the system uses PWM technique. The
motors are interfaced with the microcontroller is through a driver IC. When the vehicle will
get any accident, then the system will send an alert information to the control room through
the GSM Modem. The accident condition will detect using the vibration sensor. When any
accident condition will occur, then the system takes the location data using GPS Modem. This
information (i.e. Vehicle ID, Location data and Accident information) will send to the control
room. The GSM Modem will interfaced with the microcontroller is through a level converter
IC. All the operations will display on the LCD.
RF receiver
RF Receiver is used to receive the zonal data that is from the road Section. An antenna
is attached to this unit which receives the incoming signal. RF receiver feed the received data
to decoder circuit. The decoder IC is used to decode the data from the control unit. The RF
receiver receives the data, that is in an encoded format, the decoded IC decode the data and
given to the microcontroller. The decoded IC used here is HT 12D.
Driver IC
The driver IC is used to drive the gear motors. Here two driver IC is used. One is used
to drive the vehicles movement gear motors and the other one is used to drive the webcam s
gear motor. The motors are operated with 12V/ 9V power supply and it has used more current.
So the microcontroller cant operate the motors directly. So the signals from the
microcontroller is fed into the driver IC, then the driver IC amplifies the signals and fed into
the gear motors. Here we used the driver IC is L293D.
Motors
The motor1 and motor2 is used for vehicles movement. The CAM rotation motor is
used for rotating the web cam. Here we used the motors are gear motors with 45 rpm.
Department of ECE
13
SETCEM
Project Report
Voice Generator
The voice generator is used for generating the voice. I.e. when we receive a zonal
information, then the information will announce, that for alerting the driver to gear down the
speed. In the voice generator circuit the main component will be APR 9600. A speaker will
connect to the voice generator for announcing.
Vibration Sensor
The vibration sensor is used for detecting the accident conditions. When any accident
condition will occur, the sensor will detect the condition and produces a digital signal.
GPS Module
The GPS module is interfaced with the microcontroller for taking the location of the
accident place. Using GPS module we can get the longitudinal and latitudinal data of each
place.
GSM Module
The GSM module is interfaced with the microcontroller for sending the emergency
message to the central station. The GSM module is interface with the microcontroller through
a level converter. The level converter is used for changing the voltage levels. Here we used
the level converter IC is MAX232.
LCD Module
LCDS serves as a useful interface for the user. The most common type of LCD
controller is the Hitachi 44780 which provides a relatively simple interface between
microcontroller and LCD. The LCD has 16 character x 2 line display facility. The message to
be displayed is send to the LCD through data-bus. A set of control lines are needed to proper
displaying of the characters in LCD. All the operations are display on the LCD.
Department of ECE
14
SETCEM
Project Report
CHAPTER 4
CIRCUIT DIAGRAM AND DESCRIPTION
4.1 Circuit Diagram of Vehicle Section
U3
TR1
230V AC
TRAN-2P2S
C5
1nF
U2
7805
VI
VO
GND
U1
14
GND
OUT4 GND
11
OUT3
6
OUT2
3
OUT1 VS
VSS
16
C1
C1+
1mF
U4
C114
11
T1IN
T1OUT
13
12
R1OUT
R1IN
T2IN
R2OUT
T2OUT
R2IN
10
2
VS+
6
VS-
C2+
C2-
C2
MAX232
1mF
15
SETCEM
TR1
230V AC
TRAN-2P2S
C1+
11
12
T1IN
R1OUT
10
T2IN
9
R2OUT
C2+
Project Report
RF TX
LCD1
VSSVDDVEE
LM016L
Department of ECE
16
SETCEM
Project Report
TR1
230V AC
TRAN-2P2S
C1+
11
12
T1IN
R1OUT
10
T2IN
9
R2OUT
C2+
4
LCD1
VSSVDDVEE
LM016L
17
SETCEM
Project Report
General Features
Department of ECE
18
SETCEM
Project Report
Peripheral Features
Key Features
Analog Features
Department of ECE
19
SETCEM
Project Report
Special Features
20
SETCEM
Project Report
Input/output ports
PIC16F877 has 5 basic input/output ports. They are usually denoted by PORT A (R A),
PORT B (RB), PORT C (RC), PORT D (RD), and PORT E (RE). These ports are used for
input/ output interfacing. In this controller, PORT A is only 6 bits wide (RA-0 to RA-7),
PORT B , PORT C,PORT D are only 8 bits wide (RB-0 to RB-7,RC-0 to RC-7,RD-0 to
RD-7), PORT E has only 3 bit wide (RE-0 to RE-7).
PORT-A
PORT-B
PORT-C
PORT-D
PORT-E
All these ports are bi-directional. The direction of the port is controlled by using
TRIS(X) registers (TRIS A used to set the direction of PORT-A, TRIS B used to set the
direction for PORT-B, etc.). Setting a TRIS(X) bit 1 will set the corresponding PORT(X) bit
as input. Clearing a TRIS(X) bit 0 will set the corresponding PORT(X) bit as output.
(If we want to set PORT A as an input, just set TRIS(A) bit to logical 1 and want to
set PORT B as an output, just set the PORT B bits to logical 0.)
Analog input port (AN0 TO AN7): these ports are used for interfacing analog inputs.
TX and RX: These are the USART transmission and reception ports.
SCK: these pins are used for giving synchronous serial clock input.
SCL: these pins act as an output for both SPI and I2C modes.
DT: these are synchronous data terminals.
CK: synchronous clock input.
SD0: SPI data output (SPI Mode).
SD1: SPI Data input (SPI mode).
SDA: data input/output in I2C Mode.
Department of ECE
21
SETCEM
Project Report
Department of ECE
22
SETCEM
Project Report
23
SETCEM
Project Report
The data memory is partitioned into multiple banks which contain the General
Purpose Registers and the Special Function Registers. Bits RP1 (STATUS<6>) and RP0
(STATUS<5>) are the bank select bits.
RP1:RP0
00
01
10
11
Table 4.2 Data memory organization
Each bank extends up to 7Fh (128 bytes). The lower locations of each bank are reserved for
the Special Function Registers. Above the Special Function Registers are General Purpose
Registers, implemented as static RAM. All implemented banks contain Special Function
Registers. Some high use Special Function Registers from one bank may be mirrored in
another bank for code reduction and quicker access
Department of ECE
24
SETCEM
Project Report
The Data EEPROM and FLASH Program Memory are readable and writable during
normal operation over the entire VDD range. The EEPROM data memory allows byte read
and write.
When interfacing to the data memory block, EEDATA holds the 8-bit data for
read/write and EEADR holds the address of the EEPROM location being accessed. The
registers EEDATH and EEADRH are not used for data EEPROM access. These devices have
up to 256 bytes of data EEPROM with an address range from 0h to FFh. The EEPROM data
memory is rated for high erase/write cycles. The write time is controlled by an on-chip timer.
The write time will vary with voltage and temperature, as well as from chip-to-chip. Please
refer to the specifications for exact limits.
TIMER0 MODULE
The Timer0 module timer/counter has the following features:
8-bit timer/counter
Readable and writable
8-bit software programmable prescaler
Internal or external clock select
Interrupt on overflow from FFh to 00h
Edge select for external clock
TIMER1 MODULE
25
SETCEM
Project Report
Interrupt, if enabled, is generated on overflow, which is latched in interrupt flag bit TMR1IF
(PIR1<0>). This interrupt can be enabled/disabled by setting/clearing TMR1 interrupt enable
bit TMR1IE (PIE1<0>).
Timer1 can operate in one of two modes:
As a timer
As a counter
The operating mode is determined by the clock select bit, TMR1CS (T1CON<1>).
In timer mode , Timer1 increments in every instruction cycle. In counter mode, it
increments on every rising edge of the external clock input.Timer1 can be enabled/disabled by
setting/clearing control bit TMR1ON (T1CON<0>).Timer1 also has an internal reset input.
This reset can be generated by either of the two CCP modules
TIMER2 MODULE
Timer2 is an 8-bit timer with a prescaler and a postscaler. It can be used as the
PWM time-base for the PWM mode of the CCP module(s). The TMR2 register is readable
and writable, and is cleared on any device reset. The Timer2 module has an 8-bit period
register PR2.Timer2 increments from 00h until it matches PR2 and then resets to 00h on the
next increment cycle. PR2 is a readable and writable register. The PR2 register is initialized to
FFh upon reset.
Department of ECE
26
SETCEM
Project Report
Both the CCP1 and CCP2 modules are identical in operation, with the exception being
the operation of the special event trigger.
Spectral efficiency
ISDN compatibility And interaction with the Integrated service digital network (ISDN) which
offers the capability to extend the single-subscriber line system with the various to a
multiservice system. The first commercial GSM system, called D2, was implemented in
Germany in 1982.2 This valuable channel of communication can equip us with a powerful
tool for controlling desired device or process parameter from distant location, through
electromagnetic waves. With a little effort logic can be setup to even receive a feedback on the
status of the device or the process being controlled.
Department of ECE
27
SETCEM
Project Report
Department of ECE
28
SETCEM
Project Report
Department of ECE
29
SETCEM
Project Report
30
SETCEM
Project Report
authentication, location updating, handovers, and call routing to a roaming subscriber. These
services are provided in conjuction with several functional entities, which together form the
Network Subsystem. The MSC provides the connection to the fixed networks (such as the
PSTN or ISDN). Signalling between functional entities in the Network Subsystem uses
Signalling System Number 7 (SS7), used for trunk signalling in ISDN and widely used in
current public networks. The Home Location Register (HLR) and Visitor Location Register
(VLR), together with the MSC, provide the call-routing and roaming capabilities of GSM.
The HLR contains all the administrative information of each subscriber registered in the
corresponding GSM network, along with the current location of the mobile. The location of
the mobile is typically in the form of the signalling address of the VLR associated with the
mobile station. The actual routing procedure will be described later. There is logically one
HLR per GSM network, although it may be implemented as a distributed database. The
Visitor Location Register (VLR) contains selected administrative information from the HLR,
necessary for call control and provision of the subscribed services, for each mobile currently
located in the geographical area controlled by the VLR. Although each functional entity can
be implemented as an independent unit, all manufacturers of switching equipment to date
implement the VLR together with the MSC, so that the geographical area controlled by the
MSC corresponds to that controlled by the VLR, thus simplifying the signalling required.
Note that the MSC contains no information about particular mobile stations --- this
information is stored in the location registers. The other two registers are used for
authentication and security purposes. The Equipment Identity Register (EIR) is a database that
contains a list of all valid mobile equipment on the network, where each mobile station is
identified by its International Mobile Equipment Identity (IMEI). An IMEI is marked as
invalid if it has been reported stolen or is not type approved. The Authentication Center (AuC)
is a protected database that storesa copy of the secret key stored in each subscriber's SIM card,
which is used for authentication and encryption over the radio channel.
Department of ECE
31
SETCEM
Project Report
tm
contact )
32
SETCEM
OFF
ON
Flashing Slowly
Flashing rapidly
The working principle of SMS controller is based upon the use of sending & receiving
SMS through serial communication over GSM network. After receiving new SMS we have to
process these SMS to perform the desired task.
To perform this task we need a GSM MODEM & a microcontroller. The task of the GSM
MODEM is to receive the SMS & inform the connected microcontroller on its serial port
about its availability. Once the microcontroller has detected a new message it will read it from
GSM MODEM and process it to perform the desired task.
The work on this project one should have good knowledge of Microcontroller & Its
programming as well as GSM MODEM & Its Commands.
Liquid crystal displays are generally more flexible than LED displays because they
allow for a variety of text and/or graphics. LCDs require less power LEDs making them
suitable for lose power requirements.) LCDs are more readable in sunlight and an use
backlights for night viewing. However, LCDs are more expensive than LED displays. LCDs
come in a variety of sizes. Text displays are specified by their character size, the number of
lines, and the number of characters per line.
Department of ECE
33
SETCEM
Project Report
The LCD module, made by Crystallonics, is 16x2 line interactive displays. It needs
power supply of +5v. The module has inbuilt controller chip, such as an HD44780, which acts
as an interface between CPU and the row and column drivers. The controller takes care of
generating characters, refreshing the display, and so on. The module has a back light driven by
a pair of pads separate from the interface pads .The LCD module works in two modes for
communicating with the micro controller - 8 bit (byte) mode & 4 bit (nibble) mode. In the
later case only the higher nibble i.e. pins DB4-DB7 is used for communication. For
controlling the LCD module we have used only the port D.
4.6.2PINOUT DESCRIPTION:
Department of ECE
Automatic road security control system
34
SETCEM
PIN NO.
1
2
3
4
6
7
8
9
10
11
12
13
14
15
16
35
SETCEM
Project Report
potentiometer
4.7 DRIVER
Driver is used to boost the current. The current from microcontroller is not sufficient
enough to rotate the motor so a current amplifier is used .L293D is used to drive the motor.
4.7.1 L293D
L293D is used as a driver IC. The two motors that for crane movements are connected
st
th
to the microcontroller through L293D. The 1 and 9 pin of L293D is connected to P1.0, this
for enabling the two motors. The 2
The 2
nd
nd
th
rd
th
pin is connected to P1.1 and 7 pin is connected to P1.2. The 3 and 6 pins are two
th
th
output pins of Motor 1. These two pins are connected to the motor1. The 4 and 5 pins are
th
th
connected to GND. The 10 and 15 pins are next two input pins from the controller. The
th
th
th
th
10 pin is connected to P1.3 and 15 pin is connected to P1.4. The 11 and 14 pins are two
th
th
output pins of Motor 2. These two pins are connected to the Motor 2. The 12 and 13 pins
are connected to GND. The L293D IC is helps to the direction control and to avoid kick
th
th
backs. The 8 pin is connected to a 12V supply, that for driving the motors. The 16 pin is
connected to a 5V supply.
Department of ECE
36
SETCEM
Project Report
37
SETCEM
Project Report
of the RS232 DB connecter, and R1out is the TTL side that is connected to the RxD pin of the
microcontroller. MAX232 requires four capacitors ranging from 1 to 22 mf.
RF Specifics (stolen right from the book)
Parameter
Value
890-915MHz, 1710-1785MHz
Channel Spacing
200kHz
Duplex Spacing
45MHz
Radio Power
28 microseconds
Emissions
< -36dBm
Phase Error
5 deg RMS
Freq Error
95Hz
Recv Sensitivity
104dBm
Co-channel Rejection
100dBm
38
SETCEM
Project Report
synchronization burst - same length as the normal burst but a different structure
normal burst - carries speech or data information. lasts approximately 0.577 ms and
has a length of 156.25 bits
frequency correction burst - same length as the normal burst but a different structure
Department of ECE
39
SETCEM
Project Report
HLR
The HLR contains a lot of interesting information. The HLR is responsible for
subscription details, and supplementary services. It also maintains information on the last
know location and status of a particular phone.
Since a user can use any phone with his or her SIM card, there's a protocol necessary
to manage accessing the network. Information contained on the SIM card is transmitted to the
HLR to verify the identity of the subscriber. Location and status are continually updated in the
HLR based on the base station reports and cell phone status. Any messages to be sent to the
subscriber are queued in the HLR. All call setup queries ask the HLR for information before
doing anything else.
VLR
Like the HLR, the VLR keeps track of users but only within the area thet the VLR is
assigned. The VLR communicates with the HLR to figure out where to route calls, and to
keep track of peple as they move around.
AUC
The AUC is basically just a database full onf confidential subscriber information
attached to the back of the HLR. Its located in a "secure place" and the data is stored in
"coded" form (sounds like encryption to me). The AUC is responsible for controlling the
rights of usage of the network services, i.e. phone calls, data, internet, etc... The AUC allows
the Network Operator (Cingular, AT&T) to know "unambiguiusly" who is on the network for
billing purposes. The AUC also protects the user from fraud (somehow ...) and contains the
secret information necessary to handle authentication and encryption.
Authentication with the network
Authentication on the network works as follows. First the mobile terminal is asked to
perform a computation on a random number supplied by the system using a secret key stored
on the SIM card. The system does this calculation internally, and compares the outputs. Both
the algorithm and key are stored in secure formats.
Department of ECE
40
SETCEM
Project Report
More detailed authentication ... When a terminal connects to the network, a RNG gives
it a number N which is encrypted with a secret personal key Kp. The resulting number is
encrypted with an algorithm called A3 and transmitted back to the network and compared.
The subscriber then generates a session key for encrpytion using the algorithm A8. The
encryption algorithm A5 is used to encrypt each packet.
After the subscriber is verified, the encryption of radio packets is handled by a
different algorithm, called A5 (A3 is used during subscriber verification). The encryption key
is supplied during authentication, using some key agreement scheme and each packet is also
encrypted using a changing IV of some variety, which appears to be a packet number. I do not
think either of these algorithms are officially public (LINKS?).
Encryption and Security
There are 3 main algorithms used in GSM. Each of these algorithms is a trade secret
and only released to people who the GSM committee determines has a need-to-know.
Name Use
A3
Authentication
Encryption/Decryption
A5
packet encryption
A8
Department of ECE
41
SETCEM
Project Report
The A1080-A GPS receivers are available as off-the-shelf component, 100% tested
and shipped in standard tape-and-reel package.
GPS Characteristics
Antenna
It is recommended to use an active GPS antenna with supply voltage of 3 to 5VDC
and a current draw of 50mA maximum. The quality of the GPS antenna chosen is of
paramount importance for the overall sensitivity of the GPS system. An active antenna should
have a gain 20dB and a noise figure 1.5dB, which applies to more than 95% of the active
antennas available in the market
Serial Port Settings
The default configuration within the standard GPS firmware is:
Department of ECE
42
SETCEM
Project Report
Serial 0 (NMEA) 4800 baud, 8 data bits, no parity, 1 stop bit, no flow
Control.
Serial 1 (binary) 38400 baud, 8 data bits, no parity, 1 stop bit, no flow
Control.
General Comments
The following comments should be considered for a design with and use of the
module:
Standard configuration of serial port (standard GPS software):
Serial 0 (NMEA) 4800 baud, 8 data bits, no parity, 1 stop bit, no flow
control
Antenna (Antenna connected to Antenna Pin)
Use ground pins (pin 18, pin 20) close to the antenna input for RF groun
Electrical Characteristics
Vcc
Peak Acquisition Current
Average Acquisition Current
Tracking Current
Standby Current
Department of ECE
43
SETCEM
Project Report
(2) Average current is typically only the first two seconds of TTFF
(3) Tracking current typically includes tracking and the post acquisition
portion of TTFF
(4) During standby state: RTC block and core powered on and clock off.
Department of ECE
44
SETCEM
Project Report
4.10.1 Transformer:
Usually, DC voltages are required to operate various electronic equipment and these
voltages are 5V, 9V or 12V. But these voltages cannot be obtained directly. Thus the a.c input
available at the mains supply i.e., 230V is to be brought down to the required voltage level.
This is done by a transformer. Thus, a step down transformer is employed to decrease the
voltage to a required level.
Department of ECE
45
SETCEM
Project Report
4.10.2 Rectifier:
The output from the transformer is fed to the rectifier. It converts A.C. into pulsating
D.C. The rectifier may be a half wave or a full wave rectifier. In this project, a bridge rectifier
is used because of its merits like good stability and full wave rectification.
The Bridge rectifier is a circuit, which converts an ac voltage to dc voltage using both
half cycles of the input ac voltage. The Bridge rectifier circuit is shown in the figure. The
circuit has four diodes connected to form a bridge. The ac input voltage is applied to the
diagonally opposite ends of the bridge. The load resistance is connected between the other two
ends of the bridge.
Department of ECE
46
SETCEM
Project Report
For the positive half cycle of the input ac voltage, diodes D1 and D3 conduct, whereas diodes
D2 and D4 remain in the OFF state. The conducting diodes will be in series with the load
resistance RL and hence the load current flows through RL.
For the negative half cycle of the input ac voltage, diodes D2 and D4 conduct whereas, D1
and D3 remain OFF. The conducting diodes D2 and D4 will be in series with the load
resistance RL and hence the current flows through RL in the same direction as in the previous
half cycle. Thus a bi-directional wave is converted into a unidirectional wave.
8.3 Filter:
Capacitive filter is used in this project. It removes the ripples from the output of
rectifier and smoothens the D.C. Output received from this filter is constant until the mains
voltage and load is maintained constant. However, if either of the two is varied, D.C. voltage
received at this point changes. Therefore a regulator is applied at the output stage.
Department of ECE
Automatic road security control system
Project Report
Department of ECE
48
SETCEM
Project Report
CHAPTER 5
PCB DESIGN AND LAYOUT
5.1 PROCEDURE
5.1.1 PCB Design
The PCB design starts right from the selection of the laminates .The two main types of base
laminate are epoxy glass and phenolic paper laminates are generally used for simple circuits. Though it
is very cheap and can easily be drilled, phenolic paper has poor electrical characteristics and it absorbs
more moisture than epoxy glass. Epoxy glass has higher mechanical strength.
The important properties that have to be considered for selecting the PCB substrate are
the dielectric strength, insulation resistance, water absorption property, coefficient of thermal
expansion, shear strength, hardness, dimensional stability etc.
49
SETCEM
Project Report
Pattern designing is the primary step in fabricating a PCB in this step, all
interconnection between the components in the given circuit are converted into PCB tracks
several factors such as positioning ,the diameter of holes, the area that each component
would occupy ,the type of end terminal should be considered.
The copper side of the PCB should be thoroughly cleaned with the help of alcoholic
spirit or petrol must be completely free from dust and other contaminants. The mirror image
of the pattern must be carbon copied and to the laminate the complete pattern may now be
made each resistant with the screen printing technology.
5.1.6 Developing
In this developing all excessive copper is removed from the board and only the printed
pattern is left behind. About 100ml of tape water should be heated to 75 C and 30.5 grams of
FeCl3 added to it, the mixture should be thoroughly stirred and a few drops of HCl may be
added to speed up the process.
The board with its copper side facing upward should be placed in a flat bottomed
plastic tray and the aqueous solution of FeCl2 poured in the etching process would take 40 to
60 min to complete.
After etching the board it should be washed under running water and then held against
light .the printed pattern should be cleanly visible. The paint should be removed with the help
of thinner.
Department of ECE
50
SETCEM
Project Report
After the etching is completed, hole of suitable diameter should be drilled, then the
PCB may be tin plated using an ordinary 35 Watts soldering rod along with the solder core,
the copper side may be given a coat of varnish to prevent oxidation.
5.1.8 Drilling
Drills for PCB use usually come with either a set of collects of various sizes or a 3Jaw chuck. For accuracy however 3-jaw chunks arent brilliant and small drill below 1 mm
from grooves in the jaws preventing good grips.
5.1.9 Soldering
Begin the construction by soldering the resistors followed by the capacitors and the
LEDs diodes and IC sockets. Dont try soldering an IC directly unless you trust your skill in
soldering. All components should be soldered as shown in the figure. Now connect the switch
and then solder/screw if on the PCB using multiple washers or spaces. Soldering it directly
will only reduce its height above other components and hamper in its easy fixation in the
cabinet. Now connect the battery lead.
5.1.10 Assembling
The circuit can be enclosed in any kind of cabinet. Before fitting the PCB suitable holes
must be drilled in the cabinet for the switch, LED and buzzer. Note that a rotary switch can be
used instead of a slide type.
Switch on the circuit to be desired range. It will automatically start its timing cycles.
To be sure that it is working properly watch the LED flash. The components are selected to
trigger the alarm a few minutes before the set limit.
Department of ECE
51
SETCEM
Project Report
Department of ECE
52
SETCEM
Project Report
ADVANTAGES
Since speed control in automobile is necessary, Automatic road security control system
have many advantages. The main advantage is that speed control can be done in particular
locations where speed control is necessary. Smooth traffic flow can be maintained due to lane
driving. Since the speed is maintained at a constant 30km/h, it is fast enough for travelling and
slow enough for the driver to escape unhurt in a unlikely accident. We can decrease road
accidents to an extent. Petrol consumption is reduced at starting time. It also increases battery
life span. Only a few components are added to get all these advantages. This method is
extremely cost effective and easily implementable as the parts required are available in any
garage.
Its usefulness for long drives (reducing driver fatigue, improving comfort by allowing
positioning changes more safely) across highways and sparsely populated roads. This usually
results in better fuel efficiency.
Some drivers use it to avoid subconsciously violating speed limits. A driver who
otherwise tends to subconsciously increase speed over the course of a highway journey may
avoid a speeding ticket. Such drivers should note, however, that a cruise control may go over
its setting on a downhill which is steep enough to accelerate with an idling engine.
DISADVANTAGES
This system is not without limitations in its present form.
1) We have to set transmitters in all locations where speed control is necessary.
2) Cost is slightly more than existing one.
Department of ECE
53
SETCEM
Project Report
APPLICATIONS
Governors can be used to limit the top speed for vehicles and for some classes of
vehicle such devices are a legal requirement
They can more generally be used to limit the rotational speed of internal combustion
engine or protect the engine from damage due to excessive rotational speed.
Aircraft propellers are another application; The governor senses shaft rpm, and adjusts
or controls the angle of the blades to vary the torque load on the engine. Thus as the
aircraft speeds up (as in a dive) or slows (in climb) the RPM is held constant
Small engines, such as used to power lawn mowers, portable generator, and lawn and
garden tractors, are equipped with a governor to gas limit the engine to a maximum
safe speed when unloaded and to maintain a relatively constant speed despite changes
in loading.
Department of ECE
54
SETCEM
Project Report
FUTURE WORKS
As the first step towards our project, we have created a layout of Automatic road
security control system using GSM module.
In the second step we have to introduce an accident alert system with vibrating sensors.
According to the threshold level variations from the sensors will alert the control room. GPS
modem introduced for location tracking by satellite communication. We get the basic idea of
existing system and its drawbacks. So that it will help us to achieve our target.
Department of ECE
55
SETCEM
Project Report
CONCLUSION
Nowadays, number of road accidents ,traffic rule violations are on the rise such as in
speed limited areas such as metropolitan cities, school areas etcBy the implementation of
this speed governing system in practice, we aim to reduce the repetitive occurrence of such
incidents. Since it is cost efficient, it can be implemented in developing countries like India as
we all know the restless people will not voluntarily take action for speed control. So we hope
there by this project will be able to save at least a few lives.
Department of ECE
56
SETCEM
Project Report
REFERENCES
1) Biding T (2002) Intelligent speed adaptation, Swedish national road administration.
2) Carsha B and Hedlund J (2007) Changing Americas culture of speed on the roads
3) Harsten O (2000) External vehicle speed control-executive summary of projects result,
university of Leeds july 2000.
4) Johnson Mark (No Date), Future of speed control Available
5) Julliere M(1970) speed control methods Available.
6) M Carl Smith and Robert N Schneider (No Date) Road development
7) Wolf SA (2006) speed control- IBM Journal of Research and Development
Department of ECE
57
SETCEM
Project Report
APPENDIX
#include "SMS_RELAY_SWITCHING.h"
void main (void)
{
ADCON1=0x07;
TRISA=0x00;
PORTA=0x00;
TRISC=0x80;
PORTC=0x80;
TRISD=0x00;
PORTD=0x00;
TRISB=0x00;
PORTB=0x00;
all_relay_controll(ALL_RELAY_OFF);
LED_GSM_READY_OFF;
LED_GSM_INIT_OFF;
sci_Init(9600);
Delay_ms(50);
while(1)
{
if(gsm_power_flag==0)gsm_power_on();
Department of ECE
Automatic road security control system
58
SETCEM
if(gsm_boot_ok==1)LED_GSM_INIT_ON; /
Project Report
}
}
void latch_relay(unsigned char relay_port,unsigned char relay_control)
{
if((relay_port=='1')&&(relay_control==RELAY_ON))
{
RELAY1_ON;
}
else if((relay_port=='1')&&(relay_control==RELAY_OFF))
{
RELAY1_OFF;
}
else if((relay_port=='2')&&(relay_control==RELAY_ON))
{
RELAY2_ON;
}
else if((relay_port=='2')&&(relay_control==RELAY_OFF))
{
Department of ECE
SETCEM
Project Report
RELAY2_OFF;
}
else if((relay_port=='3')&&(relay_control==RELAY_ON))
{
RELAY3_ON;
}
else if((relay_port=='3')&&(relay_control==RELAY_OFF))
{
RELAY3_OFF;
}
else if((relay_port=='4')&&(relay_control==RELAY_ON))
{
RELAY4_ON;
}
else if((relay_port=='4')&&(relay_control==RELAY_OFF))
{
RELAY4_OFF;
}
else if((relay_port=='5')&&(relay_control==RELAY_ON))RELAY5_ON;
else if((relay_port=='5')&&(relay_control==RELAY_OFF))RELAY5_OFF;
Department of ECE
Automatic road security control system
60
SETCEM
else if((relay_port=='6')&&(relay_control==RELAY_ON))RELAY6_ON;
TXSTA.SYNC = 0;
else
if((relay_port=='6')&&(relay_control==RELAY_OFF))RELAY6_OFF;
else if((relay_port=='7')&&(relay_control==RELAY_ON))RELAY7_ON;
else
if((relay_port=='7')&&(relay_control==RELAY_OFF))RELAY7_OFF;
else if((relay_port=='8')&&(relay_control==RELAY_ON))RELAY8_ON;
else
if((relay_port=='8')&&(relay_control==RELAY_OFF))RELAY8_OFF;
}
Project Report
Department of ECE
Automatic road security control system
61
RCSTA.SPEN = 1;
RCSTA.CREN = 1;
RCSTA.SREN = 0;
RCSTA.ADDEN=1;
PIE1.TXIE = 0;
PIE1.RCIE = 0;
TXSTA.TX9
RCSTA.RX9
TXSTA.TXEN = 1;
RCSTA.SPEN = 1;
PIR1.RCIF=0;
PIE1.RCIE = 1;
}
void sci_PutByte(unsigned char byte)
{
while(!TXSTA.TRMT); TXREG= byte;
while(!TXSTA.TRMT);
}
void send_to_rs232_fix(unsigned char* char_ptr,unsigned char char_count)
{
SETCEM
Department of ECE
Project Report
SETCEM
for(;char_count!
=0;char_count--) { while(!
TXSTA.TRMT);
TXREG= *char_ptr++;
}
while(!TXSTA.TRMT);
}
void send_to_rs232(unsigned char* char_ptr)
{
while(*char_ptr!=0)
{ while(!TXSTA.TRMT);
TXREG= *char_ptr++;
}
while(!TXSTA.TRMT);
}
Project Report
Department of ECE
63
SETCEM
Project Report
while(!TXSTA.TRMT);
}
void send_to_gsm(unsigned char *char_ptr)
{
while(*char_ptr!=0x00)
{
while(!TXSTA.TRMT);
TXREG= *char_ptr++;
}
while(!TXSTA.TRMT);
}
//**************************************************************************
******************
//return caller add count(master=0),(no match=0xff)
unsigned char caller_id_test(unsigned char char_ptr,unsigned char phone_ptr)
{ unsigned char result,code_count;
if(phone_ptr==0)
{
for(code_count=0;code_count<max_phone_char;code_count++)sms_receive_phoneno[code_
count] = 0x00;
code_count = 0; if((rx0_buffer[char_ptr]!
='+')&&(rx0_buffer[char_ptr]!='0'))
Department of ECE
Automatic road security control system
64
SETCEM
{ sms_receive_phoneno[code_count] ='+';
Project Report
code_count++;
}
result = 0xff;
for(;code_count<max_phone_char;code_count++)
{ if(rx0_buffer[char_ptr]!='"')
{
if(rx0_buffer[char_ptr]='9')
{ result = 0xFE; // number is alphanuric
break;
}
sms_receive_phoneno[code_count] = rx0_buffer[char_ptr];
char_ptr++;
}
else phone_buffer[code_count] = 0x00;
}
if(code_count <= 8)result = 0xFE;
if(result == 0xFE)goto ee1;
}
ee1: return(result);
}
Department of ECE
SETCEM
Project Report
//**************************************************************************
******************
//**************************************************************************
******************
//gsm module location to datetime_buffer
void send_to_datetime(unsigned char* char_ptr)
{ unsigned char digit_count;//,temp[2];
for(digit_count=0;digit_count<max_date_time;digit_count++)
{ if(*char_ptr != '+')datetime_buffer[digit_count]=*char_ptr++;
else datetime_buffer[digit_count] == 0x00;
}
}
//**************************************************************************
******************
void send_to_sms(unsigned char* char_ptr)
{ unsigned char digit_count;
for(digit_count=0;digit_count<max_sms_char;digit_count++)
{
sms_buffer[digit_count]=*char_ptr++;
if((*char_ptr == CR)||(*char_ptr
==LF)) { digit_count++;
sms_buffer[digit_count]=*char_ptr++;
Department of ECE
66
SETCEM
Project Report
digit_count++;
for(;digit_count<max_sms_char;digit_count++)sms_buffer[digit_count]==0x00;
break;
}
}
}
//**************************************************************************
******************
/////////////////
//**************************************************************************
******************
void gsm_power_on(void)
{ //power_on & intialize gsm module
rx0_buff_count=0;
rx0_buff_ready=0;
sms_receive=0;
gsm_power_flag = 1;
update_lcd=1;
gsm_boot_ok=0;
gsm_rdy_flag=0;
}
Department of ECE
67
SETCEM
Project Report
//**************************************************************************
******************
//***********************************************************************
//9410602447
void gsm_receive(void)
{
unsigned char usp_temp,result,temp_usp;
if(rx0_buff_ready==1)
{ //if(gsm_send_flag==0)
rx0_ptr = 0;
while(select_rx0_ptr()==1)
{
if(msg_test((unsigned char*)msg_rdy,&rx0_buffer[rx0_start_ptr],0)==1) //"Call Ready"
{
if(gsm_rdy_flag==0)gsm_rdy_flag=1; //call_ready_flag = 1;
else if(gsm_rdy_flag==1)
{
gsm_rdy_flag=1; //call_ready_flag = 1;
gsm_boot_ok=01 //call_ready_flag = 1;
}
rx0_ptr = rx0_end_ptr;//Not Required
Department of ECE
68
SETCEM
Project Report
}
else if(msg_test((unsigned
char*)msg_call_ready,&rx0_buffer[rx0_start_ptr],0)==1) //"Call Ready"
{
gsm_boot_ok=1; //call_ready_flag = 1;
rx0_ptr = rx0_end_ptr;//Not Required
}
else if(msg_test((unsigned
char*)msg_error,&rx0_buffer[rx0_start_ptr],0)==1)//"ERROR"
{
flag_error=1;// error_flag = 1;
rx0_ptr = rx0_end_ptr;//Not Required
}
else if(msg_test((unsigned char*)msg_ok,&rx0_buffer[rx0_start_ptr],0)==1)//"OK"
{
flag_ok=1;
}
else if(msg_test((unsigned
char*)msg_cms_error,&rx0_buffer[rx0_start_ptr],0)==1) //"+CMS ERROR:" sms not send
{
flag_cms_error=1; //error_flag = 1;
Department of ECE
69
SETCEM
Project Report
Department of ECE
70
SETCEM
Project Report
if((select_rx0_ptr()==1)&&(strlen((char *)sms_receive_phoneno)>10))
{
send_to_sms((unsigned char*)&rx0_buffer[rx0_start_ptr]);
result=0;
sms_receive=0;
if((sms_buffer[0]=='S')&&(sms_buffer[1]=='E')&&(sms_buffer[2]=='T')&&(sms_b
uffer[3]==' ')&&(sms_buffer[4]=='L'))
{
if(strlen((char *)sms_buffer)==9)
{
if((sms_buffer[5]>='1')&&(sms_buffer[5]<='9')&&(sms_buffer[6]=='O')&&(sms_bu
ffer[7]=='N'))
{
sms_receive=1;
latch_relay((unsigned char)sms_buffer[5],(unsigned char)RELAY_ON);
goto sms_exit;
}
else
{
sms_receive=0;
goto sms_exit;
Department of ECE
71
SETCEM
Project Report
}
}
else if(strlen((char *)sms_buffer)==10)
{
if((sms_buffer[5]>='1')&&(sms_buffer[5]<='9')&&(sms_buffer[10]=='O')&&(sms_b
uffer[7]=='F')&&(sms_buffer[8]=='F'))
{
sms_receive=1;
latch_relay((unsigned char)sms_buffer[10],(unsigned char)RELAY_OFF);
goto sms_exit;
}
else
{
sms_receive=0;
goto sms_exit;
}
}
else
{ //error
sms_receive=0;
goto sms_exit;
Department of ECE
72
SETCEM
Project Report
}
}
else
if((sms_buffer[0]=='G')&&(sms_buffer[1]=='E')&&(sms_buffer[2]=='T')&&(strlen((char
*)sms_buffer)==4))
{
sms_receive=2;
goto sms_exit;
}
else
{
sms_receive=0;
goto sms_exit;
}
//reply for sms
sms_exit:rx0_ptr = rx0_end_ptr;//Not Required
rx0_buff_count=0;
rx0_buff_ready=0;
if(sms_receive==0)sms_to_gsm(&sms_receive_phoneno[0],(unsigned char
*)msg_sms_syntax_error,0);//syntax error
else if(sms_receive==1)sms_to_gsm(&sms_receive_phoneno[0],(unsigned char
*)msg_successfully_done,0);//acknowledgement
Department of ECE
73
SETCEM
Project Report
//***********************************************************************
void load_status_buffer(void)
{
/ 'L','1','O',' ',' ',',',
/ 'L','2','O',' ',' ',',',
/ 'L','3','O',' ',' ',',',
/ 'L','4','O',' ',' ',',',
Department of ECE
74
SETCEM
Project Report
Department of ECE
75
SETCEM
Project Report
else
{
buffer_status[9]='F';
buffer_status[10]='F';
}
//relay 3 data status
if(RELAY3==RELAY_ON)
{
buffer_status[15]='N';
buffer_status[16]=' ';
}
else
{
buffer_status[15]='F';
buffer_status[16]='F';
}
//relay 4 data status
if(RELAY4==RELAY_ON)
{
buffer_status[21]='N';
buffer_status[22]=' ';
Department of ECE
76
SETCEM
Project Report
}
else
{
buffer_status[21]='F';
buffer_status[22]='F';
}
//relay 5 data status
if(RELAY5==RELAY_ON)
{
buffer_status[27]='N';
buffer_status[28]=' ';
}
else
{
buffer_status[27]='F';
buffer_status[28]='F';
}
//relay 6 data status
if(RELAY6==RELAY_ON)
{
buffer_status[33]='N';
Department of ECE
77
SETCEM
Project Report
buffer_status[34]=' ';
}
else
{
buffer_status[33]='F';
buffer_status[34]='F';
}
//relay 7 data status
if(RELAY7==RELAY_ON)
{
buffer_status[39]='N';
buffer_status[40]=' ';
}
else
{
buffer_status[39]='F';
buffer_status[40]='F';
}
//relay 8 data status
if(RELAY8==RELAY_ON)
{
Department of ECE
78
SETCEM
Project Report
buffer_status[45]='N';
buffer_status[46]=' ';
}
else
{
buffer_status[45]='F';
buffer_status[46]='F';
}
}
//**************************************************************************
******************
//***********************************************************************
void send_status_buffer(void)
{
send_to_rs232_fix("STATUS:",7); /
/relay 1 data status
if(RELAY1==RELAY_ON)send_to_rs232_fix("1",1);
else send_to_rs232_fix("0",1);
Department of ECE
Automatic road security control system
79
SETCEM
Project Report
if(RELAY2==RELAY_ON)send_to_rs232_fix("1",1);
else send_to_rs232_fix("0",1);
//relay 3 data status
if(RELAY3==RELAY_ON)send_to_rs232_fix("1",1);
else send_to_rs232_fix("0",1);
//relay 4 data status
if(RELAY4==RELAY_ON)send_to_rs232_fix("1",1);
else send_to_rs232_fix("0",1);
//relay 5 data status
if(RELAY5==RELAY_ON)send_to_rs232_fix("1",1);
else send_to_rs232_fix("0",1);
//relay 6 data status
if(RELAY6==RELAY_ON)send_to_rs232_fix("1",1);
else send_to_rs232_fix("0",1);
//relay 7 data status
if(RELAY7==RELAY_ON)send_to_rs232_fix("1",1);
else send_to_rs232_fix("0",1);
//relay 8 data status
if(RELAY8==RELAY_ON)send_to_rs232_fix("1",1);
else send_to_rs232_fix("0",1);
Department of ECE
SETCEM
Automatic road security control system
/*
Project Report
if(RELAY1==RELAY_ON)send_to_rs232_fix("L1ON ",5);
else send_to_rs232_fix("L1OFF ",6);
//relay 2 data status
if(RELAY2==RELAY_ON)send_to_rs232_fix("L2ON ",5);
else send_to_rs232_fix("L2OFF ",6);
//relay 3 data status
if(RELAY3==RELAY_ON)send_to_rs232_fix("L3ON ",5);
else send_to_rs232_fix("L3OFF ",6);
//relay 4 data status
if(RELAY4==RELAY_ON)send_to_rs232_fix("L4ON ",5);
else send_to_rs232_fix("L4OFF ",6);
//relay 5 data status
if(RELAY5==RELAY_ON)send_to_rs232_fix("L5ON ",5);
else send_to_rs232_fix("L5OFF ",6);
//relay 6 data status
if(RELAY6==RELAY_ON)send_to_rs232_fix("L6ON ",5);
else send_to_rs232_fix("L6OFF ",6);
//relay 7 data status
if(RELAY7==RELAY_ON)send_to_rs232_fix("L7ON ",5);
else send_to_rs232_fix("L7OFF ",6);
Department of ECE
SETCEM
Project Report
rx0_buff_ready=0;
send_to_gsm((unsigned char*)sms_send);
greater_flag = 0;
flag_ok=0;
flag_cmgs=0;
flag_cms_error=0;
flag_error=0; while(!
TXSTA.TRMT);
TXREG=CR;
Department of ECE
Automatic road security control system
82
SETCEM
Project Report
Department of ECE
83
SETCEM
Project Report
//rx0_ptr = rx0_ptr_temp;
return(result);
}
//**************************************************************************
******************
//from rx0_ptr,rx0_start_ptr,rx0_end_ptr=rx0_ptr
unsigned char select_rx0_ptr(void)
while(rx0_ptr<=rx0_buff_count)
{ if((rx0_buffer[rx0_ptr]!=0x0a)&&(rx0_buffer[rx0_ptr]!=0x0d))break;
rx0_ptr++;
}
if(rx0_ptr<=rx0_buff_count)
{ rx0_start_ptr = rx0_ptr;
while(rx0_ptr<=rx0_buff_count)
{ if((rx0_buffer[rx0_ptr]==0x0a)||(rx0_buffer[rx0_ptr]==0x0d))break;
rx0_ptr++;
}
}
if(rx0_ptr<=rx0_buff_count)
{ rx0_end_ptr = rx0_ptr;
Department of ECE
84
SETCEM
result = 1;
Project Report
}
return(result);
}
unsigned char msg_test(unsigned char* temp,unsigned char* char_ptr,unsigned char test_any)
{ unsigned char result,x,y;
result = 0;
while(*temp>=0x20)
{ x=*char_ptr;y=*temp;
if(test_any==1)
{ if(x >= 0x60)x = x - 0x20;
if(y >= 0x60)y = y - 0x20;
}
if(x == y)
{ char_ptr++;
temp++;
result = 1;
}
else
{ result=0;
break;
Department of ECE
85
SETCEM
Project Report
}
}
return(result);
}
Exampleif you want to on L1 send-SET L1ON and if you want to off SET L1OFF
Department of ECE
86
SETCEM