Table of ContentsThe Garmin GPS SubsystemConnecting To the Wildcard Bus Selecting the Wildcard Address Mosaic GPS Driver Software
Driver Functions Extract GPS Data from NMEA Sentences
Overview of the Mosaic GPS Software Device Driver Functions
GPS Service Loop Is Best Placed In Its Own Task Demo Program Prints Formatted GPS Data Installing the Mosaic GPS Wildcard Driver Software Using the Mosaic GPS Driver Code with C Using the Mosaic GPS Driver Code with Forth |
The GPS Wildcard User GuideForth Demonstration ProgramThis section presents the Forth version of the demonstration program source code.
\ Filename: GPS_WC_Demo.c \ Date: Feb 27, 2007 \ copyright 2007 Mosaic Industries, Inc. All rights reserved.
\ This is a demonstration program for the GPS Wildcard. \ Make sure that GPS_MODULE_NUM matches your hardware jumper settings. \ Note: in real applications, the GPS service should be invoked from a separate task.
HEX FIND WHICH.MAP \ do this only for page-swapping platforms! IFTRUE \ nesting is allowed if ends are sequential EXECUTE 0= ( -- standard.map? ) \ run which.map IFTRUE 4 PAGE.TO.RAM \ if in standard.map, transfer to download map 5 PAGE.TO.RAM 6 PAGE.TO.RAM DOWNLOAD.MAP ENDIFTRUE ENDIFTRUE
\ if your memory map is not already set, set it here after load of GPS driver: \ 800 4 DP X! 5800 4 NP X! \ for kernel V4.xx \ 0x8000 1 DP X! 0x8000 0x11 NP X! \ for kernel V6.xx
F WIDTH ! \ set width of names stored in dictionary
ANEW GPSDemo_Code \ define forget marker for easy re-loading
0 CONSTANT GPS_MODULE_NUM \ MUST match hardware jumper settings!
: GPS_RUN ( local_hour_offset\module_num -- ) \ this function initializes the GPS Wildcard and prints a formatted summary \ of GPS info to the terminal every 5 seconds. Type any key to terminate the function. \ Note: in real applications, the GPS service should be invoked from a separate task. 2 NEEDED DUP 0 LOCALS{ &print_counter &module } ( local_hour_offset\module_num -- ) GPS_INIT 0= ( ok? -- ) IF CR .” Starting GPS info dump. Type any key to exit this function.” CR .” This function gets a data frame from the GPS once per second,” CR .” and prints a statement telling of the fix validity.” CR .” If the fix is not valid, make sure your antenna is outside,” CR .” and give the GPS some time (5 minutes worst case) to acquire its satellites.” CR .” This function periodically calls GPS_Info_Dump to summarize the GPS data.” CR CR BEGIN &module GPS_UPDATE CR CR .” Valid fix?: “ ( error -- ) \ runs every second IF .” NO” ELSE .” YES” ENDIF &print_counter 1+ DUP TO &print_counter 5 = \ detailed print every 5 seconds IF 0 TO &print_counter GPS_INFO_DUMP \ print extracted info CR CR ENDIF ?KEY UNTIL \ type any key to end this routine ELSE CR .” GPS_INIT FAILED!” ENDIF ;
: GPS_DEMO ( -- ) \ this function initializes the GPS Wildcard with a specified time zone and module number, \ and prints a formatted summary of GPS info to the terminal every 5 seconds. \ Type any key to terminate the function. \ Note: in real applications, the GPS service should be invoked from a separate task. GPS_PACIFIC_TIME GPS_MODULE_NUM ( local_hour_offset\module_num -- ) GPS_RUN ;
FIND WHICH.MAP IFTRUE \ for kernel V4.xx platforms... XDROP ( -- ) \ drop xcfa 4 PAGE.TO.FLASH 5 PAGE.TO.FLASH 6 PAGE.TO.FLASH STANDARD.MAP SAVE OTHERWISE \ for V6.xx kernels, store to shadow flash and save pointers SAVE.ALL . \ this takes some time, should print FFFF for success ENDIFTRUE
|
Home|Site Map|Products|Manuals|Resources|Order|About Us
Copyright (c) 2006 Mosaic Industries, Inc.
Your source for single board computers, embedded controllers, and operator interfaces for instruments and automation