Professional Documents
Culture Documents
5 MICROCONTROLLER
17
1
Fig 3.11 PIC16F877A
218
3.5.1 Pin Diagram of PIC16F877A
319
3.5.2 Block Diagram of PIC
420
Operating speed: DC - 20 MHz clock input DC - 200 ns
instruction cycle.
2K x 14 words of Program Memory, 128 x 8 bytes of Data
Memory (RAM).
Pin out compatible to PIC16C72/72A and PIC16F872.
Interrupt capability.
Eight-level deep hardware stack.
Direct, Indirect and Relative Addressing modes.
There are two memory blocks in the PIC16F72 device. These are
the program memory and the data memory. Each block has separate
521
buses so that concurrent access can occur. Program memory and data
memory are explained in this section. Program memory can be read
internally by the user code. The data memory can further be broken down
into the general purpose RAM and the Special Function Registers
(SFRs). The operations of the SFRs that control the “core” are described
here. The SFRs used to control the peripheral modules are described in
the section discussing each individual peripheral module.
622
3.5.8 Data EEPROM and Flash Program Memory
EECON1
EECON2
EEDATA
EEDATH
EEADR
EEADRH
723
0000h to 1FFFh for the PIC16F876A/877A. Addresses above the range
of the respective device will wraparound to the beginning of program
memory. The EEPROM data memory allows single-byte read and writes.
The Flash program memory allows single-word reads and four-word
block writes. Program memory write operations automatically perform an
erase-before write on blocks of four words. A byte write in data
EEPROM memory automatically erases the location and writes the new
data (erase-before-write). The write time is controlled by an on-chip
timer. The write/erase voltages are generated by an on-chip charge pump,
rated to operate over the voltage range of the device for byte or word
operations. When the device is code-protected, the CPU may continue to
read and write the data EEPROM memory. Depending on the settings of
the write-protect bits, the device may or may not be able to write certain
blocks of the program memory; however, reads of the program memory
are allowed. When code-protected, the device programmer can no longer
access data or program memory; this does NOT inhibit internal reads or
writes.
One accumulator.
Register-bank switching is required to access the entire RAM of
many devices.
Operations and registers are not orthogonal; some instructions
can address RAM and/or immediate constants, while others can
use the accumulator only.
3.6 LCD
925
display) or fixed images which can be displayed or hidden, such as preset
words, digits, and 7-segment displays as in a digital clock.
The LCD display used here is especially meant for deaf people
since they cannot be able to hear the voice signals from loudspeaker. The
hand movements done by the action doer is converted into text and it is
displayed in the LCD monitor. In order to get more efficiency 16x2
character LCD-016M002B is used. LCDs do not emit light directly.
Liquid crystal displays (LCDs) are a passive display technology. This
means they do not emit light; instead, they use the ambient light in the
environment. By manipulating this light, they display images using very
26
10
little power. This has made LCDs the preferred technology whenever low
power consumption and compact size are critical. LCDs have displaced
cathode ray tube (CRT) displays in most applications.
27
11
3.6.1 Pin Diagram
12
28
3.6.3 Pin Description
Pin
Function Name
No
1 Ground (0V) Ground
2 Supply voltage; 5V (4.7V – 5.3V) Vcc
3 Contrast adjustment; through a variable VEE
resistor
4 Selects command register when low; and data Register
register when high Select
5 Low to write to the register; High to read from Read/write
the register
6 Sends data to data pins when a high to low Enable
pulse is given
7 DB0
8 DB1
9 DB2
10 DB3
8-bit data pins
11 DB4
12 DB5
13 DB6
14 DB7
15 Backlight VCC (5V) Led+
16 Backlight Ground (0V) Led-
29
3.6.4 LCD Initialization
30
Power supply unit consists of following units:
The step down transformer is used to step down the main supply
voltage from 230AC to lower value. This 230AC voltage cannot be used
directly, thus its stepped down. The transformer consists of primary and
secondary coils. To reduce or step down the voltage, the transformer is
designed to contain less number of turns in its secondary core. Thus the
conversion from AC to DC is essential. This conversion is achieved by
using the rectifier circuit.
31
3.7.2 Rectifier Unit
Capacitors are used as filters. The ripples from the DC voltage are
removed and pure DC voltage is obtained. The primary action performed
by capacitor is charging and discharging. It charges in positive half cycle
of the AC voltage and it will discharge in its negative half cycle, so it
allows only ACC voltage and does not allow the DC voltage. This filter
is fixed before the regulator. Thus the output is free from ripples.
32
affected. Thus this can be successfully reduced here. The regulators are
mainly classified for low voltage and for high voltage.
The filter circuit is often fixed after the regulator circuit. Capacitor
is most often used as filter. The principle of the capacitor is to charge and
discharge. It charges during the positive half cycle of the AC voltage and
discharges during the negative half cycle. So it allows AC voltage and not
DC voltage. This filter is fixed after the regulator circuit to filter any of
the possibly found ripples in the output received finally.
The letters GSM originally stood for the words Grouped Special
Mobile, but as it became clear this cellular technology was being used
worldwide the meaning of GSM was changed to Global System for
Mobile Communications. Since this cellular technology was first
34
deployed in 1991, the use of GSM has grown steadily, and it is now the
most widely cell phone system in the world. GSM reached the 1 billion
subscriber point in February 2004, and is now well over the 3 billion
subscriber mark and still steadily increasing.
35
3.8.2 GSM Services
Speech or voice calls are obviously the primary function for the
GSM cellular system. To achieve this the speech is digitally encoded and
later decoded using a vocoder. A variety of vocoders are available for
use, being aimed at different scenarios.In addition to the voice services,
GSM cellular technology supports a variety of other data services.
Although their performance is nowhere near the level of those provided
by 3G, they are nevertheless still important and useful. A variety of data
services are supported with user data rates up to 9.6 kbps. Services
including Group 3 facsimile, videotext and teletex can be supported.
36
Fig 3.19 Configuration of GSM Modem
1. Bandwidth:
The range of channels limits, the border the bandwidth, the faster
data can be sent.
2. Bits Per Second(BPS):
A single on – off pulse data, eight bits are equivalent to 1 byte.
3. Frequency:
The number of cycles per unit of time frequency is measured in
hertz (hz).
4. KILO:
Kilo is the designation of 1,000; the abbreviation kbps represents
1,000 bits per second.
5. MEGAHERTZ:
1000000 hertz (cycles per second)
38
6. MILLISECOND:
One thousandth of a second.
7. WATT(W):
A measure of power of transmitter.
8. Frequency Band:
The frequency range specified for gsm is 1850 to 1990 MHZ
(mobile station to base station).
9. Duplex Distance:
The duplex distance is 80 MHZ. duplex distance is the distance
between uplink and downlink frequencies. A channel has two
frequencies, 80 MHZ apart.
10.Channel Separation:
The separation between adjacent carrier frequencies. In gsm it is
200 khz.
11.Modulation:
Modulation is process of sending a signal by changing the
characteristics of carrier frequency. This is done in gsm ie (GMSK)
Gaussian minimum shift keying.
12.Transmission Rate:
GSM is a digital system with an over – the – air bit rate of 270
kbps.
13.Access Method:
GSM utilizes the time division multiple accesses (TDMA) concept.
TDMA is a technique in which several different calls may share the
same carrier. Each call is assigned a particular time slot.
14.Speech Coder:
GSM used linear predictive coding (LPC). The purpose of LPC is
used to reduce the bit rate. The LPC provides the parameters for a filter
39
that mimics the vocal tract. The signal passes through this filer leaving
behind a residual signal. Speech is encoded in a 13 kbps.
24
24
The Global Positioning System, usually called GPS, and originally
named NAVSTAR, is a satellite navigation system used for
determining one's precise location almost anywhere on Earth. A GPS
unit receives time signal transmissions from multiple satellites, and
calculates its position by triangulating this data. The GPS was
designed by and is controlled by the United States Department of
Defense and can be used by anybody for free. The cost of maintaining
the system is approximately
25
25
Measurement uncertainty of the majority of commercial GPS
receivers varies from 10-11 to 10-13 by the frequency scale, and from
100 ns to 50 ns by the time scale, being dependent on the receiver design.
The main sources of uncertainty in GPS measurements are the GPS
receiver position error, the orbital error, the satellite and receiver clock
errors, the ionosphere and the troposphere delays, the receiver internal
delay, the satellite antenna and cable delay, the receiver noise, and the
multipath error. The frequency uncertainty for a GPS receiver is larger
than that for Cs-standard by 2-3 orders within a short-time interval (1 –
1000 s), and by one order within a long-term interval of about one week.
27
27
Satellites
28
28
24 GPS satellites are currently in orbit around the earth. the first
was launched in 1972 and the latest satellite was launched in 2012. The
maximum available at any time from a point in Oregon is generally
between 4 to 11. The satellites send out radio signals that are collected
and read by the GPS receiver.
29
29
Fig: 3.5 Working of GPS modem
30
30
GPS satellites broadcast signals from space that are picked up and
identified by GPS receivers. Each GPS receiver then provides
three- dimensional location (latitude, longitude, and altitude) plus the
time.
SPACE SEGMENT:
24+ satellites
20,200 km altitude
55 degrees’ inclination
31
31
Each satellite passes over a ground monitoring station every 12
hours
Space Vehicles (SV) in GPS parlance. The GPS design originally called
for
24 SVs, this was modified to six planes with four satellites each.
The orbital planes are centered on the Earth, not rotating with respect to
the distant stars. The six planes have approximately 55° inclination
(tilt relative to Earth's equator) and are separated by 60° right ascension
of the ascending node (angle along the equator from a reference point to
the orbit's intersection.
32
32
The full constellation of 24 satellites that make up the GPS space
segment are orbiting the earth about 20,200 km above us. They are
constantly moving, making two complete orbits in less than 24 hours.
These satellites are travelling at speeds of roughly 7,000 miles an hour.
Here are some other interesting facts about the GPS satellites (also
called NAVSTAR, the official U.S. Department of Defense name for
GPS):
33
33
The first GPS satellite was launched in 1978.
The receiver must be aware of the PRN codes for each satellite
to reconstruct the actual message data. The C/A code, for civilian
use, transmits data at 1.023 million chips per second, whereas the P code,
for U.S. military use.
When people talk about "a GPS," they usually mean a GPS
receiver. The Global Positioning System (GPS) is actually a
constellation of 24
Earth-orbiting satellites The U.S. military developed and implemented
this satellite network as a military navigation system, but soon opened it
up to everybody else.
40
CHAPTER 4
SOFTWARE DESCRIPTION
42
After that run the patch which exist in the same folder where the
MAXIM_LICENCE exists.
Then browse for c:\Program files\Lab center electronics
\Proteus.
Finally choose next, and then select finish.
Getting started to PROTEUS:
From Start menu choose PROTEUS, and then choose ISIS.
To get a part click on Devices (P).
Write the name of the PIC16F877A.
To get LED write led then choose red led.
To get a resistor write 1k and choose the first part.
43
Chapter-4
Sophisticated security
5.2 APPLICATIONS:
5.3 DISADVANTAGES:
Required
Battery.
If the kit is moved a little bit, the GPS modem again takes time to
detect the location.
44
CHAPTER 6
CONCLUSION
implementation. This work includes the study of GSM and GPS modems
using sensors.
switch is pressed we will be getting the location from GSM modem to our
mobile numbers which are stored in EEPROM and GSM network so that
Using wireless GPS modem and wireless Panic button the carrying
8.2 BIBLIOGRAPHY:
1. WWW.MI TEL.DATABOOK.COM
2. WWW.ATMEL.DATABOOK.COM
3. WWW.FRANKLIN.COM
4. WWW.KEI L.COM
5. WWW.EMBEDDED.COM
6. WWW.ATMELCORPORATION.COM
7. WWW.WIKIPEDIA.COM
8. WWW.I KALOGIC.COM/CAT_MICROCONTROLLERS.PHP
47
APPENDICES
///9786300345
#include<pic.h>
__CONFIG(0x3f72);
#define rs RE2
#define en RE0
#define PIR RD0
void lcd_init();
void command(unsigned char);
void lcd_disp(unsigned char);
void lcdcmd(unsigned char);
void lcd_data(unsigned char);
void lcd_display(unsigned char ,unsigned char);
void sms();
void mob_init();
void ser_init();
50
//__CONFIG ( XT & WDTDIS & PWRTEN & BOREN & DUNPROT & PROTECT & DEBUGDIS &
LVPDIS & DP) ;
void Transmit_power_on(void);
unsigned char IntialCount;
void Latlongdisplay(void);
void main()
{
TRISB=0X00;
TRISD=0X01;
TRISE=0x00;
ADCON1=0X07;
TRISC=0X80;PIR=0;
INTCON=0XE0;//eXTERNAL INTERRRUPT ENABLED
OPTION=0XC4;//3;
TMR0=193;
ser_init();
lcd_init();
mob_init();// LCD Initialization
cpu_seq("TESTD");
ser_out(0x0d);
GSM_Count=0;
command(0x01);
command(0x80);
lcd_condis(" Welcome To GPS");
recstage=0;
IntialCount=0;
while(IntialCount < 3);
cpu_seq("TESTD");
ser_out(0x0d);
RCIF=0;
Placevalue=0;
Latlongdisplay();
while(1)
{
if(RC0==1)
{
Latlongdisplay();
sms();
}
if (RC1==1)
{
sms();
}
else
{
Latlongdisplay();
}
}
51
}
else if(RCIF==1)
{
RCIF =0;
RecvReg = RCREG;
switch(GPS_Check)
{
case 0:
if(RecvReg!= '$')
GPS_Check=0;
else
GPS_Check++;
break;
case 1:
if(RecvReg=='G')
GPS_Check++;
else
GPS_Check=0;
break;
case 2:
if(RecvReg=='P')
GPS_Check++;
else
GPS_Check=0;
break;
case 3:
switch(RecvReg)
{
case 'G':
GPS_Check++;
break;
case 'L':
GPS_Check++;
break;
//case 'L':
//GPS_Check++;
//break;
default:
GPS_Check=0;
}
break;
case 4:
switch(RecvReg)
{
52
case 'M':
GPS_Check++;
break;
case 'G':
GPS_Check++;
break;
case 'T':
GPS_Check++;
break;
default:
GPS_Check=0;
}
break;
case 5:
switch(RecvReg)
{
case 'C':
GPS_Check++;
GPS_COUNT=0;
GPS_string_check=0;
break;
case 'A':
GPS_Check++;
break;
case 'G':
GPS_Check++;
break;
default:
GPS_Check=0;
}
break;
case 6:
switch(GPS_string_check)
{
case 2://GPS VALID OR INVALID
switch (RecvReg)
{
case 'A':
break;
case 'V':
GPS_string_check=0;
GPS_Check=0;
break;
}
break;
case 3:///LATITUDE
if(RecvReg!=',')
{
GPS_Latitude[GPS_COUNT++]=RecvReg;
if(GPS_COUNT==10)
GPS_Latitude[GPS_COUNT++]='\0';
}
break;
case 5://LONGITUDE
if(RecvReg!=',')
{
GPS_Longitude[GPS_COUNT++]=RecvReg;
if(GPS_COUNT==11)
GPS_Longitude[GPS_COUNT++]='\0';
Gps_Disp=1;
}
break;
}
switch(RecvReg)
{
case 0X0D :
GPS_Check=0;
53
break;
case ',':
GPS_COUNT=0;
GPS_string_check++;
break;
}
break;
}
}
}
void lcd_init()
{
command(0x02); // To initialize LCD in 4-bit mode.
command(0x28); // To initialize LCD in 2 lines, 5x7 dots and 4bit mode.
command(0x0C);
command(0x06);
}
void ser_init()
{
SPBRG=64; // for 1200 baud rate
BRGH = 1; // baud rate low
SYNC = 0; // asynchronous mode
SPEN = 1; // serial port enable
TXEN = 1; // tx enable
RCIE = 1; // interrupt set
CREN = 1; // rx enable
GIE=1;
PEIE=1;
}
54
void ser_out(unsigned char val)
{
TXREG =val;
while(!TXIF);
TXIF = 0;
delay(250);
}
void Latlongdisplay(void)
{
//command(0x01);
command(0x80);
lcd_condis(" LAT: ");
command(0x85);
lcd_condis(GPS_Latitude);
command(0xc0);
lcd_condis("LON: ");
command(0xc4);
lcd_condis(GPS_Longitude);
//ser_out(0x0d);
//cpu_seq("LATITUDE:");
//cpu_seq(GPS_Latitude);
//ser_out(0x0d);
//cpu_seq("LONGITUDE:");
//cpu_seq(GPS_Longitude);
//ser_out(0x0d);
}
void mob_init()
{
command(0x01);
command(0x80);
lcd_condis("GSM INITILIZATION");
command(0xc0);
lcd_condis("WAITING..........");
for(ii=0;ii<=15;ii++)
{
command(0xce);
lcd_disp(ii/10+0x30);
lcd_disp(ii%10+0x30);
delay(5000); delay(5000);
delay(5000);
delay(5000); delay(5000);
delay(5000);
ser_dis("AT",2);
ser_out(0x0d);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);
ser_dis("ATE0",4);
ser_out(0x0d);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);
ser_dis("AT",2);
ser_out(0x0d);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);
ser_dis("AT+CMGF=1",9);
ser_out(0x0d);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);
//ser_out(0x0A);
ser_dis("AT+CNMI=2,2,0,0,0",17);
ser_out(0x0d);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);
// ser_out(0x0A);
}
void sms()
{
ser_dis("AT",2);
ser_out(0x0d);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(
5000);delay(5000);delay(5000);delay(5000);
ser_dis("AT",2);
ser_out(0x0d);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);
55
delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);
ser_dis("ATE0",4);
ser_out(0x0d);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(
5000);delay(5000); delay(5000);delay(5000);delay(5000);delay(5000);
delay(5000);delay(5000);delay(5000);delay(5000); delay(5000);delay(5000);delay(5000);delay(5000);
ser_dis("AT+CMGF=1",9);
ser_out(0x0d);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(
5000);delay(5000);delay(5000);delay(5000);
ser_dis("AT+CSCS=",8);
ser_out('"');
ser_dis("GSM",3);
ser_out('"');
ser_out(0x0d);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(
5000);delay(5000);delay(5000);delay(5000);
ser_dis("AT+CMGS=",8);
ser_out('"');
ser_dis("7598029071",10);
ser_out('"');
ser_out(0x0d);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(
5000);delay(5000);delay(5000);delay(5000);delay(5000);
//ser_out(0x0A);
ser_dis("LAT&LON: 8.42 77.03",20);
ser_dis(GPS_Latitude,12);
//ser_dis("E012084.0312",12);
ser_out(0x0d);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(
5000);
// ser_out(0x0A);
ser_out(0x1A);delay(99999999);
//ser_dis("AT",2);
//
ser_out(0x0d);delay(99999999);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);d
elay(5000);delay(5000);delay(5000);delay(5000);
//ser_dis("AT",2);
// ser_out(0x0d);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);
delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);
//ser_dis("ATE0",4);
//
ser_out(0x0d);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(
5000);delay(5000); delay(5000);delay(5000);delay(5000);delay(5000);
//delay(5000);delay(5000);delay(5000);delay(5000); delay(5000);delay(5000);delay(5000);delay(5000);
//ser_dis("AT+CMGF=1",9);
//ser_out(0x0d);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);
delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);
//ser_dis("AT+CSCS=",8);
//ser_out('"');
//ser_dis("GSM",3);
//ser_out('"');
//
ser_out(0x0d);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(
5000);delay(5000);delay(5000);delay(5000);
// ser_dis("AT+CMGS=",8);
// ser_out('"');
// ser_dis("8124252728",10);
// ser_out('"');
//
ser_out(0x0d);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(
5000);delay(5000);delay(5000);delay(5000);delay(5000);
56
//ser_out(0x0A);
//ser_dis("E012084.0312",12);
//ser_out(0x0d);
//delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5000);delay(5
000);delay(5000);delay(5000);
//delay(5000);delay(5000);delay(5000);delay(5000);
// ser_out(0x0A);
// ser_out(0x1A);delay(5000);
57