TOP Contributors

  1. MIKROE (2784 codes)
  2. Alcides Ramos (403 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (132 codes)
  5. Bugz Bensce (97 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (140957 times)
  2. FAT32 Library (73512 times)
  3. Network Ethernet Library (58321 times)
  4. USB Device Library (48508 times)
  5. Network WiFi Library (44132 times)
  6. FT800 Library (43686 times)
  7. GSM click (30546 times)
  8. mikroSDK (29286 times)
  9. PID Library (27220 times)
  10. microSD click (26931 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
Library

GPS Parser

Rating:

8

Author: MIKROE

Last Updated: 2018-02-13

Package Version: 1.0.0.0

Category: GPS

Downloaded: 5487 times

Followed by: 8 users

License: MIT license  

For those wishing to have all the information possible from their GPS, there's a click for that. This library is a gps parser. What is does is separates the various sentences that come from the gps satellites into useful parts and pieces. Then gives the developer access the the underlying data with useful getter type functions.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "GPS Parser" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "GPS Parser" changes.

Do you want to report abuse regarding "GPS Parser".

  • Information
  • Comments (9)

Library Blog

Pre-Notes: Library is customizable in size.  With all features enabled, library compiles to ~14kb.  To customize the size, comment or un-comment out sentences in the gps_config.h file. Usage Scenario:

  1. GPS data coming over i2c, uart, or spi
  2. Need specific information from GPS

How to: Set up gps data for parsing. 

Example:

#include "gps_parser.h"

void system_init()
{    
    ...    
    UART1_Init_Advanced(115200, _UART_8_BIT_DATA, _UART_NOPARITY,
    _UART_ONE_STOPBIT, &_GPIO_MODULE_USART1_PA9_10);
    Delay_ms( 100 ); // Allow a small delay for clock stability    
    RXNEIE_USART1_CR1_bit = 1; // Enable rx interrupt for usart 1    
    NVIC_IntEnable( IVT_INT_USART1 ); // Enable NVIC for rx usart1 interrupt    
    ….
}  

void main()
{    
    system_init();      
    while( 1 )    
    {        
        gps_parse();    
    }
}  

void UART1_RX_ISR() iv IVT_INT_USART1 ics ICS_AUTO
{    
    if( RXNE_USART1_SR_bit )    
    {        
        gps_put( USART1_DR );      
    }
}  

 

Explaination: What we have done is connected up a usart to a gps. When data comes from the gps it triggers the interrupt which places the incoming data into the gps_put() function. Meanwhile in the main loop we are repeatedly calling gps_parse(); When this function receives a full sentence, it quickly parses it into the respective data. The gps_put() function can also be put into a pooling loop as well.

while(1)
{    
    …    
    if( UART1_Data() )    
    {        
        gps_put( UART1_Read() );    
    }    
    gps_parse();
}

 

So what does this do? What it gives you access to is the following functions:

  • location_t * gps_current_lon (void)
  • location_t * gps_current_lat (void)
  • TimeStruct * gps_current_time (void)
  • utc_time_t * gps_current_fix (void)
  • fix_t gps_gga_fix_quality (void)
  • uint8_t gps_gga_satcount (void)
  • float gps_gga_hor_dilution (void)
  • double gps_gga_altitude (void)
  • double gps_gga_msl (void)
  • uint16_t gps_gga_lastDGPS_update (void)
  • uint16_t gps_gga_DGPS_stationID (void)
  • ACTIVE_t gps_gll_active (void)
  • GSA_MODE_t gps_gsa_mode (void)
  • GSA_MODE_t gps_gsa_fix_type (void)
  • uint8_t * gps_gsa_sat_prn (void)
  • float gps_gsa_precision_dilution (void)
  • float gps_gsa_horizontal_dilution (void)
  • float gps_gsa_vertical_dilution (void)
  • GPS_STATUS_t gps_rmc_status (void)
  • double gps_rmc_speed (void)
  • double gps_rmc_track (void)
  • double gps_rmc_mag_var (void)
  • azmuth_t gps_rmc_direction (void)
  • GPS_STATUS_t gps_rmc_mode (void)
  • double gps_vtg_track (void)
  • double gps_vtg_mag (void)
  • double gps_vtg_speedknt (void)
  • double gps_vtg_speedkm (void)
  • datum_code_t gps_dtm_local (void)
  • char * gps_dtm_localoffset (void)
  • double gps_dtm_latoffset (void)
  • azmuth_t gps_dtm_lat_offset_dir (void)
  • double gps_dtm_lonoffset (void)
  • azmuth_t gps_dtm_lon_offset_dir (void)
  • double gps_dtm_altoffset (void)
  • datum_code_t gps_dtm_datum (void)
  • float gps_gbs_laterror (void)
  • float gps_gbs_lonerror (void)
  • float gps_gbs_alterror (void)
  • uint8_t gps_gbs_satid (void)
  • float gps_gbs_probmiss (void)
  • double gps_gbs_failedest (void)
  • float gps_gbs_std_deviation (void)
  • char * gps_gpq_message (void)
  • uint8_t gps_grs_mode (void)
  • float gps_grs_range (void)
  • float gps_gst_rms (void)
  • float gps_gst_stddev_major (void)
  • float gps_gst_stddev_minor (void)
  • float gps_gst_orientation (void)
  • float gps_gst_stddev_lat (void)
  • float gps_gst_stddev_lon (void)
  • float gps_gst_stddev_alt (void)
  • double gps_ths_heading (void)
  • vehicle_status_t gps_ths_status (void)

     

 

GPS Preview

GPS Preview

GPS Preview image.

View full image
Search Paths

Search Paths

Edit your search paths for include files.

View full image

Note*

When changing the configuration of the library. You will need to re-build all sources to re-compile the library for the new / fewer features as described in gps_config.h.

Config of GPS Parser

Config of GPS Parser

gps_config.h

View full image
Rebuild all sources

Rebuild all sources

Rebuild all sources when making a change to the library.

View full image

ALSO FROM THIS AUTHOR

Accel 28 Click

0

Accel 28 Click is a compact add-on board that contains an acceleration sensor. This board features the LIS2HH12TR, an ultra-low-power high-performance three-axis accelerometer from STMicroelectronics. It allows selectable full-scale acceleration measurements in ranges of ±2g, ±4g, and ±8g in three axes with a configurable host interface that supports both SPI and I2C serial communication.

[Learn More]

USB-C Sink 4 Click

0

USB-C Sink 4 Click is a compact add-on board designed to enable devices to draw power through the USB Type-C interface. This board features the CYPD3178, a USB Type-C power sink controller from Infineon. This Click board™ includes a controller with an integrated USB Type-C transceiver, load switch control with soft start, and system-level fault protection. It has configurable charging protocols, voltage negotiation, and an unpopulated SAFE 5V header for an alternate power supply.

[Learn More]

Silent Step 3 click

5

Silent Step 3 Click is the complete integrated bipolar step motor driver solution, rich with many features that allow extremely smooth and silent operation of the connected motor while being able to provide up to 4A peak motor current and withstand up to 30V supply voltage.

[Learn More]