This paper expounds the method of using serial port to realize GPS and PDA communication in WITADOWSCE embedded system.
Firstly, the data format of GPS signal is introduced, and the software and hardware environment of the system and serial communication are described. Finally, the design of GPS signal processing module, detailed description of how to use embedded program language to develop serial communication program, and give specific steps and part of the implementation code.
Introduction
3PS is the global Positioning system, there are three major components-space constellation, ground monitoring and user equipment. Among them (the GPS Space constellation part, the ground monitoring part is controlled by the United States; The GPS user equipment mainly consists of receiver hardware and processing software. The user receives the GPS satellite signal through the user equipment, obtains the user position, the speed and so on by the signal processing, finally realizes uses the GPS navigation and the localization goal. At present, many GPS manufacturers follow the NMEAO183 protocol for PDA handheld computer development of many navigation GPs.
GPS through the serial port and PDA to achieve data communication, using (3PS data, can be in the PDA on the real-time position, speed and other parameters. With the integration of GIS system, digital navigation can be realized on the PDA, and the location of the map is intuitively understood. The following details how to achieve the GPS and PDA serial communication. (Computer science)
Serial communication
Each PocketPC is equipped with a serial port for communication between PocketPC and an external serial device. The essential function of a serial port is to act as a coded converter between a chip and a serial device. When data is sent from the chip through the serial port, the byte data is converted to a sequential bit. When the data is received, the bits of the serial are converted to byte data. WINDOWSCE uses the communication driver Comm. DRV to send and receive data using the standard WINDOWSAPI function. Drivers are typically provided by the serial device manufacturer to connect hardware to Windows CE. In the program design, simulates a COM6 serial port. Use COMM6 first. Poxtopen Open the serial port, set the properties of the Comm control, timer triggers the OnComm to receive the GPS signal event, the realization of real-time GPS signal reception. GPS provides serial communication interface, serial communication parameters are: Baud rate =57, data bits = 8 bits, start bit = 1 bits, stop bit = 1 bits, no parity.
GPS Data Format
The NMEA0183 agreement is a standard for GPS interface protocol established by the National Oceanic Electronics Association (nationaimarineelectronlcsassociation). NMEA0183 defines several statements that represent different meanings, each of which is actually an ASCII code string. This code is intuitive and easy to identify and apply. In the experiment, you do not need to understand all the information of the NMEA0183 communication protocol, only need to pick out the part of the location data needed, the rest of the information ignored.
When the GPS communicates with the handheld computer, it sends 10 data per second through the serial port. When the actual navigation application reads the GPS spatial location data, it can update the latitude and longitude data every few seconds according to the need, do not need to update the data frequently, otherwise, it will waste the limited power of the handheld equipment. If and satellite communications are normal, the data formats that can be received are as follows: $GPGGA,,<2>,<3>,<4>,<5>,<6>,<7>,<8>,<9> , <10>,,<12>*hh. Its specific information is listed in table L.
A complete NEMA0183 statement is a string of characters from the start "$GPGGA" to The Terminator "". The information that needs to be mastered is latitude and longitude, longitude and latitude direction, GPS positioning status and receiving signal time. So when you receive such a complete NEMA0183 statement, the way to extract useful information is to first determine the position of the starting character $gpgga, start reading the human data from the starting character, then look for the character "," through the XOR statement, and then intercept the two "," between the characters (strings) to get the data concerned , and returns the Terminator of a CPS statement to obtain a complete GPS signal. In the extracted GPS statements, find the latitude and longitude of the position of the comma, read the latitude and longitude of the coordinates, and then the latitude and longitude of the coordinates of the conversion of degrees. Because the coordinates of the map are measured in degrees.
GPS Signal Processing
According to the principle of serial communication and the format of GPS data, GPS signal processing module can be designed to extract the information related to 3PS position. Since the general user coordinate system is a cartographic coordinate system, it is also necessary to transform the coordinates extracted from GPS signals from WGS84 coordinates to the corresponding 54, 80 or local coordinates.
Design of GPS Signal processing module
The design scheme of the GPS data processing module is shown in Figure L. GPS receiver through the serial port 6 will locate data (nmea0183ver2. O) to PocketPC and position the GPS data on the electronic map. In eVB, the positioning data is read in with the help of the Comm control, followed by the classification of the location data, and the required information is extracted, and the useful information is passed to the main application. The main application then collates the control information of GPS receiver into NEMA0183 VER2. The O statement is passed through the Comm control and sent to the GPS receiver. So, P0cket. The serial communication between PC and GPS receiver and the data processing function of GPS positioning process the real-time performance of the system is realized through the process manager of the operating system through the encapsulation of ActiveX server. Thus bypassing the eVB of the single thread.
GPS signal receiving and processing process
After the GPS receives the position signal, the system will decompose the GPS positioning information and extract the useful data. GPS signal Reception and processing process: through the serial port 6 to the GPS output data to the PDA,PDA main program to obtain the target current position (latitude and longitude coordinates, elevation), the receiver obtained GPS data decomposition, from which to get the target current position and GMT ( This time plus 8 hours is our standard time, after the corresponding coordinate conversion, and then the current position on the map. GPS signal reception and processing as shown in Figure 2.
Realization of receiving program of GPS signal