“The Global Positioning System (GPS) is a space satellite navigation and positioning system jointly developed by the U.S. Army, Navy, and Air Force in the 1970s. Its purpose is to provide the U.S. military with real-time precise positioning, navigation and timing services. Usually GPS system consists of 3 parts: space part: including 24 GPS satellites; ground control part: monitoring GPS satellites; user part: receiving positioning information from GPS satellites, usually including antennas and receivers and other equipment.
Author: Li Lizao
The Global Positioning System (GPS) is a space satellite navigation and positioning system jointly developed by the U.S. Army, Navy, and Air Force in the 1970s. Its purpose is to provide the U.S. military with real-time precise positioning, navigation and timing services. Usually GPS system consists of 3 parts: space part: including 24 GPS satellites; ground control part: monitoring GPS satellites; user part: receiving positioning information from GPS satellites, usually including antennas and receivers and other equipment. When the GPS system performs positioning, it must determine the user’s location (including the three coordinates of x, y, and z), and at the same time, the error t between the satellite clock and the receiver clock must be considered, and four unknowns must be solved. Four equations must be established. Usually, the corresponding equation can be established by measuring the pseudo-range between the satellite and the user. Therefore, it is necessary to observe four satellites at the same time to achieve accurate positioning. With the development of the times, the GPS system is no longer limited to the US military, and has been widely used in all aspects of social life, from geodetic mapping to vehicle navigation. In view of the important significance of satellite navigation technology in the civil and military fields, my country has also established a corresponding “Beidou Navigation System”, but at present, the most widely used GPS system in my country is. In this paper, aiming at GPS system, the transmission and extraction method of positioning information between GPS receiver and PC is introduced.
2 Format of positioning information
To realize the extraction and Display of the positioning information, the transmission of the positioning information must be realized first, that is, the communication between the GPS receiver and the PC is realized through the corresponding interface. The receiver introduced in this paper adopts the GPS receiver chip of SiRF Technology Company, receives GPS satellite signals through the antenna, and performs corresponding processing to generate positioning information, and then outputs it through the serial port (RS 232). There are many GPS communication protocols, this paper adopts the most widely used NMEA-0183 protocol. This protocol includes formats such as “$GPGGA”, “$GPGSA”, “$GPGSV” and “$GPRMC”. This article takes the simplest format “$GPRMC” statement as an example to introduce the meaning of each data segment in the protocol. For example: $GPRMC, 161022. A, 3212.875, N, 11893.578, E, O. O, 11O. 4, 140406, 2.3, W, A*302.
The data segments in this column are separated by commas, where:
$GPRMC is the frame header, which identifies the structure of the data in the subsequent frame; 161022 is the UTC standard time, the format is “hh/mm/ss”; A means the data is valid, if it is V, it means that there are less than 3 trackable satellites; 3212.875 is the latitude value, the format is “ddmm.mmmm”; N means the north latitude, if it is S, it means the south latitude; 11893.578 is the longitude value, the format is “dddmm.mmmm”; E means the east longitude, if it is W, it means the west longitude ; 0.0 means speed; 110.4 means azimuth, from 000.0° to 359.9°; 140406 is the UTC standard date in the format of “mm/dd/yy”; 2.3 means geomagnetic change, from 000 . O°～180.0°; W represents the direction of geomagnetic change, including w or E;
Among these data, this article is mainly concerned with geographic coordinates and time, i.e. latitude, longitude and UTC date and time.
3 Transmission and extraction of positioning information
The transmission of positioning information, that is, the communication between the GPS receiver and the PC, is usually realized by a serial port. In this paper, the MSComm control provided by VB is used to write the serial port program to achieve the purpose of communication. MSComm control is widely used to realize serial communication, and its introduction will not be repeated here. When implementing the specific serial communication in this article, the relevant properties of the MSComm control must be set. The settings that need to be changed from the default settings include the following 3 parts:
(1) Considering that the GPS serial communication adopts fixed parameters, the Settings property in the MSComm control should be set to “4800, N, 8, 1”, that is, the baud rate is 4 800 b/s, and there is no parity bit. , the data bits are 8, and the stop bits are 1.
(2) According to the different receivers used, it is also necessary to set the inputMode property in the MSComm control. In this paper, the “comInputMode Text” method is used.
(3) According to the selected serial port, set the Commport property in the MSComm control to the corresponding serial port number, which is “1” in this article.
The extraction of positioning information includes 2 parts:
(1) Extract information such as latitude and longitude from the “$GPRMC” data column;
(2) Display the information in the text box. This work can be implemented programmatically in the OnComm event in the MSComm control. The flow chart is shown in Figure 1.
Part of the code is as follows:
First, assign the location information in the “$GPRMC” format in the cache to the string variable “GPRMC”, and extract the required data from the variable “GPRMC” through the corresponding statement according to the “$GPRMC” format described earlier. Information such as latitude, longitude, speed, and time and date are assigned to the corresponding variables. It should be noted that when extracting time information, it is necessary to convert UTC time to Beijing time, and perform modulo operation on 24 to ensure the accuracy of the time. Then, the extracted positioning information is displayed in a pre-designed text box. Through these steps, the extraction of positioning information is completed, and the specific effect is shown in Figure 2.
This paper introduces a method of using VB to extract GPS positioning information, which is simple and practical. Through this method, the data communication between the GPS receiver and the PC can be realized, and the required positioning information can be displayed directly in the corresponding window.