CHAPTER 1

INTRODUCTION The Global Positioning System (GPS) is a space-based satellite navigation system that provides location and time information in all weather conditions, anywhere on or near the Earth where there is an unobstructed line of sight to four or more GPS satellites. The system provides critical capabilities to military, civil and commercial users around the world. It is maintained by the United States government and is freely accessible to anyone with a GPS receiver. The GPS project was developed in 1973 to overcome the limitations of previous navigation systems,integrating ideas from several predecessors, including a number of classified engineering design studies from the 1960s. GPS was created and realized by the U.S. Department of Defense (DoD) and was originally run with 24 satellites. It became fully operational in 1994. Bradford Parkinson, Roger L. Easton, and Ivan A. Getting are credited for inventing it. It is also called NAVSTAR(Navigation Satellite Timing And Ranging) Advances in technology and new demands on the existing system have now led to efforts to modernize the GPS system and implement the next generation of GPS III satellites and Next Generation Operational Control System (OCX).Announcements from the Vice President and the White House in 1998 initiated these changes. In 2000, U.S. Congress authorized the modernization effort, GPS III. In addition to GPS, other systems are in use or under development. The Russian Global Navigation Satellite System (GLONASS) was developed contemporaneously with GPS, but suffered from incomplete coverage of the globe until the mid-2000s. There are also the planned European Union GALILEO positioning system, Chinese COMPASS navigation system, and Indian Regional Navigational Satellite System. Structure of GPS System The current GPS consists of three major segments. These are the space segment (SS), a control segment (CS), and a user segment (US).The U.S. Air Force develops, maintains, and operates the space and control segments. GPS satellites broadcast signals from space, and each GPS receiver uses these signals to calculate its three-dimensional location (latitude, longitude, and altitude) and the current time. The space segment is composed of 24 to 32 satellites in medium Earth orbit and also includes the payload adapters to the boosters required to launch them into orbit. The control segment is composed of a master control station, an alternate master control station, and a host of dedicated and shared ground antennas and monitor stations. The user segment is composed of hundreds of thousands of U.S. and allied military users of the secure GPS Precise Positioning Service, and tens of millions of civil, commercial, and scientific users of the Standard Positioning Services.

1

Space segment

A visual example of a 24 satellite GPS constellation in motion with the Earth rotating. The space segment (SS) is composed of the orbiting GPS satellites, or Space Vehicles (SV) in GPS parlance. The GPS design originally called for 24 SVs, eight each in three approximately circular orbits, but this was modified to six orbital planes with four satellites each. The orbits are centred on the Earth, not rotating with the Earth, but instead fixed with respect to the distant stars. The six orbit 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). The orbital period is one-half a sidereal day, i.e., 11 hours and 58 minutes.[53] The orbits are arranged so that at least six satellites are always within line of sight from almost everywhere on Earth's surface. The result of this objective is that the four satellites are not evenly spaced (90 degrees) apart within each orbit. In general terms, the angular difference between satellites in each orbit is 30, 105, 120, and 105 degrees apart which sum to 360 degrees. As of December 2012, there are 32 satellites in the GPS constellation. The additional satellites improve the precision of GPS receiver calculations by providing redundant

2 measurements. With the increased number of satellites, the constellation was changed to a non-uniform arrangement. Such an arrangement was shown to improve reliability and availability of the system, relative to a uniform system, when multiple satellites fail. About nine satellites are visible from any point on the ground at any one time, ensuring considerable redundancy over the minimum four satellites needed for a position. SOME SPECIFICATION OF SATELLITE

: 930 kg.(in orbit) : 5.1 m. : 4 km/sec : 1575.42 MHz and 1227.60 MHz : 1783.74 MHz : 2 Cesium and 2 Rubidium : 7.5 year (later model BlockIIR 10 years)

Control segment

Ground monitor station used from 1984 to 2007, on display at the Air Force Space & Missile Museum The control segment is composed of

1. a master control station (MCS), 2. an alternate master control station, 3. four dedicated ground antennas and 4. six dedicated monitor stations

Master Control Station ( one station ): The master control station is responsible for overall managment of the remote monitoring and transmission sites. As the center for support operations , It calculates any position or clock errors for each individual satellite from monitor stations and then order the appropriate corrective information back to that satellite.

Monitor Stations ( four stations ): Each of monitor stations checks the exact altitude , position , speed , and overall of the orbiting of satellites. A station can track up to 11 satellites at a time. This check-up is performed twice a day by each station as the satellites go around the earth.

Ground Antennas: Ground antennas monitor and track the satellites from horizon to horizon. They also transmit correction information to individual satellites.

3

Satellite maneuvers are not precise by GPS standards. So to change the orbit of a satellite, the satellite must be marked unhealthy, so receivers will not use it in their calculation. Then the maneuver can be carried out, and the resulting orbit tracked from the ground. Then the new ephemeris is uploaded and the satellite marked healthy again. The Operation Control Segment (OCS) currently serves as the control segment of record. It provides the operational capability that supports global GPS users and keeps the GPS system operational and performing within specification. User segment The user segment is composed of hundreds of thousands of U.S. and allied military users of the secure GPS Precise Positioning Service, and tens of millions of civil, commercial and scientific users of the Standard Positioning Service. In general, GPS receivers are composed of an antenna, tuned to the frequencies transmitted by the satellites, receiver-processors, and a highly stable clock (often a crystal oscillator). They may also include a display for providing location and speed information to the user. A receiver is often described by its number of channels: this signifies how many satellites it can monitor simultaneously. Originally limited to four or five, this has progressively increased over the years so that, as of 2007, receivers typically have between 12 and 20 channels. GPS receivers may include an input for differential corrections, using the RTCM SC-104 format. This is typically in the form of an RS-232 port at 4,800 bit/s speed. Data is actually sent at a much lower rate, which limits the accuracy of the signal sent using RTCM.Receivers with internal DGPS receivers can outperform those using external RTCM data. As of 2006, even low-cost units commonly include Wide Area Augmentation System (WAAS) receivers.

Other Navigation System

GLONASS

The Russian government has developed a system, similar to GPS, called GLONASS. The first GLONASS satellite launch was in October 1982. The full constellation consists of 24 satellites in 3 orbit planes, which have a 64.8 degree inclination to the earth's equator. The GLONASS system now consists of 12 healthy satellites. GLONASS uses the same code for 4 each satellite and many frequencies, whereas GPS which uses two frequencies and a different code for each satellite. Some GPS receiver manufacturers have incorporated the capability to receive both GPS and GLONASS signals. This increases the availability of satellites and the integrity of combined system.

Failure of GLONASS

Three Russian navigation satellites crashed into the Pacific Ocean Sunday during the launch of a Proton rocket from Kazakhstan. Officials have established a board of inquiry to investigate the cause of the mishap.

The Proton rocket blasted off at 1025 GMT (5:25 a.m. EST) from the Baikonur Cosmodrome in Kazakhstan. Live video from the launch showed a normal ascent into a clear early afternoon sky.

The Proton's three core stages were supposed to deliver the rocket's Block DM upper stage and three Glonass navigation satellites to space within about 10 minutes of liftoff.

According to Russia's Novosti news agency, the Proton rocket deviated from its course 8 degrees. The outlet quoted an unnamed Russian aerospace industry source as saying the Block DM stage and three payloads crashed into the Pacific Ocean about 1,500 kilometers, or 932 miles, northwest of Honolulu.

"According to telemetry, the spacecraft's cluster was lofted into non-targeted orbit," Khrunichev and The Proton rocket lifts off from the Roscosmos said in a joint statement. "Special Board Baikonur Cosmodrome Sunday. has been established to find out the cause of the Credit: Roscosmos contingency and to define next steps."

The last failure of a Proton core vehicle was in September 2007, when the rocket's first and second stages did not separate properly, dooming a Japanese commercial communications satellite.The most recent mishap blamed on a Block DM upper stage was a Sea Launch mission in June 2004, in which a commercial payload was placed in a lower-than-planned orbit. The spacecraft overcame the Block DM anomaly, eventually reaching its planned geosynchronous orbit.

The Block DM was supposed to fire twice during Friday's launch to inject the three Glonass satellites in orbit 12,000 miles above Earth with an inclination of about 65 degrees.

5

GALILEO

Galileo is Europe's contribution to the next generation Global Navigation Satellite System (GNSS). Unlike GPS, which is funded by the public sector and operated by the U.S. Air Force, Galileo will be a civil-controlled system that draws on both public and private sectors for funding. The service will be free at the point of use, but a range of chargeable services with additional features will also be offered. These additional features would include improved reception, accuracy and availability. Design of the Galileo system is being finalized and the delivery of initial services is targeted for 2008

THE INDIAN PROJECT “GAGAN”

The GPS-Aided Geo Augmented Navigation (GAGAN) system, aimed at making Indian skies safer, is undergoing final operation phase which will be over in the next three years before it is commissioned. ―The GAGAN project is currently undergoing the final operation phase since June last year and is scheduled to be completed by June 2013,‖ an official from the Airports Authority of India (AAI) said. The AAI, in collaboration with Indian Space Research Organisation (ISRO), is developing and implementing this state-of-the-art satellite-based navigation system. Once operational, GAGAN project would provide augmented information for satellite navigation to aircraft flying over Indian airspace and the routes over the high seas with high level of accuracy, integrity and continuity at all phases of flight operations, he added. ―The system is being implemented in a phased manner. The first phase of technical demonstration got over in August 2007,‖ he said. The Flight Management System (FMS), based on GAGAN, will also help the operators to save time and money by managing climb, descent and engine performance profiles of aircraft. The FMS will also help in improving airport and airspace access in all weather conditions, and the ability to meet the environmental and obstacle clearance constraints. GAGAN also aims to enhance reliability and reduce delays by defining more precise terminal area procedures that feature parallel routes and environmentally optimised airspace corridors.

After its final operational phase completion, GAGAN, the estimated cost of which is Rs 774 crore, will be compatible with other Space Based Augmentation System such as the Wide Area Augmentation System of the US, the European Geostationary Navigation Overlay Service and the Multi-functional Satellite Augmentation System of Japan and will provide seamless air navigation service across regional boundaries.

6

Terms used in GPS

When you switch the GPS on,time-to-first-fix varies depending on how long it is since you last used the GPS.To get a fix the GPS reciever needs a valid almanac, initial location, time, and ephemeris data.

The term ―cold/warm/hot start‖ indicate how many of thes pieces of the data the GPS reciever already has.The term mean different things to different GPS manufactures.

a) Hot Start: The hot start is when the GPS device remembers its last calculated position and the satellites in view, the almanac used (information about all the satellites in the constellation), the UTC Time and makes an attempt to lock onto the same satellites and calculate a new position based upon the previous information. This is the quickest GPS lock but it only works if you are generally in the same location as you were when the GPS was last turned off.

b) Warm Start: The warm start is when the GPS device remembers its last calculated position, almanac used, and UTC Time, but not which satellites were in view. It then performs a reset and attempts to obtain the satellite signals and calculates a new position. The receiver has a general idea of which satellites to look for because it knows its last position and the almanac data helps identify which satellites are visible in the sky. This takes longer than a hot start but not as long as a cold start.

c) Cold Start : the cold start is when the GPS device dumps all the information, attempts to locate satellites and then calculates a GPS lock. This takes the longest because there is no known information.

d) WAAS :The Wide Area Augmentation System (WAAS) is an air navigation aid developed by the Federal Aviation Administration to augment the Global Positioning System (GPS), with the goal of improving its accuracy, integrity, and availability. Essentially, WAAS is intended to enable aircraft to rely on GPS for all phases of flight, including precision approaches to any airport within its coverage area.

WAAS uses a network of ground-based reference stations, in North America and Hawaii, to measure small variations in the GPS satellites' signals in the western hemisphere. Measurements from the reference stations are routed to master stations, which queue the received Deviation Correction (DC) and send the correction messages to geostationary WAAS satellites in a timely manner (every 5 seconds or better). Those satellites broadcast the correction messages back to Earth, where WAAS-enabled GPS receivers use the corrections while computing their positions to improve accuracy. The origins of WAAS The Federal Aviation Administration (FAA) and the Department of Transportation (DOT) are developing the WAAS program for use in precision flight approaches. Currently, GPS alone does not meet the FAA's navigation requirements for accuracy, integrity, and availability. WAAS corrects for GPS signal errors caused by ionospheric disturbances, timing, and satellite orbit errors, and it provides vital integrity information regarding the health of each GPS satellite.

7

How it Works WAAS consists of approximately 25 ground reference stations positioned across the United States that monitor GPS satellite data. Two master stations, located on either coast, collect data from the reference stations and create a GPS correction message. This correction accounts for GPS satellite orbit and clock drift plus signal delays caused by the atmosphere and ionosphere. The corrected differential message is then broadcast through one of two geostationary satellites, or satellites with a fixed position over the equator. The information is compatible with the basic GPS signal structure, which means any WAAS-enabled GPS receiver can read the signal.

Who benefits from WAAS? Currently, WAAS satellite coverage is only available in North America. There are no ground reference stations in South America, so even though GPS users there can receive WAAS, the signal has not been corrected and thus would not improve the accuracy of their unit. For some users in the U.S., the position of the satellites over the equator makes it difficult to receive the signals when trees or mountains obstruct the view of the horizon. WAAS signal reception is ideal for open land and marine applications. WAAS provides extended coverage both inland and offshore compared to the land-based DGPS (differential GPS) system. Another benefit of WAAS is that it does not require additional receiving equipment, while DGPS does.

Other governments are developing similar satellite-based differential systems. In Asia, it's the Japanese Multi-Functional Satellite Augmentation System (MSAS), while Europe has the Euro Geostationary Navigation Overlay Service (EGNOS). Eventually, GPS users around the world will have access to precise position data using these and other compatible systems.

It just keeps getting better 100 meters: Accuracy of the original GPS system, which was subject to accuracy degradation under the government-imposed Selective Availability (SA) program.

15 meters: Typical GPS position accuracy without SA.

3-5 meters: Typical differential GPS (DGPS) position accuracy.

< 3 meters: Typical WAAS position accuracy.

e) Dilution of Precision: The geometric dilution of precision (GDOP) is a useful parameter that indicates the effectiveness of the GPS satellite geometry on the positional navigation performance. In this work, the concept of the dilution of precision is extended to the attitude navigation solution. A new set of parameters, referred to as the Euler angle dilution of precision (EADOP), is defined. The validity and the usefulness of the new parameters are verified through simulations. Two scenarios involving a stationary platform and a moving platform are investigated. The results show that the EADOP is a good indication of the expected accuracy of the Euler angle estimates

8 o GPS errors are magnified by the positional differences between the receiver and the satellites. o GDOP is computed from geometric relationships between the receiver position and the position of the satellites. o Poor GDOP occurs when the satellite angles to the field receiver are similar (signals are all coming in to the receiver in the same angles) o Good GDOP is achieved when the 4 satellites used when the angles are different o Visibility is a factor as well. If some satellites are low in the horizon this causes blocking sometimes causing poor GDOP o GDOP has several components:

 PDOP -Position Dilution of Precision (3D),sometimes known as spherical DOP (1.63)  HDOP - Horizontal Dilution of Precision (Latitude, Longitude) (1.15)  VDOP - Vertical Dilution of Precision (Height) (1.15)  TDOP - Time Dilution of Precision (Time)(0.58)

f) Coarse/Acquisition code: The C/A code is a bi-phase modulated signal with a chip rate of 1.023 MHz.Therefore, the null-to-null bandwidth of the main lobe of the spectrum is 2.046MHz. Each chip is about 977.5 ns (1/1.023 MHz) long. The transmitting bandwidth of the GPS satellite in the L1 frequency is approximately 20 MHz to accommodate the P code signal; therefore, the C/A code transmitted containsthe main lobe and several sidelobes. The total code period contains 1,023 chips. With a chip rate of 1.023 MHz, 1,023 chips last 1 ms; therefore, the C/A code is 1 ms long. This code repeats itself every millisecond. In order to find the beginning of a C/A code in the received signal only a very limited data record is needed such as 1 ms. If there is no Doppler effect on the received signal, then one millimeter of data contains all the 1,023 chips. Different C/A codes are used for different satellites. The C/A code belongs to the family of Gold codes,(5) which will be discussed in the next section.Figure 5.3 shows the GPS data format. The first row shows a C/A code with1,023 chips; the total length is 1 ms. The second row shows a navigation data bit that has a data rate of 50 Hz; thus, a data bit is 20 ms long and contains 20 C/A codes. Thirty data bits make a word that is 600 ms long as shown in the third row. Ten words make a subframe that is 6 seconds long as shown in row four. The fifth row shows a page that is 30 seconds long and contains 5 subframes. Twenty-five pages make a complete data set that is 12.5 minutes long as shown in the sixth row. The 25 pages of data can be referred to as a superframe.

9 g) Precision code: The P code is bi-phase modulated at 10.23 MHz; therefore, the main lobe of the spectrum is 20.46 MHz wide from null to null. The chip length is about 97.8 ns(1/10.23 MHz). The code is generated from two pseudorandom noise (PRN) codes with the same chip rate. One PRN sequence has 15,345,000 chips, which has a period of 1.5 seconds, the other one has 15,345,037 chips, and the difference is 37 chips. The two numbers, 15,345,000 and 15,345,037, are relative prime, which means there are no common factors between them. Therefore, the code length generated by these two codes is 23,017,555.5 (1.5 × 15,345,037) seconds, which is slightly longer than 38 weeks. However, the actual length of the P code is 1 week as the code is reset every week. This 38-week-long code can be divided into 37 different P codes and each satellite can use a different portion of the code. There are a total of 32 satellite identification numbers although only 24 of them are in the orbit. Five of the P code signals (33–37) are reserved for other uses such as ground transmission. In order to perform acquisition on the signal, the time of the week must be known very accurately. Usually this time is found from the C/A code signal that will be discussed in the next section. The navigation data rate carried by the P code through phase modulation is at a 50 Hz rate.

h) Almanac and Ephemeris: In order to determine your position, a GPS receiver must know two things. First, it must receive very accurate timing information from several GPS satellites. Second, it must know precisely where those satellites are. Timing information is broadcast continuously, so that several measurements can be taken each second. In addition to timing information, each GPS satellite transmits "almanac" and "ephemeris" data.

The almanac tells the GPS receiver roughly where all the GPS satellite are. Each satellite transmits the full almanac every 12.5 minutes or so, so a GPS receiver which knows nothing at all can determine the rough location of the satellites in less than 15 minutes. Because it is so coarse, almanac data is considered valid for several months. Once it's determined their rough location, a GPS receiver can listen for ephemeris data. Each satellite broadcasts this data, which tells the receiver its precise orbit, every 30 seconds. Because it is very precise, ephemeris data is only valid for 30 minutes or so.Because of this, it's important to turn the FlySight on for 15 minutes at the start of each day. Although you could wait longer, it's good to develop a regular routine so that you won't forget. This ensures that the FlySight always has a valid almanac. In addition, the FlySight should be turned on for a minute or so while waiting for the plane. This ensures that the FlySight has reasonably accurate ephemeris data, which helps it get a fix quickly when you jump. i) Channel : It tells the number of satellites the GPS can communicate with at one time. At a given time there are at least 24, more often about 30 satellites that make up the GPS system. They orbit the earth about 12,000 miles above us. The system is designed similar levels of service anywhere in the world. So at any given moment of

10

time you won‘t be able to ―see‖ all of the sites at one time. At least half of view due to ground obstructions.

Many GPS devices have a satellite information screen that will show you how many satellites your GPS is tracking at any given time. If you view this page and take yor GPS device somewhere with an unobstructed sky view, you can see how many satellites your GPS is tracking and thus how many channels are being used. The more the channels the better is the accuracy.

j) Selective Availability: Selective Availability is a term used to describe the way signals from the GPS satellites in orbit around the Earth are masked.It is aimed to degrade the performance of the GPS. The U.S. Government controls the satellites, and uses Selective Availability to confuse the GPS receiver so it can't find your exact position.

Each satellite broadcasts a unique signal that tells the receiver the time at the satellite in space. Each satellite also has a unique position in space. The GPS receiver knows where every satellite is supposed to be, knows what time it is on the ground, and hears the signal from each satellite about what time it was in space when the signal was sent. The receiver uses all of this information to calculate the time it took for at least 4 satellite messages to travel to the Earth, and then uses the known position for those 4 (or more) satellites to figure out your latitude, longitude, and elevation.

With Selective Availability on, the GPS receiver doesn't know what time it really is at the satellites, because the S.A. makes the satellite send the wrong time. The time the satellite sends is usually pretty close to the real time, but not exact. Without knowing the exact times at the satellites when they create their time message, the receiver cannot tell you the exact location you are trying to measure. This means the GPS receiver gives you a less accurate position because of S.A too! k) Pseudo Random Noise: A clock reading at the transmitted antenna is compared with the clock reading at the receiver antenna. But since the two clocks are not strictly synchronized, the observed signal travel time is biased with systematic synchronization error. Biased ranges are known a pseudo ranges.

11

These are sequence of binary values (zeros and ones or +1 and-1) having random character but identifiable distinctly. Thus pseudo ranges are derived from travel time of an identified PRN signal code. The satellites are identified by the receiver by means of PRN-numbers. Real GPS satellites numbered from 1-32.To WAAS/EGNOS satellites and other pseudolites higher numbered are assigned. These PRN-numbers of the satellites appear on the satellite view screens of many GPS receiver. For simplification of the satellites appear on the satellite view screens of many GPS receivers. For simplification of the satellites networks 32 different PRN-numbers are available, although only 24 satellites are active ,which optimizes the availability, reliability and accuracy of the network. The mentioned PRN-codes are only pseudo random. If the codes were actually random,21023 possibilities would exist. Of many codes only few are suitable for an auto correlation or cross correlation which is necessary for the measurement of the signal propagation time.

12

CHAPTER 2 TYPES OF GPS

Assisted GPS(A-GPS) Assisted GPS, generally abbreviated as A-GPS or AGPS, is a system that can under certain conditions improve the startup performance, or time-to-first-fix (TTFF), of a GPS satellite- based positioning system. It is used extensively with GPS-capable cellular phones, as its development was accelerated by the U.S. FCC's 911 requirement to make the location of a cell phone available to emergency call dispatchers.

"Standalone" or "autonomous" GPS operation uses radio signals from satellites alone. A-GPS additionally uses network resources to locate and use the satellites in poor signal conditions. In very poor signal conditions, for example in a city, these signals may suffer multipath propagation where signals bounce off buildings, or are weakened by passing through atmospheric conditions, walls, or tree cover. When first turned on in these conditions, some standalone GPS navigation devices may not be able to fix a position due to the fragmentary signal, rendering them unable to function until a clearer signal can be received continuously for a long enough period of time. A fix may take as long as 12.5 minutes (the time needed to download the GPS almanac and ephemeris).

Differential GPS

Differential Global Positioning System (DGPS) is an enhancement to Global Positioning System that provides improved location accuracy, from the 15-meter nominal GPS accuracy to about 10 cm in case of the best implementations.

DGPS uses a network of fixed, ground-based reference stations to broadcast the difference between the positions indicated by the satellite systems and the known fixed positions. These stations broadcast the difference between the measured satellite pseudo ranges and actual (internally computed) pseudo ranges, and receiver stations may correct their pseudo ranges by the same amount. The digital correction signal is typically broadcast locally over ground- based transmitters of shorter range.

The term refers to a general technique of augmentation. The United States Coast Guard (USCG) and Canadian Coast Guard (CCG) each run such systems in the U.S. and Canada on the long wave radio frequencies between 285 kHz and 325 kHz near major waterways and harbors. The USCG's DGPS system has been named NDGPS (National DGPS) and is now jointly administered by the Coast Guard and the U.S. Department of Transportation‘s Federal Highway Administration. It consists of broadcast sites located throughout the inland and coastal portions of the United States including Alaska, Hawaii and Puerto Rico.[1]

13

How GPS Works

A GPS receiver must acquire signals from at least four satellites to reliably calculate a three- dimensional position. Ideally, these satellites should be distributed across the sky. The receiver performs mathematical calculations to establish the distance from a satellite, which in turn is used to determine its position. The GPS receiver knows where each satellite is the instant its distance is measured. This position is displayed on the datalogger and saved along with any other descriptive information entered in the field software.

Advantages: -fast speed -leads u in right direction -helps improve mapping skills -makes navigation easier -has panic buttons built in -you can be found easier if in danger or in accident -plugs into your car cigarette lighter

Disadvantages: -cellular devices can track other cellular device users - not very cheap -people focus on GPS more than road = accidents -should be used as backup map but used as 1st resource -needs good care and handling -external power -needs batteries (handheld ones) Strengths: - GPS works in all weather - relatively low costs (compared to other navigation systems) - 100% coverage on the planet - accuracy can vary from millimeters to several meters depending on the technique that is used - because of its low cost, its relatively easy to integrate into other technologies (hence, the boom in the use of GPS in cell phones) - the system is maintained regularly by the US government (as compared to other navigations

14 systems by other countries e.g. GLONASS)

Weaknesses: - GPS satellite signals are weak (when compared to, say, cellular phone signals), so it doesn't work as well indoors, underwater, under trees, etc. - the highest accuracy requires line-of-sight from the receiver to the satellite, this is why GPS doesn't work very well in an urban environment - the US DoD (dept of defense) can, at any given time, deny users use of the system (i.e. they degrade/shut down the satellites)

How can GPS be used?

GPS Applications in Agriculture

More and more producers today are using precision farming techniques that can help increase profits and protect the environment. Precision, or site-specific farming involves applying fertilizer, pesticides and other inputs only where they are needed. GPS-guided equipment is often used for variable rate application of fertilizer (based on soil tests) or pesticides (based on pest survey). GPS can also be used to develop the initial reference maps upon which variable rate applications are based. A GPS system on a combine with a yield monitor can be used to develop an on-the-go yield map or can be used to map weed locations from the combine when harvesting. Mounted in an airplane, GPS can be used to guide aerial spraying operations.

GPS can be used to locate weed, insect or diseases infestations and monitor their spread. It can also be used to navigate back to previously mapped infestations to apply controls. A field map can be created using GPS to record the coordinates of field borders, fence lines, canals, pipelines, and point locations such as wells, buildings, and landscape features. The resulting field map might be the first layer a producer would develop for an on-farm GIS (Geographic Information System). Additional layers showing crop damage from hail or drought, and riparian areas or wetlands could be mapped using GPS. Ranchers could use GPS to develop rangeland utilization maps and to navigate back to previously mapped areas or monitoring sites.

GPS Navigation: Land, Sea and Air

GPS is being used for emergency response (fire, ambulance, police), search and rescue, fleet management (trucking, delivery vehicles, and public transportation) and for automobile guidance systems. Recreational uses of GPS include navigation while hiking, hunting, or skiing. GPS is even used on golf courses to track golf carts, and to let players know how far it is to the center of the greens.

On our nation's waterways, GPS is being used for recreational sailing and fishing and for commercial shipping fleet management. Assisted steering, risk assessment and hazard warning systems for marine navigation are being developed using GPS.

15

In the air, GPS is being used for en-route navigation (helicopter, airplane, hot-air balloon), aircraft landing, and air-collision avoidance systems.

Mapping and Surveying

GPS applications in natural resource management include inventory and mapping of soils, vegetation types, threatened and endangered species, lake and stream boundaries and wildlife habitat. GPS has been used to aid in damage assessment after natural disasters such as fires, floods and earthquakes. GPS has also been used to map archaeological sites and for infrastructure (streets, highways and utilities) mapping, management, and planning for future growth. Engineers use GPS for surveying when building roads, bridges and other structures.

Civilian Applications of GPS The free availability and accuracy of the GPS signals for location and timing, combined with the low cost of receiver chipsets, has made GPS the preferred solution for a very wide and growing range of civilian applications. 1. Transport

At present, road transport applications are the majority users of GPS signals – for commercial fleet management and freight tracking, taxi services, public transport monitoring and passenger information, and emergency vehicle location, dispatch and navigation. Consumers have widely adopted in-car GPS navigation systems and most automobile manufacturers now release new vehicles with optional factory-fitted GPS.

2. Aviation

In commercial aviation, most aircraft now use GPS for en-route navigation and increasingly GPS is being used for initial approach and non-precision approach to specified airfields. Automatic Dependent Surveillance - Broadcast (ADS-B) is being developed globally as the preferred future technology for commercial air traffic control; this involves aircraft calculating their position using GPS and broadcasting it to other aircraft. GPS is also widely used for navigation of unmanned aerial vehicles (UAVs) for professional applications such as resource mapping and aerial surveying – imaging tasks previous performed by satellites such as NASA‘s Landsat.

3. Shipping & Rail Transport

Maritime applications include ocean and inshore navigation, dredging, port approaches, harbour entrance and docking, vessel traffic services (VTS), Automatic Identification System (AIS), hydrography, and cargo handling. Railway applications include the management of rolling stock, passenger information, preventing doors opening until the carriage is alongside the platform, cargo tracking signalling, train integrity and level crossing approach.

4. Science

Scientific applications of GPS are widespread and include environmental and atmospheric monitoring, animal behaviour studies, botanical specimen location, meteorology and climate research. GPS is used in agriculture and fisheries for land area mapping, yield monitoring,

16 precision planting, spraying and harvesting, autonomous vehicle control and to monitor fishing limits.

5. Security

Security applications include tracking of vehicles, containers, other valuable cargoes, and covert tracking of suspects.

6. Heavy Vehicle Guidance

GPS is being used increasingly to guide and track heavy vehicles in engineering applications such as mining and construction. For example, in highway construction, surveyors and marker pegs have been replaced with in-cabin vehicle guidance and control systems for excavators, graders, bulldozers and road paving machines that allow drivers to follow surveyors‘ pre-programmed site plans and achieve close tolerances for position, level and gradient.

In open-cut mines, GPS is integrated into applications developed by companies such as Leica Geosystems, Topcon Positioning Systems and Trimble/Caterpillar for vehicle guidance, tracking systems and mine asset management systems.

In these professional applications, GPS information is captured by sophisticated IT systems and meshed with other engineering requirements to provide multi-function guidance and control systems.

7. Surveying, Mapping and Geophysics

Professional, survey-grade GPS receivers, capable of utilising signals from both L1 and L2 GPS frequencies, can be used to position survey markers, buildings, bridges and other large infrastructure. GPS is widely used in mapping, including aerial mapping, and other GIS applications. In geophysics, GPS is used to time stamp seismic activity and to monitor position changes in sensitive physical formations such as volcanoes and earthquake fault lines.

8. Telecommunications

GPS timing is important for telecommunications applications, particularly for mobile telephone networks. Synchronous technologies are much more efficient than asynchronous technologies but require a time source with appropriate accuracy, stability and reliability to operate effectively or at all, and GPS satellites can provide this. While ground-based clocks are accurate enough for this purpose (especially with the availability of chip scale atomic clocks (CSAC)), the synchronisation of many such clocks is problematic. GPS allows the derivation of synchronised UTC time through resolving the signals from a number of atomic clock sources at known locations.

9. Financial Services

Global financial systems increasingly need precise timing systems to schedule and prioritise local and international money transfers, settlements and trades, and to provide an audit trail for financial transactions. For example, the time signal provided by the atomic clocks on

17 board the GPS is used by financial institutions worldwide for providing date and time stamps for Electronic Funds Transfers. In some developed countries up to 80% of retail transactions involve either credit or debit cards. With millions of these transactions occurring every minute, a very high level of timing accuracy has become a critical component of financial trading networks.

10. Social Activities

Widely available, low-cost hand-held GPS receivers have enabled a numerous variety of social activities. The most ubiquitous application is in-car navigation, but there are dozens of other applications: GPS-based social networking, geotagging photographs, cross country cycling, hiking, skiing, paragliding, skydiving, geocaching, geodashing and other gaming activities.

Other GPS Applications: The Possibilities are Endless

Other uses of GPS include real estate valuation and taxation assessment, air quality studies, environmental protection, demographic analysis including marketing studies, atmospheric studies, oil and gas exploration, and scientific exploration. There are many additional current and possible uses for GPS. Any application where location information is needed is a possible candidate for GPS.

SIGNAL TRANSMISSION

Transmitted GPS Signals

The principle of position determination by GPS and the accuracy of the positions strongly depend on the nature of the signals. A variety of criteria was considered in the development of a suitable signal structure. In consequence the GPS signal is quite complex and offers the possibility of determining the following parameters: one-way (passive) position determination, exact distance and direction determination (Doppler effect), transmission of navigation information, simultaneous receiving of several satellite signals, provision of corrections for ionospheric delay of signals and insusceptibility against interferences and multi path effects. In order to fulfil all these requirements, the signal structure described below was developed.

Choice of the carrier frequency

To transport data signals, a suitable carrier frequency is required. The choice of the carrier frequency is submitted to the following requirements:

 Frequencies should be chosen below 2 GHz, as frequencies above 2 GHz would require beam antennae for the signal reception  Ionospheric delays are enormous for frequency rages below 100 MHz and above 10 GHz

18

 The speed of propagation of electromagnetic waves in media like air deviates from the speed of light (in vacuum) the more, the lower the frequency is. For low frequencies the runtime is falsified.  he PRN-codes (explained below) require a high bandwidth for the code modulation on the carrier frequency. Therefore a range of high frequencies with the possibility of a high bandwidth has to be chosen.  The chosen frequency should be in a range where the signal propagation is not influenced by weather phenomena like, rain, snow or clouds.

Based on these considerations, the choice of two frequencies proved to be advantageous. Each GPS satellite transmits two carrier signals in the microwave range, designated as L1 and L2 (frequencies located in the L-Band between 1000 and 2000 MHz). Civil GPS receivers use the L1 frequency with 1575.42 MHz (wavelength 19.05 cm). The L1 frequency carries the navigation data as well as the SPS code (standard positioning code). The L2 frequency (1227.60 MHz, wavelength 24.45 cm) only carries the P code and is only used by receivers which are designed for PPS (precision positioning code). Mostly this can be found in military receivers.

Modulation of the carrier signals

Transmission of data

In the GPS system data are modulated onto the carrier signal by means of phase modulations. Phase modulation is a rarely used technique, compared to amplitude modulation (AM) or frequency modulation. In the following, these three modulation techniques shall be explained shortly.

Amplitude modulation

Amplitude modulation of a data signal onto a carrier signal

For the amplitude modulation the amplitude, which corresponds to the strength of the signal, is changed in accordance to the data signal that shall be transported. If this principle would be applied to sound waves, the sound level would change in order to transport a signal. With increasing attenuation it becomes more and more difficult to filter the data from the signal. This kind of modulation is known from AM radio (that's what AM stands for: amplitude modulation).

19

Frequency modulation

Frequency modulation of a data signal onto a carrier

For the frequency modulation, the carrier frequency itself is changed by modulating the data signal onto it. If we stay with the example of the sound waves, the pitch of the tones would be changed while the volume would be kept constant. Frequency modulated signals are less susceptible for disturbances and provides a higher bandwidth than AM modulation. This kind of modulation is used for FM radio.

Phase modulation

Phase modulation of a data signal onto a carrier

When a data signal shall be modulated onto a carrier signal by phase modulation, the sine oscillation of the carrier signal is interrupted and restarted with a phase shift of e.g. 180°. This phase shift can be recognized by a suitable receiver and the data can be restored. Phase modulation leads to an extension of the frequency range of the carrier signal (leading to a spread spectrum) depending on how often the phase is shifted. When the phase changes, wave peaks are followed by wave minimums in a shorter distance than were in the original carrier signal (as can be seen in the graph). This kind of modulation can only be used for the transmission of digital data.

The following graph shows the composition of signals which are transmitted by GPS- satellites. The setup of the NAV/System data is explained in the chapter "data signal composition".

The setup of the NAV/System data is explained in the chapter "data signal composition".

20

Composition of the signals from GPS satellites (according to Peter H. Dana; used with friendly permission)

Remark: Modulo 2 Sum means that sums are formed according to arithmetic rules. If the result is larger than 2, only the rest is kept which can not be divided by 2 (0+0=0; 0+1=1; 1+0=1; 1+1=0).

21

CHAPTER 3 CALCULATION OF USER POSITION

TRILATERATION: Trilateration is the process of determining absolute or relative locations of points by measurement of distances, using the geometry of circles, spheres or triangles. In addition to its interest as a geometric problem, trilateration does have practical applications in surveying and navigation, including global positioning systems (GPS). In contrast to triangulation it does not involve the measurement of angles. In two-dimensional geometry, it is known that if a point lies on two curves such as the boundaries of two circles then the circle centres and the two radii provide sufficient information to narrow the possible locations down to two. Additional information may narrow the possibilities down to one unique location. In three-dimensional geometry, when it is known that a point lies on three surfaces such as the surfaces of three spheres then the centres of the three spheres along with their radii provide sufficient information to narrow the possible locations down to no more than two. If it is known that the point lies on the surface of a fourth sphere then knowledge of this sphere's centre along with its radius is sufficient to determine the one unique location.

The intersections of the surfaces of three spheres is found by formulating the equations for the three sphere surfaces and then solving the three equations for the three unknowns, x, y, and z. To simplify the calculations, the equations are formulated so that the centers of the spheres are on the z = 0 plane. Also the formulation is such that one center is at the origin, and one other is on the x-axis. It is possible to formulate the equations in this manner since any three non-colinear points lie on a unique plane. After finding the solution it can be transformed back to the original three dimensional Cartesian coordinate system. We start with the equations for the three spheres:

22

We need to find a point located at (x, y, z) that satisfies all three equations. First we subtract the second equation from the first and solve for x:

We assume that the first two spheres intersect in more than one point, that is that

In this case substituting the equation for x back into the equation for the first sphere produces the equation for a circle, the solution to the intersection of the first two spheres:

Substituting into the formula for the third sphere and solving for y there results:

Now that we have the x- and y-coordinates of the solution point, we can simply rearrange the formula for the first sphere to find the z-coordinate:

Now we have the solution to all three points x, y and z. Because z is expressed as the positive or negative square root, it is possible for there to be zero, one or two solutions to the problem. This last part can be visualized as taking the circle found from intersecting the first and second sphere and intersecting that with the third sphere. If that circle falls entirely outside or inside of the sphere, z is equal to the square root of a negative number: no real solution exists. If that circle touches the sphere on exactly one point, z is equal to zero. If that circle touches the surface of the sphere at two points, then z is equal to plus or minus the square root of a positive number.

How GPS Determines a Position The GPS receiver uses the following information to determine a position.  ƒ Precise location of satellites: When a GPS receiver is first turned on, it downloads orbit information from all the satellites called an almanac. This process, the first time, can take as long as 12 minutes; but once this information is downloaded, it is stored in the receiver‘s memory for future use.  ƒ Distance from each satellite: The GPS receiver calculates the distance from each satellite to the receiver by using the distance formula: distance = velocity x time. The receiver already knows the velocity, which is the speed of a radio wave or 186,000 miles per second (the speed of light). To determine the time part of the formula, the receiver times how long it takes for a signal from the satellite to arrive at

23

the receiver. The GPS receiver multiplies the velocity of the transmitted signal by the time it takes the signal to reach the receiver to determine distance.  Triangulation to determine position: The receiver determines position by using triangulation. When it receives signals from at least three satellites the receiver should be able to calculate its approximate position (a 2D position). The receiver needs at least four or more satellites to calculate a more accurate 3D position. The position can be reported in latitude/longitude, UTM, or other coordinate system.

Using the Distance Measurements to Calculate a Position Once the receiver has the distance measurements, it's basically a problem of geometry. If it "knows" where the four satellites are, and how far it is from each satellite, it can compute its location through trilateration. Here's an illustration of how it works.

1) The GPS receiver "locks on" to one satellite and calculates the range to be 12,000 miles. This fact helps narrow the receiver location down, but it only tells us that we are somewhere on a sphere which is centered on the satellite and has a 12,000 mile radius. Many of the locations on that sphere are not on earth, but out in space.

2) Now, consider that the receiver picks up a signal from a second satellite and calculates the range between the receiver and the satellite to be 11,000 miles. That means we are also somewhere on a sphere with an 11,000 mile radius with the second satellite at the center. We must, therefore, be somewhere where these two spheres intersect. When the two spheres intersect, a circl e is formed, so we must be somewhere on that circle.

24

3) If the receiver picks up another satellite, say at 11,5000 miles away, another sphere is formed, and there are only two points where the three spheres intersect.

Usually the receiver can discard one of the last two points because it is nowhere near the earth. So, we're left with one point which is the location of the GPS receiver.

4) In practice, a fourth measurement is needed to correct for clock error.

25

Position determination using PRN code

26

27

28

29

30

CHAPTER 4

GPS RECEIVER

4.1 GPS Receiver

The ultimate goal of GPS is to provide position, velocity, and time. To achieve these primary tasks it has to perform are measurement of range and range-rate and demodulation of the navigation data. The navigation data are the 50-bits/s data stream modulated onto the GPS signal. The navigation data contain the satellite clock and orbital parameters which are used in the computation of user position.

BASIC CONCEPT OF GPS RECEIVER AND ITS COMPONENTS  Antenna with preamplifier  Radio frequency (RF) and intermediate frequency (IF) Front end section  Signal tracker and Code correlator section  Reference oscillator  Microprocessor (navigational solution unit)  Other parts: memory, power supply, display and control

Figure 4.1 Major Components of a GPS Receiver

31

4.2 Sources of Errors in GPS

4.2.1 Selective Availability

The most relevant factor for the inaccuracy of the GPS system is no longer an issue. On May 2, 2000 5:05 am (MEZ) the so-called selective availability (SA) was turned off. Selective availability is an artificial falsification of the time in the L1 signal transmitted by the satellite. For civil GPS receivers that leads to a less accurate position determination (fluctuation of about 50 m during a few minutes). Additionally the ephemeris data are transmitted with lower accuracy, meaning that the transmitted satellite positions do not comply with the actual positions. In this way an inaccuracy of the position of 50 – 150 m can be achieved for several hours. While in times of selective availability the position determination with civil receivers had an accuracy of approximately 10 m, nowadays 20 m or even less is usual. Especially the determination of heights has improved considerably from the deactivation of SA (having been more or less useless before).

4.2.2 Satellite geometry

Another factor influencing the accuracy of the position determination is the "satellite geometry". Simplified, satellite geometry describes the position of the satellites to each other from the view of the receiver.If a receiver sees 4 satellites and all are arranged for example in the north-west, this leads to a ―bad‖ geometry. In the worst case, no position determination is possible at all, when all distance determinations point to the same direction. Even if a position is determined, the error of the positions may be up to 100 – 150 m. If, on the other hand, the 4 satellites are well distributed over the whole firmament the determined position will be much more accurate. Let‘s assume the satellites are positioned in the north, east, south and west in 90° steps. Distances can then be measured in four different directions, reflecting a „good― satellite geometry.

The following graph shows this for the two-dimensional case.

32

Fig 4.2 Good geometrical alignment of two satellites

If the two satellites are in an advantageous position, from the view of the receiver they can be seen in an angle of approximately 90° to each other. The signal runtime can not be determined absolutely precise as explained earlier. The possible positions are therefore marked by the grey circles. The point of intersection A of the two circles is a rather small, more or less quadratic field , the determined position will be rather accurate.

Fig 4.73Bad geometrical alignment of two satellites If the satellites are more or less positioned in one line from the view of the receiver, the plane of intersection of possible positions is considerably larger and elongated- The determination of the position is less accurate.The satellite geometry is also relevant when the receiver is used in vehicles or close to high buildings. If some of the signals are blocked off, the remaining satellites determine the quality of the position determination and if a position fix is possible at all. This can be observed in buildings close to the windows. If a position determination is possible, mostly it is not very accurate. The larger the obscured part of the sky, the more difficult the position determination gets.

33

Most GPS receivers do not only indicate the number of received satellites, but also their position on the firmament. This enables the user to judge, if a relevant satellite is obscured by an obstacle and if changing the position for a couple of meters might improve the accuracy. Many instruments provide a statement of the accuracy of the measured values, mostly based on a combination of different factors.To indicate the quality of the satellite geometry, the DOP values (dilution of precision) are commonly used. Based on which factors are used for the calculation of the DOP values, different variants are distinguished:

GDOP (Geometric Dilution Of Precision); Overall-accuracy; 3D-coordinates and time

PDOP (Positional Dilution Of Precision) ; Position accuracy; 3D-coordinates

HDOP (Horizontal Dilution Of Precision); horizontal accuracy; 2D-coordinates

VDOP (Vertical Dilution Of Precision); vertical accuracy; height

TDOP (Time Dilution Of Precision); time accuracy; time

HDOP-values below 4 are good, above 8 bad. HDOP values become worse if the received satellites are high on the firmament. VDOP values on the other hand become worse the closer the satellites are to the horizon and PDOP values are best if one satellite is positions vertically above and three are evenly distributed close to the horizon. For an accurate position determination, the GDOP value should not be smaller than 5.

4.2.3 Satellite Orbits

Although the satellites are positioned in very precise orbits, slight shifts of the orbits are possible due to gravitation forces. Sun and moon have a weak influence on the orbits. The orbit data are controlled and corrected regularly and are sent to the receivers in the package of ephemeris data. Therefore the influence on the correctness of the position determination is rather low, the resulting error being not more than 2 m.

34

4.2.4 Multipath effect

Fig 4.4 Interference caused by reflection of the signals The multipath effect is caused by reflection of satellite signals (radio waves) on objects. It was the same effect that caused ghost images on television when antennae on the roof were still more common instead of todays satellite dishes.For GPS signals this effect mainly appears in the neighbourhood of large buildings or other elevations. The reflected signal takes more time to reach the receiver than the direct signal. The resulting error typically lies in the range of a few meters.

4.2.5 Atmospheric effects

Fig 4.5 Influenced propagation of radio waves through the earth's atmosphere Another source of inaccuracy is the reduced speed of propagation in the troposphere and ionosphere. While radio signals travel with the velocity of light in the outer space, their propagation in the ionosphere and troposphere is slower.In the ionosphere in a height of 80 – 400 km a large number of electrons and positive charged ions are formed by the ionizing force of the sun. The electrons and ions are concentrated in four conductive layers in the ionosphere (D-, E-, F1-, and F2-layer). These layers refract the electromagnetic waves from the satellites, resulting in an elongated runtime of the signals.

35

4.2.6 Clock inaccuracies and rounding errors

Despite the synchronization of the receiver clock with the satellite time during the position determination, the remaining inaccuracy of the time still leads to an error of about 2 m in the position determination. Rounding and calculation errors of the receiver sum up approximately to 1 m.

4.2.7 Relativistic effects

The following section shall not provide a comprehensive explanation of the theory of relativity. In the normal life we are quite unaware of the omnipresence of the theory of relativity. However it has an influence on many processes, among them is the proper functioning of the GPS system. This influence will be explained shortly in the following.The fast movement of the satellites themselves (nearly 12000 km/h) must be considered.Whoever already dealt with the theory of relativity knows that time runs slower during very fast movements. For satellites moving with a speed of 3874 m/s, clocks run slower when viewed from earth. This relativistic time dilation leads to an inaccuracy of time of approximately 7,2 microseconds per day (1 microsecond = 10-6 seconds).

The theory of relativity also says that time moves the slower the stronger the field of gravitation is. For an observer on the earth surface the clock on board of a satellite is running faster (as the satellite in 20000 km height is exposed to a much weaker field of gravitation than the observer). And this second effect is six times stronger than the time dilation explained above.

Altogether, the clocks of the satellites seem to run a little faster. The shift of time to the observer on earth would be about 38 milliseconds per day and would make up for an total error of approximately 10 km per day. In order that those error do not have to be corrected constantly, the clocks of the satellites were set to 10.229999995453 Mhz instead of 10.23 Mhz but they are operated as if they had 10.23 MHz. By this trick the relativistic effects are compensated once and for all.

There is another relativistic effect, which is not considered for normal position determinations by GPS. It is called Sagnac-Effect and is caused by the movement of the

36 observer on the earth surface, who also moves with a velocity of up to 500 m/s (at the equator) due to the rotation of the globe. The influence of this effect is very small and complicate to calculate as it depends on the directions of the movement. Therefore it is only considered in special cases.

The errors of the GPS system are summarized in the following table.

Ionospheric effects ± 5 meters

Shifts in the satellite orbits ± 2.5 meter

Clock errors of the satellites' clocks ± 2 meter

Multipath effect ± 1 meter

Tropospheric effects ± 0.5 meter

Calculation- und rounding errors ± 1 meter

Altogether this sums up to an error of ± 15 meters. With the SA still activated, the error was in the range of ± 100 Meter. Corrections by systems like WAAS and EGNOS, which mainly reduce ionospheric effects, but also improve orbits and clock errors, the overall error is reduced to approximately ± 3 - 5 meters

4.3FALCON Global Positioning System Trainer Kit

Features

 Simultaneously track up to 12 satellites  Receiver and satellite status indicator  Land navigation  Navigation updates every second  One pps output for timing measurement  LED indication with beeper for receiver section  Software interface with signal strength indication and survey window

37

 Mains supply and battery operated

4.3.1 Specifications of Trainer kit

GPS Receiver board  Frequency : 1.575 GHz

 Channels : 12

 On board clock and system processor

 Receiver sensitivity : -165dBW minimum

 Update rate : 1 second

 Acquisition time : 15 seconds warm

Position accuracy  Non-differential GPS : 15 meters RMS (100 meters with selective availability on)  Velocity accuracy : 0.2 m/s RMS steady state  One-pulse-per-second : ± 1 microsecond at rising edge accuracy of PPS pulse Electrical Characteristics  Input voltage : +3.6Vdc ~ 6.0Vdc regulated 150 m Vpp ripple  Input current : 120 mA typical,140mA maximum 20 mA while in power down Software interface  Dual channel CMOS / TTL level with user selectable baud rate (300, 600, 1200, 2400, 4800), NMEA0183 Version2.0

ASCII output  (GPALM, GPGGA, GPGSA, GPGSV, GPRMC, GPVTG, PGRME, PGRMT, PGRMV, PGRMF, LCGLL, LCVTG)

Inputs  Initial position, date and time (not required) - Earth datum and differential mode- configuration command, almanac

Outputs : Position, velocity and time

-Receiver and satellite status

38

-Geometry and error estimates

 Binary TTL output data format, Binary format phase data  LED and beeper indication for self-check cycle

 LED indication for active RS-232 interface

GPS Antenna  MCX style connector

 Typical attenuation : 30dB/100meter@1GHz (RG-174 cable)

 Operating frequency : L1 1575.42 ± 1.023 MHZ (typical)

 Input impedance : 50 Ohm

 VSWR : 1.5(typical )

 Polarization : Right hand circular

 Azimuth coverage : 360 degree

 Elevation coverage : 0 degree to 90 degree

 Gain characteristics of : Gain: 3.0 dBi (typical) - 10 dBi antenna element minimum at 0 Degree elevation

 Axial ratio : 3 dB (typical)

 Filtering : -40 dB (1670MHz) (typical) -40 dB (1480MHz) (typical)

 Total gain : 24 dBi (typical) w/6m. cable

 Noise Figure : 1.0 dBi (typical), 1.5 dB (maximum)

 Power requirements : 5 ± Vdc

 Power consumption : 20 mA (typical)

 Mounting method : Magnet

 4 Switch faults 2 mm banana socket interconnection, (GND, +12V) / Battery.

39

Fig. 4.6diagram of Falcon GPS Trainer kit

Fig. 4.7Study of satellite azimuth and elevation window using sky plot

40

Fig.4.8Study of received NEMA sentences using trace window

Fig. 4.9Satellite signal strength indication using SNR plot

41

4.4 Free computer compatible software MINI GPS

This software is developed by MediaTek Inc. we are using Mini GPS version 1.4.

Overview

MiniGPS is a tool which helps people to view the status of gps receiver more conveniently.MiniGPS is also an interface between people and gps receivers and could change the setting of gps receivers. For example, know the version of firmware,enable SBAS correction, change NMEA sentences, baud rate, fix update rate and so on.

Fig. 4.10 Status window of GPS receiver (directly connected via communication port)

42

Chapter 5

NMEA SENTENCES FROM GPS RECEIVER

NMEA0183

5.1 Introduction

NMEA 0183 is a combined electrical and data specification for communication between marine electronic devices such as echo sounder, sonars, anemometer, gyrocompass, autopilot, GPS receivers and many other types of instruments. It has been defined by, and is controlled by, the U.S.-based National Marine Electronics Association. It replaces the earlier NMEA 0180 and NMEA 0182 standards. The NMEA 0183 standard uses a simple ASCII, serial communications protocol that defines how data is transmitted in a "sentence" from one "talker" to multiple "listeners" at a time. At the application layer, the standard also defines the contents of each sentence (message) type so that all listeners can parse messages accurately.

Application layer protocol rules

 Each message's starting character is a dollar ($) sign.  The next five characters identify the talker (two characters) and the type of message (three characters).  All data fields that follow are comma-delimited.  Where data is unavailable, the corresponding field contains NUL bytes (e.g., in "123,,456", The double comma between 3 and 4 is telling the listener the second field's data is unavailable).[clarification needed]  The first character that immediately follows the last data field character is an asterisk, but it is only included if a checksum is supplied.  The asterisk is immediately followed by a two-digit checksum representing a hexadecimal number. The checksum is the exclusive OR of all characters between the $ and *. According to the official specification, the checksum is optional for most data sentences, but is compulsory for RMA, RMB, and RMC (among others).  ends the message

43

5.2 Sentence transmission

Sentences are transmitted with respect to the user selected baud rate. The GPS sensor will transmit each sentence at a periodic rate based on the user selected baud rate and user selected output sentences. The GPS sensor will transmit the selected sentences contiguously. The length of the transmission can be determined by the following equation

Total characters to be transmitted length of transmission = ------Characters transmitted per second

NMEA message prefix Maximum characters $GPGGA 81 Table: 5.1 NMEA 0183 Output $GPGLL 41 Sentence Order and Size $GPGSA 66

$GPGSV 210 $GPRMC 72

$GPVTG 40

$PGRME 35

$PGRMT 50 $PGRMV 32

Table: 5.1 NMEA 0183 Output Sentence Order and Size

44

TABLE 5.2 Characters per Second for Available Baud Rates

Baud rate Characters per second 4800 480 9600 960 19200 1920 38400 3840

5.3 NMEA DATA

5.3.1 Introduction

The National Marine Electronics Association (NMEA) has developed a specification that defines the interface between various pieces of marine electronic equipment. The standard permits marine electronics to send information to computers and to other marine equipment. A full copy of this standard is available for purchase at their web site. None of the information on this site comes from this standard and I do not have a copy. Anyone attempting to design anything to this standard should obtain an official copy.

GPS receiver communication is defined within this specification. Most computer programs that provide real time position information understand and expect data to be in NMEA format. This data includes the complete PVT (position, velocity, time) solution computed by the GPS receiver. The idea of NMEA is to send a line of data called a sentence that is totally self contained and independent from other sentences. There are standard sentences for each device category and there is also the ability to define proprietary sentences for use by the individual company. All of the standard sentences have a two letter prefix that defines the device that uses that sentence type. (For gps receivers the prefix is GP.) which is followed by a three letter sequence that defines the sentence contents. In addition NMEA permits hardware manufactures to define their own proprietary sentences for whatever purpose they see fit. All proprietary sentences begin with the letter P and are followed with 3 letters that identifies the manufacturer controlling that sentence. For example a Garmin sentence would start with PGRM and Magellan would begin with PMGN.

45

Each sentence begins with a '$' and ends with a carriage return/line feed sequence and can be no longer than 80 characters of visible text (plus the line terminators). The data is contained within this single line with data items separated by commas. The data itself is just ascii text and may extend over multiple sentences in certain specialized instances but is normally fully contained in one variable length sentence. The data may vary in the amount of precision contained in the message. For example time might be indicated to decimal parts of a second or location may be show with 3 or even 4 digits after the decimal point. Programs that read the data should only use the commas to determine the field boundaries and not depend on column positions. There is a provision for a checksum at the end of each sentence which may or may not be checked by the unit that reads the data. The checksum field consists of a '*' and two hex digits representing an 8 bit exclusive OR of all characters between, but not including, the '$' and '*'. A checksum is required on some sentences.

5.4 NMEA sentences

NMEA consists of sentences, the first word of which, called a data type, defines the interpretation of the rest of the sentence. Each Data type would have its own unique interpretation and is defined in the NMEA standard. In the NMEA standard there are no commands to indicate that the gps should do something different. Instead each receiver just sends all of the data and expects much of it to be ignored. Some receivers have commands inside the unit that can select a subset of all the sentences or, in some cases, even the individual sentences to send. There is no way to indicate anything back to the unit as to whether the sentence is being read correctly or to request a re-send of some data you didn't get. Instead the receiving unit just checks the checksum and ignores the data if the checksum is bad figuring the data will be sent again sometime later.

Certain NMEA sentences used in GPS are :

Global positioning system fix data(GGA)

$GPGGA,1,2,3,4,5,6,7,8,9,10,11,12*hh

46

1. UTC time of position fix 2. Latitude,ddmm.mmmm format 3. Latitude hemisphere N or S 4. Longitude, dddmm.mmmm format 5. Longitude hemisphere E or W 6. GPS quality indication 0=fix not available, 1=nondiffrential GPS fix available 2=Diffrential GPS 7. Numer of satellites in use 8. Horizontal dilution of precision 9. Antenna height above sea level 10. Geoidal height 11. DGPS data age 12. Differential reference station

DPS dilution of precision and Active satellites(GSA)

$GPGSA,1,2,3,3,3,3,3,3,3,3,3,3,3,4,5,6*hh

1. Mode M=manual ,A =automatic 2. Fix type 1= not available 2= 2D 3= 3D 3. PRN number of satellites 4. Position dilution of precision 5. Horizontal dilution of precision 6. Vertical dilution of precision

GPS satellites in view (GSV)

$GPGSV, 1,2,3,4,5,6,7*hh

1. Total number of GSV sentences 2. Number of current GSV sentences 3. Total number of satellites in view 4. Satellites PRN number 5. Satellite elevation 6. Satellite azimuth

47

7. Signal to noise ratio

Note: Items, 4,5 ,6 and 7 repeat for each satellite in view to a maximum of 4 satellite

Recommended Minimum specific GPS/TRANSIT data (RMC)

$GPRMC,1,2,3,4,5,6,7,8,9,10,11*hh

1. UTC time of position 2. Status A= valid position V= NAV receiver warning 3. Latitude,ddmm.mmmm format 4. Latitude hemisphere N or S 5. Longitude, dddmm.mmmm format 6. Longitude hemisphere E or W 7. Speed over ground ,0 to 999.99 knots 8. Course over ground , 0 to 359.9 degrees 9. UTC date of fix position 10. Magnetic variation 0 to 180 degrees 11. Magnetic variation direction E or W

Trade made good and ground speed withGPS talker ID (VTG)

$GPVTG, 1, T, 2, M, 3, N, 4, K*hh

1. True course over ground 0 to 359 degrees 2. Magnetic course over ground 0 to 359 degrees 3. Speed over ground 0 to 999.9 knots 4. Speed over ground 0 to 1851.8 kilometres per hour

Almanac information(ALM)

$GPALM,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15*hh

1. Total number of ALM sentences to be transmitted by sensor 2. Numer of current almanac sentence 3. Satellite PRN number

48

4. GPS week number 5. GPS health bits 17-24 6. Eccentricity 7. Almanac reference time 8. Inclination angle 9. Rate of right ascension 10. Root of semi major axis 11. Omega, argument of perigee 12. Longitude of ascension node 13. Mean anomaly 14. Afo clock parameter 15. Af1 clock parameter

Geographic Position ( GPGLL)

$GPGLL,1,2,3,4,5*hh

1. Latitude,ddmm.mmmm format 2. Latitude hemisphere N or S 3. Longitude, dddmm.mmmm format 4. Longitude hemisphere E or W 5. UTC time of position

Estimated Error information (PGRME)

$PGRME,1,2,3*hh

1. Estimated horizontal position error(HPE)0 to 999.9 meters 2. Estimated vertical position error(VPE)0 to 999.9 meters 3. Estimated position error(EPE) 0 to 999.9 meters

GPS fix data sentence (PGRMF)

$PGRMF,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15*hh

49

1. GPS week number 2. GPS seconds 3. UTC date of position 4. UTC time of position 5. GPS leap second count 6. Latitude,ddmm.mmmm format 7. Latitude hemisphere N or S 8. Longitude, dddmm.mmmm format 9. Longitude hemisphere E or W 10. Mode M= manual A=automatic 11. Fix type 0=no fix 1=2D fix 2= 3Dfix 12. Speed over ground 0 to 1851 13. Course over ground 0 to 359 degrees 14. Position dilution of precision 15. Time dilution of precision

3D velocity information(PGRMV)

$PGRMV,1,2,3*hh

1. True east velocity -514.4 to 514.4 meters/sec 2. True noth velocity -514.4 to 514.4 meters/sec 3. Up velocity -999.9 to 9999.9 meters/sec

50

CHAPTER 6

6.1

In telecommunication and computer science, serial communication is the process of sending data one bit at a time, sequentially, over a communication channel or computer . This is in contrast to , where several bits are sent as a whole, on a link with several parallel channels.

Serial communication is used for all long-haul communication and most computer networks, where the cost of cable and synchronization difficulties make parallel communication impractical. Serial computer buses are becoming more common even at shorter distances, as improved signal integrity and transmission speeds in newer serial technologies have begun to outweigh the parallel bus's advantage of simplicity (no need for serializer and deserializer, or SerDes) and to outstrip its disadvantages (clock skew, interconnect density). The migration from PCI to PCI Express is an example.

Serial versus parallel

The communication links across which computers—or parts of computers—talk to one another may be either serial or parallel. A parallel link transmits several streams of data simultaneously along multiple channels (e.g., wires, printed circuit tracks, or optical fibres); a serial link transmits a single stream of data.

Although a serial link may seem inferior to a parallel one, since it can transmit less data per clock cycle, it is often the case that serial links can be clocked considerably faster than parallel links in order to achieve a higher data rate. A number of factors allow serial to be clocked at a higher rate:

 Clock skew between different channels is not an issue (for unclocked asynchronous serial communication links).  A serial connection requires fewer interconnecting cables (e.g., wires/fibres) and hence occupies less space. The extra space allows for better isolation of the channel from its surroundings.  Crosstalk is less of an issue, because there are fewer conductors in proximity.

In many cases, serial is a better option because it is cheaper to implement. Many ICs have serial interfaces, as opposed to parallel ones, so that they have fewer pins and are therefore less expensive. Examples of serial communication architectures

 Morse code telegraphy  RS-232 (low-speed, implemented by serial ports)  RS-422  RS-423

51

 RS-485  I²C  SPI  ARINC 818 Digital Video Bus  Atari SIO (Joe Decuir credits his work on Atari SIO as the basis of USB)  Universal Serial Bus (moderate-speed, for connecting peripherals to computers)  FireWire  (high-speed, for connecting computers to mass storage devices)  InfiniBand (very high speed, broadly comparable in scope to PCI)  MIDI control of electronic musical instruments  DMX512 control of theatrical lighting  SDI-12 industrial sensor protocol  CoaXPress industrial camera protocol over Coax  Serial Attached SCSI  Serial ATA  SpaceWire Spacecraft communication network  HyperTransport  PCI Express  SONET and SDH (high speed telecommunication over optical fibers)  T-1, E-1 and variants (high speed telecommunication over copper pairs)  MIL-STD-1553A/B

RS-232

A DB-25 connector as described in the RS-232 standard

In telecommunications, RS-232 is the traditional name for a series of standards for serial binary single-ended data and control signals connecting between DTE (data terminal equipment) and DCE (data circuit-terminating equipment, originally defined as data communication equipment). It is commonly used in computer serial ports. The standard defines the electrical characteristics and timing of signals, the meaning of signals, and the physical size and pinout of connectors. The current version of the standard is TIA-232-F Interface Between Data Terminal Equipment and Data Circuit-Terminating Equipment Employing Serial Binary Data Interchange, issued in 1997.

An RS-232 serial port was once a standard feature of a personal computer, used for connections to modems, printers, mice, data storage, uninterruptible power supplies, and other peripheral devices. However, the low transmission speed, large voltage swing, and large standard connectors motivated development of the Universal Serial Bus, which has displaced RS-232 from most of its peripheral interface roles. Many modern personal computers have no RS-232 ports and must use either an external USB-to-RS-232 converter or an internal with one or more serial ports to connect to RS-232 peripherals. RS-232 devices are still found, especially in industrial machines, networking equipment, and scientific instruments.

52

MAX232

The MAX232 is an IC, first created by Maxim Integrated Products, that converts signals from an RS-232 serial port to signals suitable for use in TTL compatible digital logic circuits. The MAX232 is a dual driver/receiver and typically converts the RX, TX, CTS and RTS signals.

The drivers provide RS-232 voltage level outputs (approx. ± 7.5 V) from a single + 5 V supply via on-chip charge pumps and external capacitors. This makes it useful for implementing RS-232 in devices that otherwise do not need any voltages outside the 0 V to + 5 V range, as power supply design does not need to be made more complicated just for driving the RS-232 in this case.

The receivers reduce RS-232 inputs (which may be as high as ± 25 V), to standard 5 V TTL levels. These receivers have a typical threshold of 1.3 V, and a typical hysteresis of 0.5 V.

The later MAX232A is backwards compatible with the original MAX232 but may operate at higher baud rates and can use smaller external capacitors – 0.1 μF in place of the 1.0 μF capacitors used with the original device.

The newer MAX3232 is also backwards compatible, but operates at a broader voltage range, from 3 to 5.5 V.

53

Fig: Pin diagram

Voltage levels

It is helpful to understand what occurs to the voltage levels. When a MAX232 IC receives a TTL level to convert, it changes a TTL logic 0 to between +3 and +15 V, and changes TTL logic 1 to between -3 to -15 V, and vice versa for converting from RS232 to TTL. This can be confusing when you realize that the RS232 data transmission voltages at a certain logic state are opposite from the RS232 control line voltages at the same logic state. To clarify the matter, see the table below. For more information, see RS-232 voltage levels.

RS232 line type and logic level RS232 voltage TTL voltage to/from MAX232 Data transmission (Rx/Tx) logic 0 +3 V to +15 V 0 V Data transmission (Rx/Tx) logic 1 -3 V to -15 V 5 V Control signals (RTS/CTS/DTR/DSR) logic 0 -3 V to -15 V 5 V Control signals kjnic 1 +3 V to +15 V 0 V

Fig: interface MAX-232 with RS-232

54

Different GPS Module(Market Survey of Module)

COMPANY PROGIN GARMIN ORIGIN LOCOSYS NAME MR-87 GPS18X 447X LS20033 CHIPSET MTK MTK3318 MT3301+MT3179 PROTOCOL NMEA 0183 NMEA 0183 NMEA 0183 NMEA 0183 V3.01 V2.0 V3.01 CODE C/A code C/A code C/A code C/A code DGPS WAAS,SBAS WAAS WAAS,SBAS WAAS,SBAS CHANNELS 32 32 ACQUISITION -146dBm -156dBm SENSITIVITY TRACKING -158dBm -163dBm SENSITIVITY FLASH 4Mbits COLD START 36sec 45sec 35sec 36sec WARM START 33sec 38sec 32sec 32sec HOT START 1sec 1sec 1sec 2sec REACQUISITION 1sec 2sec 1sec POSITION 3m 3m 2.5m ACCURACY VELOCITY 0.1 m/s 0.1 m/s 0.01m/s ACCURACY TIME 1ms 1µs 1µs ACCURACY MAX. 18,000 m 18,288 m 18,000 m ALTITUDE MAX. 515 m/s 515 m/s 515 m/s VELOCITY MAX. 4G 4g 4G ACCELERATION UPDATE RATE 5Hz 5Hz 5Hz 5Hz POWER SUPPLY 5Vdc 5Vdc 3.6Vdc 3.3Vdc BACKUP 1.2Vdc 2.2Vdc 1.1Vdc VOLTAGE OPERATING -30 to 85°C -30 to 80°C -45 to 85°C -20 to 65°C TEMPERATURE STORAGE -40 to 125°C -40 to 90°C -55 to 125°C -30 to 75°C TEMPERATURE ANTENNA GAIN

DIMENSION 25.4 x 25.4 x 7 61 x 19.5mm 1.4 x 7 x 7mm mm WEIGHT 165g 0.3g PRICE

55

CHAPTER 7

PIC MICROCONTROLLER

7.1 Microcontrollers

Microprocessors

A microprocessor incorporates the functions of a computer's central processing unit (CPU) on a single integrated circuit (IC) or at most a few integrated circuits. It is a multipurpose, programmable device that accepts digital data as input, processes it according to instructions stored in its memory, and provides results as output. It is an example of sequential digital logic, as it has internal memory. Microprocessors operate on numbers and symbols represented in the binary numeral system. The advent of low-cost computers on integrated circuits has transformed modern society. General-purpose microprocessors in personal computers are used for computation, text editing, multimedia display, and communication over the Internet. Many more microprocessors are part of embedded systems, providing digital control of a myriad of objects from appliances to automobiles to cellular phones and industrial process control.

Microcontrollers

A microcontroller (sometimes abbreviated µC, uC or MCU) is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals. Program memory in the form of NOR flash or OTP ROM is also often included on chip, 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.

Microcontrollers are used in automatically controlled products and devices, such as automobile engine control systems, implantable medical devices, remote controls, office machines, appliances, power tools, toys and other embedded systems. By reducing the size and cost compared to a design that uses a separate microprocessor, memory, and input/output devices, microcontrollers make it economical to digitally control even more devices and processes. Mixed signal microcontrollers are common, integrating analog components needed to control non-digital electronic systems.

Some microcontrollers may use four-bit words and operate at clock rate frequencies as low as 4 kHz, for low power consumption (single-digit milliwatts or microwatts). They will generally have the ability to retain functionality while waiting for an event such as a button press or other interrupt; power consumption while sleeping (CPU clock and most peripherals off) may be just nanowatts, making many of them well suited for long lasting battery applications. Other microcontrollers may serve performance-critical

56 roles, where they may need to act more like a digital signal processor (DSP), with higher clock speeds and power consumption.

7.2 Types Of Microcontrollers Microcontrollers can be classified on the basis of internal bus width, architecture, memory and instruction set. CICS & RISC CISC (Complex Instruction Set Computer) Architecture Microcontrollers Almost all of today’s microcontrollers are based on the CISC (Complex Instruction Set Computer) concept. When an microcontroller has an instruction set that supports many addressing modes for the arithmetic and logical instructions, data transfer and memory accesses instructions, the microcontroller is said to be of CISC architecture. The typical CISC microcontroller has well over 80 instructions, many of them very powerful and very specialized for specific control tasks. It is quite common for the instructions to all behave quite differently. Some might only operate on certain address spaces or registers, and others might only recognize certain addressing modes. The advantages of the CISC architecture are that many of the instructions are macrolike, allowing the programmer to use one instruction in place of many simpler instructions. An example of CISC architecture microcontroller is Intel 8096 family. RISC (Reduced Instruction Set Computer) Architecture Microcontrollers The industry trend for microprocessor design is for Reduced Instruction Set Computers (RISC) designs. When a microcontroller has an instruction set that supports fewer addressing modes for the arithmetic and logical instructions and for data transfer instructions, the microcontroller is said to be of RISC architecture. The benefits of RISC design simplicity are a smaller chip, smaller pin count, and very low power consumption. Some of the typical features of a RISC processor- Harvard architecture are:  Allows simultaneous access of program and data.  Overlapping of some operations for increased processing performance.  Instruction pipelining increases execution speed.  Orthogonal (symmetrical) instruction set for programming simplicity.  Allows each instruction to operate on any register or use any addressing mode. VON-NEUMAN Architecture & Harvard Architecture There are mainly two categories of processors, namely, Von-Neuman (or Princeton) architecture and Harvard Architecture. These two architecture differ in the way data and programs are stored and accessed. VON-NEUMAN Architecture Microcontrollers based on the Von-Neuman architecture have a single “data” bus that is used to fetch both instructions and data. Program instructions and data are stored in a common main memory. When such a controller addresses main memory, it first fetches an instruction, and then it fetches the data to support the instruction. The two separate fetches slows up the controller’s operation. The Von-Neuman architecture’s main advantage is that it simplifies the microcontroller design because only one memory is accessed. In microcontrollers, the contents of RAM can be used for data storage and program instruction storage. For example, the Motorola 68HC11 microcontroller Von-Neuman architecture. Example: An Instruction “Read a byte from memory and stores it in the accumulator” as follows: 57

Cycle 1:- Read instruction Cycle 2:- Read data out of RAM and put into Accumulator Harvard Architecture Microcontrollers based on the Harvard Architecture have separate data bus and an instruction bus. This allows execution to occur in parallel. As an instruction is being “pre-fetched”, the current instruction is executing on the data bus. Once the current instruction is complete, the next instruction is ready to go. This pre-fetch theoretically allows for much faster execution than Von-Neuman architecture, on the expense of complexity. The Harvard Architecture executes instructions in fewer instruction cycles than the Von-Neuman architecture. For example, theintel MCS-51 family of microcontrollers and PIC microcontrollers uses Harvard Architecture. The same instruction (as shown under Von-Newman architecture) would be executed as follows: Cycle 1: - Complete previous instruction - Read the “Move Data to Accumulator” instruction

Cycle 2: - Execute “Move Data to Accumulator” instruction - Read next instruction Hence each instruction is effectively executed in one instruction cycle.

Microchip PIC PIC is a family of modified Harvard architecture microcontrollers made by Microchip Technology, derived from the PIC1650 originally developed by General Instrument's Microelectronics Division. The name PIC initially referred to "Peripheral Interface Controller". PIC and PICmicro are registered trademarks of Microchip Technology. It is generally thought that PIC stands for Peripheral Interface Controller, although General Instruments' original acronym for the initial PIC1640 and PIC1650 devices was "Programmable Interface Controller". The acronym was quickly replaced with "Programmable Intelligent Computer". Features of PIC  Code efficiency - The PIC 8 bit microcontroller is based on Harvard architecture, which means there are separate internal buses for memory and data. The throughput rate is therefore increased due to simultaneous access to both data and program memory. It would be easier if you have known about von Neumann architecture which has common bus for memory and data.  Safety - All the instructions fit into a 12 or 14 bit program memory word. There is no likelihood of software jumping onto the DATA section of a program and trying to execute DATA as instructions.  Instruction set - There are 33 instructions you have to learn in order to write software for the 16C5x family. The lesser number of instructions eases our job while writing program in assembly language.  Speed - The PIC has an internal divide by 4 connected between the oscillator and the internal clock bus(note : we know there is a divide by 2 in a 8085 microprocessor where we connect a 6Mhz clock in order to operate the

58

microprocessor at a speed of 3Mhz). The PIC is very fast to work with. The speed of PIC16F877A is 20 MHz but it can even operate at a speed of 30Mhz. some PIC in 18Fx family can be operated at 40 MHz.  Static Operation - The PIC is a fully static microcontroller, in other words, if you stop the clock, all the register contents are maintained. In practice you would not actually do this, you would place the PIC into a Sleep mode-this stops the lock and sets up various flags within the PIC to allow you to know what state it was in before the Sleep. In sleep, the PIC takes only its standby current which can be less than 1uA. The need for sleep mode can be easily understood by considering the Fire alarm circuit, since the circuit has to be activated only when there is a fire, the rest of the time the PIC can be made to be in its sleep mode and wake up when there is fire thus saving the power required for the operation of PIC.  Drive Capability - The PIC has a high output drive capability and can directly drive LEDs and TRIACs etc. Any I/O pin can sink 25mA or 100mA for the whole device.  Options - A range of speed, temperature, package, I/O lines, timer functions, serial communication, A/D and memory sizes is available from the PIC family to suit virtually all your requirements. Limitations of PIC → Peripheral Interface Controller has only one accumulator. → Small instruction set. → Register banking switch required to access RAM of other devices. → Operations and registers are not orthogonal. → Program memory is not accessible.

59

PIC18F8722

64/80-PIN, 1-MBIT, ENHANCED FLASH MICROCONTROLLERS WITH 10-BIT A/D AND NANOWATT TECHNOLOGY

SPECIAL FEATURES OF PIC18F8722

60

Pin Diagram

61

INPUT/OUTPUT PORTS

Depending on the device selected and features enabled, there are up to five ports available. Some pins of the I/O ports are multiplexed with an alternate function from the peripheral features on the device. In general, when a peripheral is enabled, that pin may not be used as a general purpose I/O pin. Each port has three registers for its operation. These registers are:

 TRIS register (data direction register)  PORT register (reads the levels on the pins of the device)  LAT register (output latch)

The Data Latch register (LATA) is useful for read modify- write operations on the value driven by the I/O pins.

PORTA, TRISA and LATA Registers

PORTA is an 8-bit wide, bidirectional port. The corresponding Data Direction register is TRISA. Setting a TRISA bit (= 1) will make the corresponding PORTA pin an input (i.e., put the corresponding output driver in a high-impedance mode). Clearing a TRISA bit (= 0) will make the corresponding PORTA pin an output (i.e., put the contents of the output latch on the selected pin). Reading the PORTA register reads the status of the pins; writing to it will write to the port latch. The Data Latch register (LATA) is also memory mapped. Read-modify-write operations on the LATA register read and write the latched output value for PORTA.

Several PORTA pins are multiplexed with analog inputs, the analog VREF+ and VREF- inputs and the comparator voltage reference output. The operation of pins RA5 and RA3:RA0 as A/D converter inputs is selected by clearing/setting the control bits in the ADCON1 register (A/D Control Register 1).

Note: On a Power-on Reset, RA5 and RA3:RA0 are configured as analog inputs and read as ‘0’. RA4 is configured as a digital input.

The TRISA register controls the direction of the RA pins, even when they are being used as analog inputs. The user must ensure the bits in the TRISA register are maintained set when using them as analog inputs.

PORTB, TRISB and LATB Registers

PORTB is an 8-bit wide, bidirectional port. The corresponding Data Direction register is TRISB. Setting a TRISB bit (= 1) will make the corresponding PORTB pin an input (i.e., put the corresponding output driver in a high-impedance mode). Clearing a TRISB bit (= 0) will make the corresponding PORTB pin an output (i.e., put the contents of the output latch on the selected pin). The Data Latch register (LATB) is also memory mapped. Read-modify-write operations on the LATB register read and write the latched output value for PORTB.

62

Note: On a Power-on Reset, RB4:RB0 are configured as analog inputs by default and read as ‘0’; RB7:RB5 are configured as digital inputs. By programming the Configuration bit, PBADEN (CONFIG3H<1>), RB4:RB0 will alternatively be configured as digital inputs on POR.

Four of the PORTB pins (RB7:RB4) have an interrupt on- change feature. Only pins configured as inputs can cause this interrupt to occur. Any RB7:RB4 pin configured as an output is excluded from the interrupt on- change comparison. The pins are compared with the old value latched on the last read of PORTB. The “mismatch” outputs of RB7:RB4 are ORed together to generate the RB Port Change Interrupt with Flag bit, RBIF (INTCON<0>).

PORTC, TRISC and LATC Registers

PORTC is a 7-bit wide, bidirectional port. The corresponding Data Direction register is TRISC. Setting a TRISC bit (= 1) will make the corresponding PORTC pin an input (i.e., put the corresponding output driver in a high-impedance mode). Clearing a TRISC bit (= 0) will make the corresponding PORTC pin an output (i.e., put the contents of the output latch on the selected pin). The RC3 pin is not implemented in these devices. The Data Latch register (LATC) is also memory mapped. Read-modify-write operations on the LATC register read and write the latched output value for PORTC.

Pins RC4 and RC5 are multiplexed with the USB module. Depending on the configuration of the module, they can serve as the differential data lines for the on chip USB transceiver, or the data inputs from an external USB transceiver. Both RC4 and RC5 have TTL input buffers instead of the Schmitt Trigger buffers on the other pins. Unlike other PORTC pins, RC4 and RC5 do not have TRISC bits associated with them. As digital ports, they can only function as digital inputs. When configured for USB operation, the data direction is determined by the configuration and status of the USB module at a given time. If an external transceiver is used, RC4 and RC5 always function as inputs from the transceiver. If the on-chip transceiver is used, the data direction is determined by the operation being performed by the module at that time.

Note: On a Power-on Reset, these pins, except RC4 and RC5, are configured as digital inputs. To use pins RC4 and RC5 as digital inputs, the USB module must be disabled (UCON<3> = 0) and the on-chip USB transceiver must be disabled (UCFG<3> = 1).

PORTD, TRISD and LATD Registers

Note: PORTD is only available on 40/44-pin devices.

PORTD is an 8-bit wide, bidirectional port. The corresponding Data Direction register is TRISD. Setting a TRISD bit (= 1) will make the corresponding PORTD pin an input (i.e., put the corresponding output driver in a high-impedance mode). Clearing a TRISD bit (= 0) will make the corresponding PORTD pin an output (i.e., put the contents of the output latch on the selected pin). The Data Latch register (LATD) is also memory mapped. Read-modify-write operations on the LATD register read and write the latched output value for PORTD.

63

PORTE, TRISE and LATE Registers

Depending on the particular PIC18F2455/2550/4455/4550 device selected, PORTE is implemented in two different ways. For 40/44-pin devices, PORTE is a 4-bit wide port. Three pins (RE0/AN5/CK1SPP, RE1/AN6/CK2SPP and RE2/AN7/OESPP) are individually configurable as inputs or outputs. These pins have Schmitt Trigger input buffers. When selected as an analog input, these pins will read as ‘0’s. The corresponding Data Direction register is TRISE. Setting a TRISE bit (= 1) will make the corresponding PORTE pin an input (i.e., put the corresponding output driver in a high- impedance mode). Clearing a TRISE bit (= 0) will make the corresponding PORTE pin an output (i.e., put the contents of the output latch on the selected pin). In addition to port data, the PORTE register (Register 10-1) also contains the RDPU control bit (PORTE<7>); this enables or disables the weak pull-ups on PORTD.

The fourth pin of PORTE (MCLR/VPP/RE3) is an input only pin. Its operation is controlled by the MCLRE Configuration bit. When selected as a port pin (MCLRE = 0), it functions as a digital input only pin; as such, it does not have TRIS or LAT bits associated with its operation. Otherwise, it functions as the device’s Master Clear input. In either configuration, RE3 also functions as the programming voltage input during programming.

For 28-pin devices, PORTE is only available when Master Clear functionality is disabled (MCLRE = 0). In these cases, PORTE is a single bit, input only port comprised of RE3 only. The pin operates as previously described.

64

ENHANCED UNIVERSAL SYNCHRONOUS RECEIVER TRANSMITTER (EUSART)

The Enhanced Universal Synchronous Asynchronous Receiver Transmitter (EUSART) module is one of two serial I/O modules. (Generically, the USART is also known as a Serial Communications Interface or SCI.)The EUSART can be configured as a full-duplex asynchronous system that can communicate with peripheral devices, such as CRT terminals and personal computers. It can also be configured as a half duplex synchronous system that can communicate with peripheral devices, such as A/D or D/A integrated circuits, serial EEPROMs, etc. The Enhanced USART module implements additional features, including automatic baud rate detection and calibration, automatic wake-up on Sync Break reception and 12-bit Break Character transmit. These make it ideally suited for use in Local Interconnect Network bus (LIN bus) systems.

The EUSART can be configured in the following modes: • Asynchronous (full duplex) with: - Auto-Wake-up on Character Reception - Auto-Baud Calibration - 12-bit Break Character Transmission • Synchronous – Master (half duplex) with Selectable Clock Polarity • Synchronous – Slave (half duplex) with Selectable Clock Polarity The pins of EUSART1 and EUSART2 are multiplexed with the functions of PORTC (RC6/TX1/CK1 and RC7/RX1/DT1) and PORTG (RG1/TX2/CK2 and RG2/RX2/DT2), respectively. In order to configure these pins as an EUSART: • For EUSART1: - bit SPEN (RCSTA1<7>) must be set (= 1) - bit TRISC<7> must be set (= 1) - bit TRISC<6> must be cleared (= 0) for Asynchronous and Synchronous Master modes - bit TRISC<6> must be set (= 1) for Synchronous Slave mode • For EUSART2: - bit SPEN (RCSTA2<7>) must be set (= 1) - bit TRISG<2> must be set (= 1) - bit TRISG<1> must be cleared (= 0) for Asynchronous and Synchronous Master modes - bit TRISC<6> must be set (= 1) for Synchronous Slave mode The operation of each Enhanced USART module is controlled through three registers: • Transmit Status and Control (TXSTAx) • Receive Status and Control (RCSTAx) • Baud Rate Control (BAUDCONx)

bit 7 CSRC: Clock Source Select bit

65

Asynchronous mode: Don’t care. Synchronous mode: 1 = Master mode (clock generated internally from BRG) 0 = Slave mode (clock from external source)

bit 6 TX9: 9-bit Transmit Enable bit 1 = Selects 9-bit transmission 0 = Selects 8-bit transmission

bit 5 TXEN: Transmit Enable bit 1 = Transmit enabled 0 = Transmit disabled Note: SREN/CREN overrides TXEN in Sync mode.

bit 4 SYNC: EUSART Mode Select bit 1 = Synchronous mode 0 = Asynchronous mode

bit 3 SENDB: Send Break Character bit Asynchronous mode: 1 = Send Sync Break on next transmission (cleared by hardware upon completion) 0 = Sync Break transmission completed Synchronous mode: Don’t care.

bit 2 BRGH: High Baud Rate Select bit Asynchronous mode: 1 = High speed 0 = Low speed Synchronous mode: Unused in this mode.

bit 1 TRMT: Transmit Shift Register Status bit 1 = TSRx empty 0 = TSRx full

bit 0 TX9D: 9th bit of Transmit Data Can be address/data bit or a parity bit.

66

bit 7 SPEN: Serial Port Enable bit 1 = Serial port enabled (configures RXx/DTx and TXx/CKx pins as serial port pins) 0 = Serial port disabled (held in Reset)

bit 6 RX9: 9-bit Receive Enable bit 1 = Selects 9-bit reception 0 = Selects 8-bit reception

bit 5 SREN: Single Receive Enable bit Asynchronous mode: Don’t care. Synchronous mode – Master: 1 = Enables single receive 0 = Disables single receive This bit is cleared after reception is complete. Synchronous mode – Slave: Don’t care.

bit 4 CREN: Continuous Receive Enable bit Asynchronous mode: 1 = Enables receiver 0 = Disables receiver Synchronous mode: 1 = Enables continuous receive until enable bit CREN is cleared (CREN overrides SREN) 0 = Disables continuous receive

bit 3 ADDEN: Address Detect Enable bit Asynchronous mode 9-bit (RX9 = 1): 1 = Enables address detection, enables interrupt and loads the receive buffer when RSRx<8> is set 0 = Disables address detection, all bytes are received and ninth bit can be used as parity bit Asynchronous mode 9-bit (RX9 = 0): Don’t care.

bit 2 FERR: Framing Error bit

67

1 = Framing error (can be updated by reading RCREGx register and receiving next valid byte) 0 = No framing error

bit 1 OERR: Overrun Error bit 1 = Overrun error (can be cleared by clearing bit CREN) 0 = No overrun error

bit 0 RX9D: 9th bit of Received Data This can be address/data bit or a parity bit and must be calculated by user firmware.

bit 7 ABDOVF: Auto-Baud Acquisition Rollover Status bit 1 = A BRG rollover has occurred during Auto-Baud Rate Detect mode (must be cleared in software) 0 = No BRG rollover has occurred

bit 6 RCIDL: Receive Operation Idle Status bit 1 = Receive operation is inactive 0 = Receive operation is active

bit 5 Unimplemented: Read as ‘0’

bit 4 SCKP: Synchronous Clock Polarity Select bit Asynchronous mode: Unused in this mode. Synchronous mode: 1 = Idle state for clock (CKx) is a high level 0 = Idle state for clock (CKx) is a low level

bit 3 BRG16: 16-bit Baud Rate Register Enable bit 1 = 16-bit Baud Rate Generator – SPBRGHx and SPBRGx 0 = 8-bit Baud Rate Generator – SPBRGx only (Compatible mode), SPBRGHx value ignored

68

bit 2 Unimplemented: Read as ‘0’

bit 1 WUE: Wake-up Enable bit Asynchronous mode: 1 = EUSART will continue to sample the RXx pin – interrupt generated on falling edge; bit cleared in hardware on following rising edge 0 = RXx pin not monitored or rising edge detected Synchronous mode: Unused in this mode.

bit 0 ABDEN: Auto-Baud Detect Enable bit Asynchronous mode: 1 = Enable baud rate measurement on the next character. Requires reception of a Sync field (55h); cleared in hardware upon completion. 0 = Baud rate measurement disabled or completed Synchronous mode: Unused in this mode.

Baud Rate Generator (BRG) The BRG is a dedicated 8-bit or 16-bit generator that supports both the Asynchronous and Synchronous modes of the EUSART. By default, the BRG operates in 8-bit mode; setting the BRG16 bit (BAUDCONx<3>) selects 16-bit mode.

The SPBRGHx:SPBRGx register pair controls the period of a free running timer. In Asynchronous mode, bits BRGH (TXSTAx<2>) and BRG16 (BAUDCONx<3>) also control the baud rate. In Synchronous mode, BRGH is ignored. Table 20-1 shows the formula for computation of the baud rate for different EUSART modes which only apply in Master mode (internally generated clock). Given the desired baud rate and FOSC, the nearest integer value for the SPBRGHx:SPBRGx registers can be calculated using the formulas in Table 20-1. From this, the error in baud rate can be determined. An example calculation is shown in Example 20-1. Typical baud rates and error values for the various Asynchronous modes are shown in Table 20-2. It may be advantageous to use the high baud rate (BRGH = 1) or the 16-bit BRG to reduce the baud rate error, or achieve a slow baud rate for a fast oscillator frequency. Writing a new value to the SPBRGHx:SPBRGx registers causes the BRG timer to be reset (or cleared). This ensures the BRG does not wait for a timer overflow before outputting the new baud rate.

69

INTRODUCTION TO DEVELOPMENT ENVIRONMENT USED

MPLAB Integrated Development Environment The MPLAB X IDE is the new graphical, integrated debugging tool set for all of Microchip’s more than 800 8-bit, 16-bit and 32-bit MCUs and digital signal controllers, and memory devices. It includes a feature-rich editor, source-level debugger, project manager, software simulator, and supports Microchip’s popular hardware tools, such as the MPLAB ICD 3 in-circuit debugger, PICkit™ 3, and MPLAB PM3 programmer. Based on the open-source NetBeans platform, MPLAB X runs on Windows® OS, MAC® OS and Linux, supports many third-party tools, and is compatible with many NetBeans plug-ins. Sample view of mplab

70

Steps of

Creating project In MpLab Step1 : Select project wizard from project menu

Step2 : Select Appropriate processer

Step3 : Select Appropriate Tool Suit (c18)

71

Step4 : Select Project Name And Destination

72

Step5 : Add Files

Step6 : Finish

73

PROGRAMMER/DEBUGGER In-Circuit Programming In Circuit Serial Programming is a method of directly programming a Microchip PIC or Atmel AVR while in they are connected to a circuit, as opposed to programming the chip ahead, and only then soldering it to a circuit. There are many benefits to ICSP In circuit programming has many advantages:  It shortens the development cycle – it is really annoying to take a chip out of the board each time it needs to be reprogrammed, and it’s even much harder with SMD.  Allows customer and in field firmware upgrades  Calibrate the system during manufacturing or in the field  Assign unique ID \ serial number to product

PicKit3 Programmer/Debugger Microchip’s PICkit 3 In-Circuit Debugger/Programmer uses in-circuit debugging logic incorporated into each chip with Flash memory to provide a low-cost hardware debugger and programmer. In-circuit debugging offers these benefits:  Low cost  Minimum of additional hardware needed for debug  Expensive sockets or adapters are not required The MPLAB PICkit 3 allows debugging and programming of PIC® and dsPIC® Flash microcontrollers at a most affordable price point using the powerful graphical user interface of the MPLAB Integrated Development Environment (IDE). The MPLAB PICkit 3 is connected to the design engineer's PC using a full speed USB interface and can be connected to the target via an Microchip debug (RJ-11) connector (compatible with MPLAB ICD 2, MPLAB ICD 3 and MPLAB REAL ICE). The connector uses two device I/O pins and the reset line to implement in-circuit debugging and In-Circuit Serial Programming. PICkit 3 Features  USB (Full speed 12 Mbits/s interface to host PC)  Real-time execution  MPLAB IDE compatible (free copy included)  Built-in over-voltage/short circuit monitor  Firmware upgradeable from PC/web download  Totally enclosed  Supports low voltage to 2.0 volts (2.0v to 6.0v range)  Diagnostic LEDs (power, busy, error)  Read/write program and data memory of microcontroller  Erase of program memory space with verification  Freeze-peripherals at breakpoint  Program up to 512K byte flash with the Programmer-to-Go PicKit 3 specification  Lanyard Connection o A convenient lanyard connection is available on the programmer.

74

 USB Port Connection o The USB port connection is a USB mini-B connector. Connect the PICkit 3 to the PC using the supplied USB cable.  Pin 1 Marker o This marker designates the location of pin 1 for proper connector alignment.  Programming Connector o The programming connector is a 6-pin header (0.100" spacing) that connects to the target device. Pin Description 1 = MCLR/VPP 2 = VDD Target 3 = VSS (ground) 4 = PGD (ICSPDAT) 5 = PGC (ICSPCLK) 6 = PGM (LVP)

Status LEDs The Status LEDs indicate the status of the PICkit 3. 1. Power (green) – Power is supplied to the PICkit 3 via the USB port. 2. Active (blue) – The PICkit 3 has connection to the PC USB port and the Communication link is active. 3. Status:Busy (yellow) – The PICkit 3 is busy with a function in progress, such as Programming.

Push Button The push button is used for Programmer-To-Go.

75

PROJECT DESCRIPTION The aim is to decode the predefined NMEA sentences generated by GPS kit within the PIC microcontroller and then send the decoded data to computer or LCDs. Here we are sending the decoded data to computer by serial communication. We can watch the sent data on computer by many softwares like serial term etc. As we saw previously the data that GPS receiver receives is in form of packets and frames. The GPS receiver kit access this data by pre burned program in the GPS kit & covert it into a big string of ASCII characters that is called the NMEA sentences. Previously we have given detail of NMEA sentences. NMEA sentences are the sentences starts with $ and have 5 characters in starting showing which type of data string it is. Suppose the data string is of $GPRMC then it is clear by the NMEA sheet that it is the string which contains the information of time, latitude, longitude etc. The string has this information separated by commas. Falcon GPS kit which we used in our project send the data to PIC microcontroller at 9600 bits/second. This baud rate is well supported by PIC. We have developed a firmware in embedded C & programmed the PIC to decode the data coming from falcon GPS kit and then sent it to computer. The program burned in PIC do following works respectively: 1. Wait until the $ comes. 2. After finding $ it matches the next five characters, whether they are GPRMC or not ( we are presently decoding only latitude, longitude and time information). 3. If the desired string is found it saves the complete NMEA sentence till the next $ comes. 4. It separates the data between the commas (as we know that the data is coded between the commas). 5. Save the separated data in a 2D array. 6. Lastly sends data to computer by serial communication at a baud rate of 9600 bits/sec.

76

Block Diagram

77

CONCLUSION The study and design of project is completed successfully. The GPS NMEA Decoder found its application in testing of the GPS data and other developing GPS projects. MPLAB Integrated Development Environment used as a developing environment for this project.

REFERENCES Web References  http://drdo.gov.in/drdo/English/index.jsp?pg=policies.jsp  http://en.wikipedia.org/wiki/Defence_Research_and_Development_Organisatio n  http://en.wikipedia.org/wiki/Defence_Laboratory,_Jodhpur  http://en.wikipedia.org/wiki/Microcontroller  http://en.wikipedia.org/wiki/ARM_architecture  http://en.wikipedia.org/wiki/Atmel_AVR  http://en.wikipedia.org/wiki/PIC_microcontroller  http://ssecganesh.blogspot.in/2008/05/features-of-pic-microcontroller.html  http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en010300  http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId= 1406&dDocName=en538340&redirects=pickit3  http://electronicsnewsline.com/362/types-of-microcontroller.html  http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId= 1406&dDocName=en019469&part=SW007002  http://ww1.microchip.com/downloads/en/DeviceDoc/51721b.pdf  http://ww1.microchip.com/downloads/en/DeviceDoc/39646b.pdf  http://www.lirtex.com/embedded/microcontroller-icsp-in-circuit- programming/  http://en.wikipedia.org/wiki/Mplab_ide

Search Engine References  http://www.google.co.in Book References  PIC Microcontroller and Embedded Systems, Muhammad Ali Mazidi

78

APPENDIX A Embedded C Code of GPS NMEA Decoder //Gps_NMEA_Decoder.C //This program decode desired data from NMEA sentences

#include //including the pic18f8722 header file #pragma config WDT = OFF //initialize the microcontrollers with initial settings #pragma config OSC=HSPLL #pragma config FCMEN=OFF #pragma config IESO=OFF #pragma config PWRT=OFF #pragma config BOREN=OFF #pragma config MCLRE=ON #pragma config LVP=OFF #pragma config XINST=OFF #include void RX(); //declaring required functions void match(); void wait(); void TX(); void receive(); void separate(); void transmit(); unsigned char p; //declaring required characters & array unsigned char i,k,j,f; unsigned char a[70]; //array for saving the whole NMEA sentence unsigned char c[15][10]; //2D array for saving decoded data unsigned char b[]="GPRMC,"; // first five chars of required NMEA sting signed char x=0; void main(void) { OSCTUNEbits.PLLEN=1; //setting up the EUSART and declaring the i/p & o/p pins RCSTA=0x90; TXSTA=0x20; SPBRG=64; RCREG=0x00; TRISCbits.RC6=0; TRISCbits.RC7=1;

while(1) //setting up a infinite loop { match(); //calling the match function, if x=0 the required string is found if(x==0) { receive(); //calling the receive function that receive whole required string i=j=k=0; separate(); //separates the information from received string i=j=k=0; transmit(); // transmit the separated data to serial communication i=j=k=x=0; } } }

79

void RX() //this function receive a byte through serial communication { while(PIR1bits.RCIF==0); //wait till RCIF flag is set, it means wait for a character is received PIR1bits.RCIF=0; // Clear the RCIF flag } void TX() //this function send a byte through serial communication { while(PIR1bits.TXIF==0); PIR1bits.TXIF=0; } void wait() //this function check the received byte and wait till the $ comes { while(1) { RX(); p=RCREG; if(p=='$') break; }

}

void receive() //this function receive and save the bytes continuously till the enter comes { i=0; do { RX(); a[i]=RCREG; i++;

} while(RCREG!=0x0D); }

void transmit() //this function transmit the bytes one by one from 2D array to serial communication till the enter comes, it print tab at the place of commas { while(c[k][j]!=0x0D) { if(c[k][j]!=',') { TX(); TXREG=c[k][j]; j++; } else { printf("\n"); printf("\t"); k++; j=0;

} } }

80 void separate() // separate the information from the commas and save the separated data in a 2D array, it check for the comma and save the different information in different rows {

while(a[i]!=0x0D) { if(a[i]==',') { c[k][j]=a[i]; k++; i++; j=0; } else { c[k][j]=a[i]; j++; i++; } } c[k][j]=a[i]; }

void match() //this fuction match the first 6 characters of a string after $ with apre saved string GPRMC, and if the characters are same it gives output of x=0, if different than it gives x=1 { for(i=0;i<70;i++) a[i]=0; //PIR1bits.RCIF=0; wait(); for(i=0;i<=5;i++) { RX(); a[i]=RCREG; } x=0; for(f=0;f<=5;f++) { if(a[f]!=b[f]) x=1; } }

81

FLOW CHART

START

Get NMEA sentences from serial port and wait until ‗$‘ is recieved

If ‗$‘ found

Y N

If sentence contain ―GPRMC‖

Y

Separate the fields and display each field included in it

Y If Enter N ―0x0D‖ is encountere d

EXIT

82