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]
Rating:
Author: MIKROE
Last Updated: 2019-12-30
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: GPS/GNSS
Downloaded: 4314 times
Not followed.
License: MIT license
Determine your current position with GNSS 7 click. It carries the NEO-M9N GNSS receiver module from u-blox.
Do you want to subscribe in order to receive notifications regarding "GNSS 7 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "GNSS 7 click" changes.
Do you want to report abuse regarding "GNSS 7 click".
Library Description
Library carries generic command parser adopted for GPS-MNEA command based modules. Generic parser
Key functions:
gnss7_cmdSingle
- Sends provided command to the modulegnss7_setHandle
- Handler assignation to the provied commandgnss7_modulePower
- Turn on moduleExamples description
The application is composed of three sections :
void application_task ( )
{
char *p_lat;
char *p_long;
char *p_alt;
char rsp_com[ 50 ] = {0};
gnss7_process( );
if ( timer_cnt > 5000 )
{
p_flag++;
if ( p_flag > 2 )
{
p_flag = 0;
}
timer_cnt = 0;
disp_flag = 1;
}
if ( ( p_flag == 0 ) && ( disp_flag == 1) )
{
mikrobus_logWrite( " ---------------------------------------- ", _LOG_LINE );
p_lat = gnss7_gps_parser( &demo_buf[ 0 ], &demo_cmd[ 0 ], 2 );
if ( p_lat == 0 )
{
mikrobus_logWrite( " Latitude : No data available!", _LOG_LINE );
}
else
{
strcpy( &rsp_com[ 0 ], p_lat );
mikrobus_logWrite( " Latitude : ", _LOG_TEXT );
mikrobus_logWrite( rsp_com, _LOG_LINE );
}
disp_flag = 0;
mikrobus_logWrite( " ---------------------------------------- ", _LOG_LINE );
}
if ( ( p_flag == 2 ) && ( disp_flag == 1) )
{
mikrobus_logWrite( " ---------------------------------------- ", _LOG_LINE );
p_alt = gnss7_gps_parser( &demo_buf[ 0 ], &demo_cmd[ 0 ], 9 );
if ( p_alt == 0 )
{
mikrobus_logWrite( " Altitude : No data available!", _LOG_LINE );
}
else
{
strcpy( &rsp_com[ 0 ], p_alt );
mikrobus_logWrite( " Altitude : ", _LOG_TEXT );
mikrobus_logWrite( rsp_com, _LOG_LINE );
}
disp_flag = 0;
mikrobus_logWrite( " ---------------------------------------- ", _LOG_LINE );
}
if ( ( p_flag == 1 ) && ( disp_flag == 1 ) )
{
mikrobus_logWrite( " ---------------------------------------- ", _LOG_LINE );
p_long = gnss7_gps_parser( &demo_buf[ 0 ], &demo_cmd[ 0 ], 4 );
if ( p_long == 0 )
{
mikrobus_logWrite( " Longitude : No data available!", _LOG_LINE );
}
else
{
strcpy( &rsp_com[ 0 ], p_long );
mikrobus_logWrite( " Longitude : ", _LOG_TEXT );
mikrobus_logWrite( rsp_com, _LOG_LINE );
}
disp_flag = 0;
mikrobus_logWrite( " ---------------------------------------- ", _LOG_LINE );
}
}
All additional functions such as timer initialization and default handler.
Notes GPS:
For parsing, use the GPS Parser function to send the following form of arguments: The name of the NMEA response that you want to parse, the position of the data that you need. As a response - you will get a separate buffer with the requested data
Other mikroE Libraries used in the example:
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.