北斗/GPS都是用的nmea通用协议。
NMEA-0183协议定义的语句非常多,但是常用的或者说兼容性最广的语句只有$GPGGA、$GPGSA、$GPGSV、$GPRMC、$GPVTG、$GPGLL等。
GPRMC具体细节:
/* Format $GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A | | | | | | | | | | | | | | | | | | | *6A Checksum data | | | | | | | | | | | | | | | | | 003.1,W Magnetic Variation | | | | | | | | | | | | | | | 230394 Date - 23rd of March 1994 | | | | | | | | | | | | | 084.4 Track angle in degrees | | | | | | | | | | | 022.4 Speed over the ground in knots | | | | | | | | | 01131.000,E Longitude 11 deg 31.000‘ E | | | | | | | 4807.038,N Latitude 48 deg 07.038‘ N | | | | | A Status A=active or V=Void | | | 123519 Fix taken at 12:35:19 UTC | RMC Recommended Minimum sentence C */
1、NMEA library
开源的NMEA library就够用了,而且至今也没发现有比这个更好的解析库
支持: GPGGA, GPGSA, GPGSV, GPRMC, GPVTG
跨平台,支持如下编译环境
- Microsoft Windows (MS Visual Studio 8.0, GCC)
- Windows Mobile, Windows CE (MS Visual Studio 8.0)
- UNIX (GCC)
http://nmea.sourceforge.net/
有人建了个eclipse工程,这些库建工程很繁琐,偷懒无罪。
https://github.com/AHR-Project/nmealib
2、GPS Library
之前在cortex-m3上调过北斗并且在cortex-m4上调过GPS,也都是在网上找了个现成的解析实例,这种大众化的模块不用重复造轮子了。
Library 27- Read GPS data on STM32F4 devices
Features
- Parse GPS data
- Supported NMEA 0183 standard
- Works with GPGGA, GPRMC, GPGSA, GPGSV NMEA statements
- Version 1.1 – August 22, 2014
- Calculate distance between 2 coordinates
- Calculate bearing between 2 coordinates
- Allows you to select custom NMEA statements
http://stm32f4-discovery.com/2014/08/library-27-gps-stm32f4-devices/
完整的库文件和工程在github
https://github.com/MaJerle/stm32f429
时间: 2024-10-22 19:48:25