How do I discern Maidenhead Locator from GPS lat long info.


Results 1 to 40 of 126

Threaded View

  1. #34
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644

    Default Re: How do I discern Maidenhead Locator from GPS lat long info.

    this is how I would go about parsing nmea, for what you are doing there is little point in storing all the data just to display it
    only store what is needed for calculations or enhanced display.
    I would also read in the entire nmea sentence using $ ast the start marker and * as the end marker.
    when you have a complete sentence send it off for parsing if its the correct sentence type



    Code:
     '****************************************************************
    '*  Name    : NOKIA_DEMO.PBP                                     *
    '*  Author  : richard                                            *
    '*  Notice  :                                                    *
    '*          :                                                    *
    '*  Date    : 16/5/2018                                          *
    '*  Version :  mssp1 version  with bigtxt                        *
    '*  Notes   :                                                    *
    '*          :FOR pic 16F1847@32MHZ           NOKIA               *
    '****************************************************************
    #CONFIG ; 16FF1847.
            __config _CONFIG1, _FOSC_INTOSC & _WDTE_ON & _PWRTE_ON & _MCLRE_ON & _CP_OFF & _BOREN_OFF
            __config _CONFIG2, _PLLEN_OFF & _LVP_OFF
    #ENDCONFIG
    define      OSC         32
     
    ; --- *** Oscillator  *** ---------------------------------------------------
    OSCCON = %11110000           ;32 MHz, 
    ANSELb = 0
    ANSELA = 0
    TRISA=%10010000
    TRISB=%11101011
    ch var byte
    BUFF VAR BYTE [16]
     ;DEFINES FOR DISPLAY   use   font7x5_16.bas   or  font7x5_18.bas     for pic18
     #DEFINE PIC16 1            
     #define use_mssp 1
     lcdheight con 5      ;  6 PAGES   
     lcdwidth  con 83     ; 84 PIXELS WIDE
    ' LCD_CLK     var     LATB.4       ' SCK1     pin needs to be set as dig o/p
    ' LCD_DIN     var     LATB.2       ' SDO1     pin needs to be set as dig o/p
     LCD_RST     var     LATA.4 
     LCD_DC      var     LATA.3
     LCD_CE      var     LATA.6
     LCD_LIGHT   var     LATA.0
    nmea var byte[80]
    h var byte
    m var byte
    s var byte
    Include "nokia_ds.INC"  ' bring it in
    include "font7x5_16.bas"
    @ #DEFINE   TOKEN_DESTROY 1
    include "strtok.pbpmod"
    '==========================    MAIN  Routine    ==============================
        gosub lcd_init
        LCDCLR
        ARRAYWRITE BUFF,["READY",0]
        LCDSTR  5,0,BUFF 
        PAUSE 1000
        LCDCLR
      
    looper:
    'start=$ end=*
    arraywrite nmea,["GNRMC,090045.000,A,3823.6645,N,02353.3600,E,0.02,195.80,170518,,,A",0] 
    ;STRLEN nmea
    strtok nmea,0,","
    LCDSTR  0,0,nmea    ;sentence type
    strtok nmea
    ARRAYREAD  nmea ,[SKIP (STRTOK_INX-STRTOK_LEN),dec2 h,dec2 m,dec2 s]
    arraywrite buff,[dec2 h,":",dec2 m,":",dec2 s,0]
    LCDSTR  36,0,BUFF 
    strtok nmea ;fix
    strtok nmea ;fix
    arraywrite buff,["lon",0]
    LCDSTR  0,1,BUFF 
    ARRAYREAD  nmea ,[SKIP (STRTOK_INX-STRTOK_LEN),str buff\16] 
    LCDSTR 20,1,buff 
    strtok nmea
    ARRAYREAD  nmea ,[SKIP (STRTOK_INX-STRTOK_LEN),str buff\16] 
    LCDSTR 77,1,buff 
    strtok nmea
    arraywrite buff,["lt",0]
    LCDSTR  0,2,BUFF 
    ARRAYREAD  nmea ,[SKIP (STRTOK_INX-STRTOK_LEN),str buff\16] 
    LCDSTR 13,2,buff 
    strtok nmea
    ARRAYREAD  nmea ,[SKIP (STRTOK_INX-STRTOK_LEN),str buff\16] 
    LCDSTR 77,2,buff 
    strtok nmea
    arraywrite buff,["speed",0]
    LCDSTR  0,3,BUFF
    ARRAYREAD  nmea ,[SKIP (STRTOK_INX-STRTOK_LEN),str buff\16] 
    LCDSTR 36,3,buff  
    strtok nmea
    arraywrite buff,["hdg",0]
    LCDSTR  0,4,BUFF
    ARRAYREAD  nmea ,[SKIP (STRTOK_INX-STRTOK_LEN),str buff\16] 
    LCDSTR 36,4,buff 
    strtok nmea
    ARRAYREAD  nmea ,[SKIP (STRTOK_INX-STRTOK_LEN),dec2 h,dec2 m,dec2 s]
    arraywrite buff,[dec2 h,"/",dec2 m,"/",dec2 s,0]
    LCDSTR  36,5,BUFF 
      
       
        
    END
    Attached Images Attached Images  
    Warning I'm not a teacher

Similar Threads

  1. LAT replaces PORT command?
    By markscotford in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd December 2011, 16:37
  2. Need Info for PBP?
    By azmax100 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 30th January 2009, 07:44
  3. Replies: 1
    Last Post: - 27th July 2008, 06:14
  4. dmx info.
    By oscar in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 8th May 2005, 11:54

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts