TOP Contributors

  1. MIKROE (2653 codes)
  2. Alcides Ramos (351 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 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 (136652 times)
  2. FAT32 Library (69866 times)
  3. Network Ethernet Library (55901 times)
  4. USB Device Library (46244 times)
  5. Network WiFi Library (41871 times)
  6. FT800 Library (41108 times)
  7. GSM click (28964 times)
  8. PID Library (26403 times)
  9. mikroSDK (26328 times)
  10. microSD click (25342 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: 5075 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

Oximeter2 click

0

Oximeter 2 Click is a compact add-on board perfectly suited for measuring the blood oxygen saturation.

[Learn More]

Opto 3 click

5

Opto 3 click is a relay Click boardâ„¢, equipped with two pairs of optically isolated solid-state relays (SSR).

[Learn More]

Barometer 12 click

0

Barometer 12 Click is a compact add-on board that measures air pressure in a specific environment. This board features the ICP-10125, a high-accuracy, low-power, 10-atm waterproof barometric pressure and temperature sensor from TDK InvenSense.

[Learn More]