امتیاز موضوع:
  • 0 رأی - میانگین امتیازات: 0
  • 1
  • 2
  • 3
  • 4
  • 5
AVR GPS NMEA
نویسنده پیام
joker آفلاین
کاربر با تجربه
****

ارسال‌ها: 798
موضوع‌ها: 67
تاریخ عضویت: آذر ۱۳۸۵

تشکرها : 849
( 3655 تشکر در 908 ارسال )
ارسال: #1
AVR GPS NMEA
یکی از استانداردهای خروجی GPS ها فرمت NMEA هست
اینو امروز دیدم ، گفتم اینجا کپی پیست کنم ، شاید یه روزی خودم برگشتم سراغش :)

http://www.circuitsonline.net/forum/view/84518
کد:
'------------------------------------------------------------------------------
'name                     : NMEA_PARSER
'copyright                : B.j. Pasteuning
'purpose                  : Parsing GPS NMEA sentences, GPRMC,GPGGA,GPGSA
'micro                    : ATMega16/128
'------------------------------------------------------------------------------

'BIG LCD
$regfile = "m128def.dat"
$crystal = 16000000

$hwstack = 100
$swstack = 100
$framesize = 100

Config Com1 = 4800 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0

Disable Serial

$lib "glcd.lib"

'BIG LCD
Config Graphlcd = 240 * 128 , Dataport = Porta , Controlport = Portc , Ce = 3 , Cd = 0 , Wr = 2 , Rd = 1 , Reset = 4 , Fs = 6 , Mode = 6
Config Portc.5 = Output                                     'Mode pin
Portc.5 = 0
Cls


On Urxc Rs232_isr
Enable Urxc

Enable Interrupts

Dim Firmware As String * 5 : Firmware = "1.50"

Dim Buffer As Byte
Dim Buffer_str As String * 10
Dim Sentence_header As String * 8
Dim Length As Byte

Dim Gprmc_utc_string As String * 11
Dim Gprmc_utchr_string As String * 2 : Dim Gprmc_utchr As Byte
Dim Gprmc_utcmin_string As String * 2 : Dim Gprmc_utcmin As Byte
Dim Gprmc_utcsec_string As String * 2 : Dim Gprmc_utcsec As Byte

Dim Gprmc_status_string As String * 2

Dim Gprmc_lat_string As String * 10
Dim Gprmc_lathr_string As String * 2 : Dim Gprmc_lathr As Byte
Dim Gprmc_latmin_string As String * 2 : Dim Gprmc_latmin As Byte
Dim Gprmc_latsec_string As String * 2 : Dim Gprmc_latsec As Byte
Dim Gprmc_latssec_string As String * 2 : Dim Gprmc_latssec As Byte

Dim Gprmc_ns_string As String * 2

Dim Gprmc_lon_string As String * 11
Dim Gprmc_lonhr_string As String * 3 : Dim Gprmc_lonhr As Byte
Dim Gprmc_lonmin_string As String * 2 : Dim Gprmc_lonmin As Byte
Dim Gprmc_lonsec_string As String * 2 : Dim Gprmc_lonsec As Byte
Dim Gprmc_lonssec_string As String * 2 : Dim Gprmc_lonssec As Byte

Dim Gprmc_ew_string As String * 2

Dim Gprmc_speed_string As String * 5 : Dim Gprmc_speed As Word
Dim Gprmc_course_string As String * 7 : Dim Gprmc_course As Word

Dim Gprmc_date_string As String * 7
Dim Gprmc_dateday_string As String * 2 : Dim Gprmc_dateday As Byte
Dim Gprmc_datemonth_string As String * 2 : Dim Gprmc_datemonth As Byte
Dim Gprmc_dateyear_string As String * 2 : Dim Gprmc_dateyear As Word

Dim Gpgga_utc_string As String * 11
Dim Gpgga_lat_string As String * 10
Dim Gpgga_ns_string As String * 2
Dim Gpgga_lon_string As String * 11
Dim Gpgga_ew_string As String * 2
Dim Gpgga_posfix_string As String * 2 : Dim Gpgga_posfix As Byte
Dim Gpgga_sats_string As String * 3
Dim Gpgga_hdop_string As String * 4
Dim Gpgga_mslalt_string As String * 4
Dim Gpgga_units1_string As String * 2

Dim Gpgsa_mode1_string As String * 2
Dim Gpgsa_mode2_string As String * 2 : Dim Gpgsa_mode2 As Byte

Dim Gpgsa_sat1_string As String * 3
Dim Gpgsa_sat2_string As String * 3
Dim Gpgsa_sat3_string As String * 3
Dim Gpgsa_sat4_string As String * 3
Dim Gpgsa_sat5_string As String * 3
Dim Gpgsa_sat6_string As String * 3
Dim Gpgsa_sat7_string As String * 3
Dim Gpgsa_sat8_string As String * 3
Dim Gpgsa_sat9_string As String * 3
Dim Gpgsa_sat10_string As String * 3
Dim Gpgsa_sat11_string As String * 3
Dim Gpgsa_sat12_string As String * 3

Dim Gpgsv_totalmessages_string As String * 2 : Dim Total_messages As Byte
Dim Gpgsv_currentmessage_string As String * 2 : Dim Current_message As Byte
Dim Gpgsv_sats_string As String * 3

Dim Gpgsv_ch1satid_string As String * 3
Dim Gpgsv_ch1satel_string As String * 3
Dim Gpgsv_ch1sataz_string As String * 4
Dim Gpgsv_ch1satdb_string As String * 3

Dim Gpgsv_ch2satid_string As String * 3
Dim Gpgsv_ch2satel_string As String * 3
Dim Gpgsv_ch2sataz_string As String * 4
Dim Gpgsv_ch2satdb_string As String * 3

Dim Gpgsv_ch3satid_string As String * 3
Dim Gpgsv_ch3satel_string As String * 3
Dim Gpgsv_ch3sataz_string As String * 4
Dim Gpgsv_ch3satdb_string As String * 3

Dim Gpgsv_ch4satid_string As String * 3
Dim Gpgsv_ch4satel_string As String * 3
Dim Gpgsv_ch4sataz_string As String * 4
Dim Gpgsv_ch4satdb_string As String * 3

Dim Gpgsv_ch5satid_string As String * 3
Dim Gpgsv_ch5satel_string As String * 3
Dim Gpgsv_ch5sataz_string As String * 4
Dim Gpgsv_ch5satdb_string As String * 3

Dim Gpgsv_ch6satid_string As String * 3
Dim Gpgsv_ch6satel_string As String * 3
Dim Gpgsv_ch6sataz_string As String * 4
Dim Gpgsv_ch6satdb_string As String * 3

Dim Gpgsv_ch7satid_string As String * 3
Dim Gpgsv_ch7satel_string As String * 3
Dim Gpgsv_ch7sataz_string As String * 4
Dim Gpgsv_ch7satdb_string As String * 3

Dim Gpgsv_ch8satid_string As String * 3
Dim Gpgsv_ch8satel_string As String * 3
Dim Gpgsv_ch8sataz_string As String * 4
Dim Gpgsv_ch8satdb_string As String * 3

Dim Gpgsv_ch9satid_string As String * 3
Dim Gpgsv_ch9satel_string As String * 3
Dim Gpgsv_ch9sataz_string As String * 4
Dim Gpgsv_ch9satdb_string As String * 3

Dim Gpgsv_ch10satid_string As String * 3
Dim Gpgsv_ch10satel_string As String * 3
Dim Gpgsv_ch10sataz_string As String * 4
Dim Gpgsv_ch10satdb_string As String * 3

Dim Gpgsv_ch11satid_string As String * 3
Dim Gpgsv_ch11satel_string As String * 3
Dim Gpgsv_ch11sataz_string As String * 4
Dim Gpgsv_ch11satdb_string As String * 3

Dim Gpgsv_ch12satid_string As String * 3
Dim Gpgsv_ch12satel_string As String * 3
Dim Gpgsv_ch12sataz_string As String * 4
Dim Gpgsv_ch12satdb_string As String * 3

Dim Td1 As String * 10
Dim Tl1 As String * 10
Dim Gd1 As String * 10
Dim Gl1 As String * 10

Dim Td As Single
Dim Tl As Single

Dim Gd As Single
Dim Gl As Single

Dim Yy As Single
Dim Xx As Single

Dim A2x As String * 30
Dim Z2n As String * 25
Dim Dx As Integer
Dim Dy As Integer
Dim Xxx As Integer
Dim Yyy As Integer
Dim Dxx As Integer
Dim Dyy As Integer
Dim Str1 As String * 1
Dim Str2 As String * 1
Dim Str3 As String * 1
Dim Str4 As String * 1
Dim Str5 As String * 1
Dim Str6 As String * 1
Dim Str7 As String * 1
Dim Str8 As String * 1
Dim Xxxx As Single
Dim Yyyy As Single
Dim Locator As String * 6

Declare Sub Nmea_parse()
Declare Sub Display_general_data()
Declare Sub Display_sat_data()
Declare Sub Maidenhead_calc()
Declare Sub Substract_data()
Declare Sub Display_direction()

Declare Sub Lcdtext(byval S As String , Byval Xoffset As Byte , Byval Yoffset As Byte , Byval Fontset As Byte , Byval Inverse As Byte , Byval Rotation As Byte)
'SYNTAX  Lcdtest String , Xoffset , Yoffset , Fontset , Inverse , Rotation
'
'* Xoffset and Yoffset is in pixels, so you can place text on every spot on the display
'* You determin yourself in the subroutine witch font belongs to the fontset




'Nmea Parsing led
Config Portd.4 = Output
Portd.4 = 0

'Backlight MVC
Config Portc.1 = Output
Portc.1 = 1


Cursor Off

Cursor Noblink


Cls

'Draw welcome message
Showpic 104 , 1 , Globe

Locate 1 , 1 : Lcd "GPS"
Locate 2 , 1 : Lcd "Decoder"
Locate 3 , 1 : Lcd Firmware
Locate 7 , 1 : Lcd "Bjorn"
Locate 8 , 1 : Lcd "Pasteuning"

Waitms 2500

Enable Serial

Goto Satellite_display


'-------------------------------------------------------------------------------
General_display:

   Cls

   Lcdtext "AVR NMEA Decoder - General information " , 1 , 1 , 1 , 1 , 0

   Locate 10 , 1 : Lcd "Used Sats:"
   Locate 10 , 16 : Lcd "Fix:"
   Locate 3 , 1 : Lcd "Latitude :"
   Lcdtext "{127}" , 90 , 16 , 1 , 0 , 0
   Locate 4 , 1 : Lcd "Longitude:"
   Lcdtext "{127}" , 96 , 24 , 1 , 0 , 0
   Locate 5 , 1 : Lcd "Locator  :"
   Locate 6 , 1 : Lcd "UTC Time :"
   Locate 7 , 1 : Lcd "Date     :"
   Locate 8 , 1 : Lcd "Bearing  :"
   Lcdtext "{127}" , 84 , 56 , 1 , 0 , 0
   Locate 8 , 17 : Lcd "[   ]"
   Locate 9 , 1 : Lcd "Speed    :"

   Locate 11 , 1 : Lcd "CH01:"
   Locate 12 , 1 : Lcd "CH02:"
   Locate 13 , 1 : Lcd "CH03:"
   Locate 14 , 1 : Lcd "CH04:"
   Locate 15 , 1 : Lcd "CH05:"
   Locate 16 , 1 : Lcd "CH06:"

   Locate 11 , 11 : Lcd "CH07:"
   Locate 12 , 11 : Lcd "CH08:"
   Locate 13 , 11 : Lcd "CH09:"
   Locate 14 , 11 : Lcd "CH10:"
   Locate 15 , 11 : Lcd "CH11:"
   Locate 16 , 11 : Lcd "CH12:"

Do

   Call Maidenhead_calc()

   Call Substract_data()

   Call Display_general_data()

Loop
'-------------------------------------------------------------------------------


'-------------------------------------------------------------------------------
Satellite_display:

   Cls

   Lcdtext "AVR NMEA Decoder - Satellite info.     " , 1 , 1 , 1 , 1 , 0
   Locate 3 , 1 : Lcd "Chan. ID  EL.  AZ. SNR"
   Locate 5 , 1 : Lcd "CH01:"
   Locate 6 , 1 : Lcd "CH02:"
   Locate 7 , 1 : Lcd "CH03:"
   Locate 8 , 1 : Lcd "CH04:"
   Locate 9 , 1 : Lcd "CH05:"
   Locate 10 , 1 : Lcd "CH06:"
   Locate 11 , 1 : Lcd "CH07:"
   Locate 12 , 1 : Lcd "CH08:"
   Locate 13 , 1 : Lcd "CH09:"
   Locate 14 , 1 : Lcd "CH10:"
   Locate 15 , 1 : Lcd "CH11:"
   Locate 16 , 1 : Lcd "CH12:"

Do

   Call Maidenhead_calc()

   Call Substract_data()

   Call Display_sat_data()

Loop
'-------------------------------------------------------------------------------













'-------------------------------------------------------------------------------
Sub Display_sat_data()

Locate 2 , 1 : Lcd Val(gpgsv_sats_string)

If Val(gpgsv_sats_string) = 11 Then
   Gpgsv_ch12satid_string = "00"
   Gpgsv_ch12satel_string = "00"
   Gpgsv_ch12sataz_string = "000"
   Gpgsv_ch12satdb_string = "00"
   If Val(gpgsv_sats_string) = 10 Then
      Gpgsv_ch11satid_string = "00"
      Gpgsv_ch11satel_string = "00"
      Gpgsv_ch11sataz_string = "000"
      Gpgsv_ch11satdb_string = "00"
      If Val(gpgsv_sats_string) = 9 Then
         Gpgsv_ch10satid_string = "00"
         Gpgsv_ch10satel_string = "00"
         Gpgsv_ch10sataz_string = "000"
         Gpgsv_ch10satdb_string = "00"
         If Val(gpgsv_sats_string) = 8 Then
            Gpgsv_ch9satid_string = "00"
            Gpgsv_ch9satel_string = "00"
            Gpgsv_ch9sataz_string = "000"
            Gpgsv_ch9satdb_string = "00"
            If Val(gpgsv_sats_string) = 7 Then
               Gpgsv_ch8satid_string = "00"
               Gpgsv_ch8satel_string = "00"
               Gpgsv_ch8sataz_string = "000"
               Gpgsv_ch8satdb_string = "00"
               If Val(gpgsv_sats_string) = 6 Then
                  Gpgsv_ch7satid_string = "00"
                  Gpgsv_ch7satel_string = "00"
                  Gpgsv_ch7sataz_string = "000"
                  Gpgsv_ch7satdb_string = "00"
                  If Val(gpgsv_sats_string) = 5 Then
                     Gpgsv_ch6satid_string = "00"
                     Gpgsv_ch6satel_string = "00"
                     Gpgsv_ch6sataz_string = "000"
                     Gpgsv_ch6satdb_string = "00"
                     If Val(gpgsv_sats_string) = 4 Then
                        Gpgsv_ch5satid_string = "00"
                        Gpgsv_ch5satel_string = "00"
                        Gpgsv_ch5sataz_string = "000"
                        Gpgsv_ch5satdb_string = "00"
                        If Val(gpgsv_sats_string) = 3 Then
                           Gpgsv_ch4satid_string = "00"
                           Gpgsv_ch4satel_string = "00"
                           Gpgsv_ch4sataz_string = "000"
                           Gpgsv_ch4satdb_string = "00"
                           If Val(gpgsv_sats_string) = 2 Then
                              Gpgsv_ch3satid_string = "00"
                              Gpgsv_ch3satel_string = "00"
                              Gpgsv_ch3sataz_string = "000"
                              Gpgsv_ch3satdb_string = "00"
                              If Val(gpgsv_sats_string) = 1 Then
                                 Gpgsv_ch2satid_string = "00"
                                 Gpgsv_ch2satel_string = "00"
                                 Gpgsv_ch2sataz_string = "000"
                                 Gpgsv_ch2satdb_string = "00"
                                 If Val(gpgsv_sats_string) = 0 Then
                                    Gpgsv_ch1satid_string = "00"
                                    Gpgsv_ch1satel_string = "00"
                                    Gpgsv_ch1sataz_string = "000"
                                    Gpgsv_ch1satdb_string = "00"
                                 End If
                              End If
                           End If
                        End If
                     End If
                  End If
               End If
            End If
         End If
      End If
   End If
End If

Locate 5 , 7 : Lcd Gpgsv_ch1satid_string ; ", " ; Gpgsv_ch1satel_string ; ", " ; Gpgsv_ch1sataz_string ; ", " ; Gpgsv_ch1satdb_string
Locate 6 , 7 : Lcd Gpgsv_ch2satid_string ; ", " ; Gpgsv_ch2satel_string ; ", " ; Gpgsv_ch2sataz_string ; ", " ; Gpgsv_ch2satdb_string
Locate 7 , 7 : Lcd Gpgsv_ch3satid_string ; ", " ; Gpgsv_ch3satel_string ; ", " ; Gpgsv_ch3sataz_string ; ", " ; Gpgsv_ch3satdb_string
Locate 8 , 7 : Lcd Gpgsv_ch4satid_string ; ", " ; Gpgsv_ch4satel_string ; ", " ; Gpgsv_ch4sataz_string ; ", " ; Gpgsv_ch4satdb_string
Locate 9 , 7 : Lcd Gpgsv_ch5satid_string ; ", " ; Gpgsv_ch5satel_string ; ", " ; Gpgsv_ch5sataz_string ; ", " ; Gpgsv_ch5satdb_string
Locate 10 , 7 : Lcd Gpgsv_ch6satid_string ; ", " ; Gpgsv_ch6satel_string ; ", " ; Gpgsv_ch6sataz_string ; ", " ; Gpgsv_ch6satdb_string
Locate 11 , 7 : Lcd Gpgsv_ch7satid_string ; ", " ; Gpgsv_ch7satel_string ; ", " ; Gpgsv_ch7sataz_string ; ", " ; Gpgsv_ch7satdb_string
Locate 12 , 7 : Lcd Gpgsv_ch8satid_string ; ", " ; Gpgsv_ch8satel_string ; ", " ; Gpgsv_ch8sataz_string ; ", " ; Gpgsv_ch8satdb_string
Locate 13 , 7 : Lcd Gpgsv_ch9satid_string ; ", " ; Gpgsv_ch9satel_string ; ", " ; Gpgsv_ch9sataz_string ; ", " ; Gpgsv_ch9satdb_string
Locate 14 , 7 : Lcd Gpgsv_ch10satid_string ; ", " ; Gpgsv_ch10satel_string ; ", " ; Gpgsv_ch10sataz_string ; ", " ; Gpgsv_ch10satdb_string
Locate 15 , 7 : Lcd Gpgsv_ch11satid_string ; ", " ; Gpgsv_ch11satel_string ; ", " ; Gpgsv_ch11sataz_string ; ", " ; Gpgsv_ch11satdb_string
Locate 16 , 7 : Lcd Gpgsv_ch12satid_string ; ", " ; Gpgsv_ch12satel_string ; ", " ; Gpgsv_ch12sataz_string ; ", " ; Gpgsv_ch12satdb_string

End Sub
'-------------------------------------------------------------------------------



'-------------------------------------------------------------------------------
Sub Display_general_data()

   Locate 10 , 12 : Lcd Gpgga_sats_string



   If Gpgsa_mode2 = 0 Then
      Locate 10 , 21 : Lcd "No"
      Elseif Gpgsa_mode2 = 1 Then
         Locate 10 , 21 : Lcd "2D"
         Elseif Gpgsa_mode2 = 3 Then
            Locate 10 , 21 : Lcd "3D"
   End If

   Locate 3 , 12 : Lcd Gprmc_ns_string ; " " ; Gprmc_lathr_string ; " " ; Gprmc_latmin_string ; "." ; Gprmc_latsec_string ; "'" ; Gprmc_latssec_string
   Locate 4 , 12 : Lcd Gprmc_ew_string ; " " ; Gprmc_lonhr_string ; " " ; Gprmc_lonmin_string ; "." ; Gprmc_lonsec_string ; "'" ; Gprmc_lonssec_string
   Locate 5 , 12 : Lcd Str1 ; Str2 ; Str3 ; Str4 ; Str5 ; Str6
   Locate 6 , 12 : Lcd Gprmc_utchr_string ; ":" ; Gprmc_utcmin_string ; ":" ; Gprmc_utcsec_string
   Locate 7 , 12 : Lcd Gprmc_dateday_string ; "/" ; Gprmc_datemonth_string ; "/" ; Gprmc_dateyear

   If Gprmc_course < 10 Then
      Locate 8 , 12 : Lcd "00" ; Gprmc_course
      Elseif Gprmc_course < 100 Then
         Locate 8 , 12 : Lcd "0" ; Gprmc_course
      Else
         Locate 8 , 12 : Lcd Gprmc_course
   End If

   Call Display_direction()

   If Gprmc_speed < 10 Then
      Locate 9 , 12 : Lcd "00" ; Gprmc_speed ; " Km/h"
      Elseif Gprmc_speed < 100 Then
         Locate 9 , 12 : Lcd "0" ; Gprmc_speed ; " Km/h"
      Else
         Locate 9 , 12 : Lcd Gprmc_speed ; " Km/h"
   End If

   Locate 11 , 7 : Lcd Gpgsa_sat1_string
   Locate 12 , 7 : Lcd Gpgsa_sat2_string
   Locate 13 , 7 : Lcd Gpgsa_sat3_string
   Locate 14 , 7 : Lcd Gpgsa_sat4_string
   Locate 15 , 7 : Lcd Gpgsa_sat5_string
   Locate 16 , 7 : Lcd Gpgsa_sat6_string
   Locate 11 , 17 : Lcd Gpgsa_sat7_string
   Locate 12 , 17 : Lcd Gpgsa_sat8_string
   Locate 13 , 17 : Lcd Gpgsa_sat9_string
   Locate 14 , 17 : Lcd Gpgsa_sat10_string
   Locate 15 , 17 : Lcd Gpgsa_sat11_string
   Locate 16 , 17 : Lcd Gpgsa_sat12_string


   Lcdtext Locator , 147 , 114 , 2 , 0 , 0

End Sub
'-------------------------------------------------------------------------------

'------------------------------------------------------------------------------
Sub Display_direction

      If Gprmc_course => 0 And Gprmc_course < 12 Or Gprmc_course => 349 And Gprmc_course <= 360 Then
         Locate 8 , 18 : Lcd " N "
      Elseif Gprmc_course => 12 And Gprmc_course < 34 Then
         Locate 8 , 18 : Lcd "NNE"
      Elseif Gprmc_course => 34 And Gprmc_course < 56 Then
         Locate 8 , 18 : Lcd " NE"
      Elseif Gprmc_course => 56 And Gprmc_course < 79 Then
         Locate 8 , 18 : Lcd "ENE"
      Elseif Gprmc_course => 79 And Gprmc_course < 101 Then
         Locate 8 , 18 : Lcd " E "
      Elseif Gprmc_course => 101 And Gprmc_course < 124 Then
         Locate 8 , 18 : Lcd "ESE"
      Elseif Gprmc_course => 124 And Gprmc_course < 146 Then
         Locate 8 , 18 : Lcd " SE"
      Elseif Gprmc_course => 146 And Gprmc_course < 169 Then
         Locate 8 , 18 : Lcd "SSE"
      Elseif Gprmc_course => 169 And Gprmc_course < 191 Then
         Locate 8 , 18 : Lcd " S "
      Elseif Gprmc_course => 191 And Gprmc_course < 214 Then
         Locate 8 , 18 : Lcd "SSW"
      Elseif Gprmc_course => 214 And Gprmc_course < 236 Then
         Locate 8 , 18 : Lcd " SW"
      Elseif Gprmc_course => 236 And Gprmc_course < 259 Then
         Locate 8 , 18 : Lcd "WSW"
      Elseif Gprmc_course => 259 And Gprmc_course < 281 Then
         Locate 8 , 18 : Lcd " W "
      Elseif Gprmc_course => 281 And Gprmc_course < 304 Then
         Locate 8 , 18 : Lcd "WNW"
      Elseif Gprmc_course => 304 And Gprmc_course < 326 Then
         Locate 8 , 18 : Lcd " NW"
      Elseif Gprmc_course => 326 And Gprmc_course < 349 Then
         Locate 8 , 18 : Lcd "NNW"
      End If

End Sub


'-------------------------------------------------------------------------------
Sub Substract_data()

   Gprmc_lat_string = Left(gprmc_lat_string , 9)
   Gprmc_lon_string = Left(gprmc_lon_string , 10)

   Gprmc_lathr_string = Left(gprmc_lat_string , 2)
   Gprmc_latmin_string = Mid(gprmc_lat_string , 3 , 2)
   Gprmc_latsec_string = Mid(gprmc_lat_string , 6 , 2)
   Gprmc_latssec_string = Mid(gprmc_lat_string , 8 , 2)

   Gprmc_lonhr_string = Left(gprmc_lon_string , 3)
   Gprmc_lonmin_string = Mid(gprmc_lon_string , 4 , 2)
   Gprmc_lonsec_string = Mid(gprmc_lon_string , 7 , 2)
   Gprmc_lonssec_string = Mid(gprmc_lon_string , 9 , 2)

   Gprmc_dateday_string = Left(gprmc_date_string , 2)
   Gprmc_datemonth_string = Mid(gprmc_date_string , 3 , 2)
   Gprmc_dateyear_string = Mid(gprmc_date_string , 5 , 2)
   Gprmc_dateyear = Val(gprmc_dateyear_string) + 2000

   Gprmc_utchr_string = Left(gprmc_utc_string , 2)
   Gprmc_utcmin_string = Mid(gprmc_utc_string , 3 , 2)
   Gprmc_utcsec_string = Mid(gprmc_utc_string , 5 , 2)

   Gprmc_speed = Val(gprmc_speed_string)
   Gprmc_speed = Gprmc_speed * 1.852

   Gprmc_course = Val(gprmc_course_string)

   Gpgga_posfix = Val(gpgga_posfix_string)

   Gpgsa_mode2 = Val(gpgsa_mode2_string)

   If Gpgsa_sat1_string = "" Then Gpgsa_sat1_string = "--"
   If Gpgsa_sat2_string = "" Then Gpgsa_sat2_string = "--"
   If Gpgsa_sat3_string = "" Then Gpgsa_sat3_string = "--"
   If Gpgsa_sat4_string = "" Then Gpgsa_sat4_string = "--"
   If Gpgsa_sat5_string = "" Then Gpgsa_sat5_string = "--"
   If Gpgsa_sat6_string = "" Then Gpgsa_sat6_string = "--"
   If Gpgsa_sat7_string = "" Then Gpgsa_sat7_string = "--"
   If Gpgsa_sat8_string = "" Then Gpgsa_sat8_string = "--"
   If Gpgsa_sat9_string = "" Then Gpgsa_sat9_string = "--"
   If Gpgsa_sat10_string = "" Then Gpgsa_sat10_string = "--"
   If Gpgsa_sat11_string = "" Then Gpgsa_sat11_string = "--"
   If Gpgsa_sat12_string = "" Then Gpgsa_sat12_string = "--"


End Sub
'-------------------------------------------------------------------------------





'-------------------------------------------------------------------------------
Sub Maidenhead_calc()

   Td1 = Mid(gprmc_lat_string , 1 , 2)
   Tl1 = Mid(gprmc_lat_string , 3 , 5)
   Gd1 = Mid(gprmc_lon_string , 1 , 3)
   Gl1 = Mid(gprmc_lon_string , 4 , 5)

   Td = Val(td1)
   Tl = Val(tl1)
   Gd = Val(gd1)
   Gl = Val(gl1)

   Tl = Tl / 60
   Yy = Td + Tl

   Gl = Gl / 60
   Xx = Gd + Gl

   If Gprmc_ns_string = "S" Then Td = -td
   If Gprmc_ew_string = "W" Then Gd = -gd

   'Maidenheadberechnung

   A2x = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
   Z2n = "01234567890123456789"

   If Xx < -179.99 Or Xx > 179.99 Then End
   If Yy < -89.99 Or Yy > 89.99 Then End

   Xx = Xx + 180
   Yy = Yy + 90

   Xxx = Xx
   Yyy = Yy

   Dx = Xxx / 20
   Dy = Yyy / 10

   Dxx = Dx + 1
   Dyy = Dy + 1

   Str1 = Mid(a2x , Dxx , 1)
   Str2 = Mid(a2x , Dyy , 1)

   Xxx = Dx * 20
   Yyy = Dy * 10

   Xx = Xx - Xxx
   Yy = Yy - Yyy

   Xxxx = Xx * 100
   Yyyy = Yy * 100

   Dx = Xxxx / 200
   Dy = Yyyy / 100

   Dxx = Dx + 1
   Dyy = Dy + 1

   Str3 = Mid(z2n , Dxx , 1)
   Str4 = Mid(z2n , Dyy , 1)

   Dxx = Dx * 2
   Dyy = Dy * 1

   Xx = Xx - Dxx
   Yy = Yy - Dyy

   Xxxx = Xx * 1000
   Yyyy = Yy * 1000

   Xxx = Xxxx
   Yyy = Yyyy

   Xxxx = Xxx / 83.333333
   Yyyy = Yyy / 41.666666

   Dx = Xxxx
   Dy = Yyyy

   Dxx = Dx + 1
   Dyy = Dy + 1

   Str5 = Mid(a2x , Dxx , 1)
   Str6 = Mid(a2x , Dyy , 1)

   Xxxx = Dx * 0.08333333
   Yyyy = Dy * 0.04166666

   Xx = Xx - Xxxx
   Yy = Yy - Yyyy

   Xxxx = Xx * 10000
   Yyyy = Yy * 10000

   Dx = Xxxx / 83.33333
   Dy = Yyyy / 41.66666

   Dxx = Dx + 1
   Dyy = Dy + 1

   Str7 = Mid(z2n , Dxx , 1)
   Str8 = Mid(z2n , Dyy , 1)

   Locator = Str1 + Str2 + Str3 + Str4 + Str5 + Str6


End Sub
'-------------------------------------------------------------------------------

'-------------------------------------------------------------------------------
Sub Lcdtext(byval S As String , Xoffset As Byte , Yoffset As Byte , Fontset As Byte , Inverse As Byte , Rotation As Byte)
Local Tempstring As String * 1 , Temp As Byte               'Dim local the variables
Local A As Byte , Pixels As Byte , Count As Byte , Carcount As Byte , Lus As Byte
Local Row As Byte , Byteseach As Byte , Blocksize As Byte , Dummy As Byte
Local Colums As Byte , Columcount As Byte , Rowcount As Byte , Stringsize As Byte
Local Xpos As Byte , Ypos As Byte , Pixel As Byte , Pixelcount As Byte
If Inverse > 1 Then Inverse = 0                             'Inverse can't be greater then 1
If Rotation > 3 Then Rotation = 0                           'There are only 4 rotation's
Stringsize = Len(s) - 1                                     'Size of the text string -1 because we must start with 0
For Carcount = 0 To Stringsize                              'Loop for the numbers of caracters that must be displayed


If Fontset = 2 Then Restore Font16x16
If Fontset = 1 Then Restore Font6x8

Temp = Carcount + 1                                        'Cut the text string in seperate caracters
Tempstring = Mid(s , Temp , 1)
Read Row : Read Byteseach : Read Blocksize : Read Dummy     'Read the first 4 bytes from the font file
Temp = Asc(tempstring) - 32                                 'Font files start with caracter 32
For Lus = 1 To Temp                                         'Do dummie read to point to the correct line in the fontfile
   For Count = 1 To Blocksize
    Read Pixels
   Next Count
Next Lus
Colums = Blocksize / Row                                    'Calculate the numbers of colums
Row = Row * 8                                               'Row is always 8 pixels high = 1 byte, so working with row in steps of 8.
Row = Row - 1                                               'Want to start with row=0 instead of 1
Colums = Colums - 1                                         'Same for the colums
Select Case Rotation
    Case 0                                                  '0 degrees rotation
            For Rowcount = 0 To Row Step 8                  'Loop for numbers of rows
                  A = Rowcount + Yoffset
                  For Columcount = 0 To Colums              'Loop for numbers of Colums
                      Read Pixels : If Inverse = 1 Then Toggle Pixels       'Read the byte from the file and if inverse = true then invert de byte
                      Xpos = Columcount                     'Do some calculation to get the caracter on the correct Xposition
                      Temp = Carcount * Byteseach
                      Xpos = Xpos + Temp
                      Xpos = Xpos + Xoffset
                          For Pixelcount = 0 To 7           'Loop for 8 pixels to be set or not
                             Ypos = A + Pixelcount          'Each pixel on his own spot
                             Pixel = Pixels.0               'Set the pixel (or not)
                             Pset Xpos , Ypos , Pixel       'Finaly we can set the pixel
                             Shift Pixels , Right           'Shift the byte 1 bit to the right so the next pixel comes availible
                          Next Pixel
                  Next Columcount
            Next Rowcount
    Case 1                                                  '90 degrees rotation
            For Rowcount = Row To 0 Step -8                 'Loop is now counting down
                  A = Rowcount + Xoffset
                  A = A - 15                                'Correction to set Xpos on Xoffset with rotation
                  For Columcount = 0 To Colums
                      Read Pixels : If Inverse = 1 Then Toggle Pixels
                      Xpos = Columcount
                      Temp = Carcount * Byteseach
                      Xpos = Xpos + Temp
                      Xpos = Xpos + Yoffset                 'We want that Xoffset is still Xoffset, so we need here the change from x to y
                             For Pixelcount = 7 To 0 Step -1
                                Ypos = A + Pixelcount
                                Pixel = Pixels.0
                                Pset Ypos , Xpos , Pixel
                                Shift Pixels , Right
                             Next Pixel
                  Next Columcount
            Next Rowcount
    Case 2                                                  '180 degrees rotation
            For Rowcount = Row To 0 Step -8
                  A = Rowcount + Yoffset
                  A = A - 7                                 'Correction to set Xpos on Xoffset with rotation
                  For Columcount = Colums To 0 Step -1
                      Read Pixels : If Inverse = 1 Then Toggle Pixels
                      Xpos = Columcount
                      Temp = Carcount * Byteseach
                      Xpos = Xpos - Temp
                      Xpos = Xpos - 8                       'Correction to set Xpos on Xoffset with rotation
                      Xpos = Xpos + Xoffset
                          For Pixelcount = 7 To 0 Step -1
                             Ypos = A + Pixelcount
                             Pixel = Pixels.0
                             Pset Xpos , Ypos , Pixel
                             Shift Pixels , Right
                          Next Pixel
                  Next Columcount
            Next Rowcount
    Case 3                                                  '270 degrees rotation
            For Rowcount = 0 To Row Step 8
                  A = Rowcount + Xoffset
                    For Columcount = Colums To 0 Step -1
                      Read Pixels : If Inverse = 1 Then Toggle Pixels
                      Xpos = Columcount
                      Temp = Carcount * Byteseach
                      Xpos = Xpos - Temp
                      Xpos = Xpos - 8                       'Correction to set Xpos on Xoffset with rotation
                      Xpos = Xpos + Yoffset
                             For Pixelcount = 0 To 7
                                Ypos = A + Pixelcount
                                Pixel = Pixels.0
                                Pset Ypos , Xpos , Pixel
                                Shift Pixels , Right
                             Next Pixel
                  Next Columcount
            Next Rowcount
End Select
Next Carcount
End Sub                                                     'End of this amazing subroutine
'-------------------------------------------------------------------------------




$include "Font16x16.font"                                   'If you don't need the files in your program, don't include them,
$include "Font6x8.font"








Rs232_isr:

Buffer = Ischarwaiting()

   If Buffer = 1 Then                                       'we got something
      Buffer = Waitkey()                                    'get it


      If Buffer = "$" Then

         Buffer_str = ""

         Do
            Buffer = Waitkey()
            Buffer_str = Buffer_str + Chr(buffer)
         Loop Until Buffer = ","

         Sentence_header = Buffer_str

         If Sentence_header = "GPGSA," Then

         Portd.4 = 1

' $GPGSA,A,3,07,02,26,27,09,04,15,,,,,1.8,1.0,1.5*33
'    |   | |  |  |  |  |  |  |  |   |  |   |   |   |______________________ Checksum
'    |   | |  |  |  |  |  |  |  |   |  |   |   |__________________________ Vertical Dilution of Precision          : For example 1.5
'    |   | |  |  |  |  |  |  |  |   |  |   |______________________________ Horizontal Dilution of Precision        : For example 1.0
'    |   | |  |  |  |  |  |  |  |   |  |__________________________________ Position Dilution of Precision          : For example 1.8
'    |   | |  |  |  |  |  |  |  |   |_____________________________________ Sat Channels 8....12
'    |   | |  |  |  |  |  |  |  |_________________________________________ Sat Channel 7                           : For example Sat 15 used on channel 7
'    |   | |  |  |  |  |  |  |____________________________________________ Sat Channel 6                           : For example Sat 04 used on channel 6
'    |   | |  |  |  |  |  |_______________________________________________ Sat Channel 5                           : For example Sat 09 used on channel 5
'    |   | |  |  |  |  |__________________________________________________ Sat Channel 4                           : For example Sat 27 used on channel 4
'    |   | |  |  |  |_____________________________________________________ Sat Channel 3                           : For example Sat 26 used on channel 3
'    |   | |  |  |________________________________________________________ Sat Channel 2                           : For example Sat 02 used on channel 2
'    |   | |  |___________________________________________________________ Sat Channel 1                           : For example Sat 07 used on channel 1
'    |   | |______________________________________________________________ Mode 2                                  : For example 1= No Fix, 2= 2D Fix, 3= 3D Fix
'    |   |________________________________________________________________ Mode 1                                  : For example M=Manual, A=2D Automatic
'    |____________________________________________________________________ Message header ($GP)                    : For example ($GP)GSA = GNSS DOP and Active Satellites

            Call Nmea_parse()

            Gpgsa_mode1_string = Buffer_str
            Length = Len(gpgsa_mode1_string) - 1
            Gpgsa_mode1_string = Left(gpgsa_mode1_string , Length)

            Call Nmea_parse()

            Gpgsa_mode2_string = Buffer_str
            Length = Len(gpgsa_mode2_string) - 1
            Gpgsa_mode2_string = Left(gpgsa_mode2_string , Length)

            Call Nmea_parse()

            Gpgsa_sat1_string = Buffer_str
            Length = Len(gpgsa_sat1_string) - 1
            Gpgsa_sat1_string = Left(gpgsa_sat1_string , Length)

            Call Nmea_parse()

            Gpgsa_sat2_string = Buffer_str
            Length = Len(gpgsa_sat2_string) - 1
            Gpgsa_sat2_string = Left(gpgsa_sat2_string , Length)

            Call Nmea_parse()

            Gpgsa_sat3_string = Buffer_str
            Length = Len(gpgsa_sat3_string) - 1
            Gpgsa_sat3_string = Left(gpgsa_sat3_string , Length)

            Call Nmea_parse()

            Gpgsa_sat4_string = Buffer_str
            Length = Len(gpgsa_sat4_string) - 1
            Gpgsa_sat4_string = Left(gpgsa_sat4_string , Length)

            Call Nmea_parse()

            Gpgsa_sat5_string = Buffer_str
            Length = Len(gpgsa_sat5_string) - 1
            Gpgsa_sat5_string = Left(gpgsa_sat5_string , Length)

            Call Nmea_parse()

            Gpgsa_sat6_string = Buffer_str
            Length = Len(gpgsa_sat6_string) - 1
            Gpgsa_sat6_string = Left(gpgsa_sat6_string , Length)

            Call Nmea_parse()

            Gpgsa_sat7_string = Buffer_str
            Length = Len(gpgsa_sat7_string) - 1
            Gpgsa_sat7_string = Left(gpgsa_sat7_string , Length)

            Call Nmea_parse()

            Gpgsa_sat8_string = Buffer_str
            Length = Len(gpgsa_sat8_string) - 1
            Gpgsa_sat8_string = Left(gpgsa_sat8_string , Length)

            Call Nmea_parse()

            Gpgsa_sat9_string = Buffer_str
            Length = Len(gpgsa_sat9_string) - 1
            Gpgsa_sat9_string = Left(gpgsa_sat9_string , Length)

            Call Nmea_parse()

            Gpgsa_sat10_string = Buffer_str
            Length = Len(gpgsa_sat10_string) - 1
            Gpgsa_sat10_string = Left(gpgsa_sat10_string , Length)

            Call Nmea_parse()

            Gpgsa_sat11_string = Buffer_str
            Length = Len(gpgsa_sat11_string) - 1
            Gpgsa_sat11_string = Left(gpgsa_sat11_string , Length)

            Call Nmea_parse()

            Gpgsa_sat12_string = Buffer_str
            Length = Len(gpgsa_sat12_string) - 1
            Gpgsa_sat12_string = Left(gpgsa_sat12_string , Length)

            Portd.4 = 0

         End If

         If Sentence_header = "GPGGA," Then

         Portd.4 = 1

' $GPCGA,hhmmsss.ss,llll.ll,a,yyyyy.yy,a,1,07,a.a,b.b,M,c.c,M,d.d,0000*hh
'    |       |         |    |    |     | |  |  |   |  |  |  |  |   |    |_ Checksum
'    |       |         |    |    |     | |  |  |   |  |  |  |  |   |______ Diff. Ref. Station ID
'    |       |         |    |    |     | |  |  |   |  |  |  |  |__________ Age of Diff. Correction, second, Null fields when DGPS is not used
'    |       |         |    |    |     | |  |  |   |  |  |  |_____________ Units, M, meters                        : For example M
'    |       |         |    |    |     | |  |  |   |  |  |________________ Geoid Separation, meters                : For example 9.0
'    |       |         |    |    |     | |  |  |   |  |___________________ Units, M, meters                        : For example M
'    |       |         |    |    |     | |  |  |   |______________________ MSL Altitude, meters                    : For example 9.0
'    |       |         |    |    |     | |  |  |__________________________ Horizontal dillusion of precisin        : For example 1.0
'    |       |         |    |    |     | |  |_____________________________ Satellites Used                         : For example 07
'    |       |         |    |    |     | |________________________________ Position Fix Indicator                  : For example 0=Fix not available or invalid, 1=GPS SPS Mode, fix valid, 2=Differential GPS, SPS Mode, fix valid, 3-5= not supported, 6=Dead Reckoning Mode, fix valid
'    |       |         |    |    |     |__________________________________ East/West indicator                     : For example E or W
'    |       |         |    |    |________________________________________ Longtitude, dddmm.mmmm                  : For example 00505.0505 (005.05.0505)
'    |       |         |    |_____________________________________________ North/South indicator                   : For example N or S
'    |       |         |__________________________________________________ Latitude indicator                      : For example 5239.1920 (52.39.1920)
'    |       |____________________________________________________________ Time, Hours,Minutes,Seconds,Subseconds  : For example 180442.453
'    |____________________________________________________________________ Message header ($GP)                    : For example ($GP)CGA = Global Positioning System Fixed Data

            Call Nmea_parse()

            Gpgga_utc_string = Buffer_str
            Length = Len(gpgga_utc_string) - 1
            Gpgga_utc_string = Left(gpgga_utc_string , Length)

            Call Nmea_parse()

            Gpgga_lat_string = Buffer_str
            Length = Len(gpgga_lat_string) - 1
            Gpgga_lat_string = Left(gpgga_lat_string , Length)

            Call Nmea_parse()

            Gpgga_ns_string = Buffer_str
            Length = Len(gpgga_ns_string) - 1
            Gpgga_ns_string = Left(gpgga_ns_string , Length)

            Call Nmea_parse()

            Gpgga_lon_string = Buffer_str
            Length = Len(gpgga_lon_string) - 1
            Gpgga_lon_string = Left(gpgga_lon_string , Length)

            Call Nmea_parse()

            Gpgga_ew_string = Buffer_str
            Length = Len(gpgga_ew_string) - 1
            Gpgga_ew_string = Left(gpgga_ew_string , Length)

            Call Nmea_parse()

            Gpgga_posfix_string = Buffer_str
            Length = Len(gpgga_posfix_string) - 1
            Gpgga_posfix_string = Left(gpgga_posfix_string , Length)

            Call Nmea_parse()

            Gpgga_sats_string = Buffer_str
            Length = Len(gpgga_sats_string) - 1
            Gpgga_sats_string = Left(gpgga_sats_string , Length)

            Portd.4 = 0

         End If


         If Sentence_header = "GPRMC," Then

         Portd.4 = 1

' $GPRMC,hhmmsss.ss,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,ddmmyy,x.x,a*hh
'    |       |      |    |    |    |     |  |   |     |    |  |  |_ Checksum
'    |       |      |    |    |    |     |  |   |     |    |  |____ E or W
'    |       |      |    |    |    |     |  |   |     |    |_______ Magnetic variation, Degrees             : For example 156.4
'    |       |      |    |    |    |     |  |   |     |____________ Date, day,month,year                    : For example 150496(15 april 1996)
'    |       |      |    |    |    |     |  |   |__________________ Course over ground, degrees             : For example 340.5
'    |       |      |    |    |    |     |  |______________________ Speed over ground, knots                : For example 0.13
'    |       |      |    |    |    |     |_________________________ East/West indicator                     : For example E or W
'    |       |      |    |    |    |_______________________________ Longtitude, dddmm.mmmm                  : For example 00505.0505 (005.05.0505)
'    |       |      |    |    |____________________________________ North/South indicator                   : For example N or S
'    |       |      |    |_________________________________________ Latitude indicator                      : For example 5239.1920 (52.39.1920)
'    |       |      |______________________________________________ Data Validation indicator               : For example A=Data valid, V=Data invalid
'    |       |_____________________________________________________ Time, Hours,Minutes,Seconds,Subseconds  : For example 180442.453
'    |_____________________________________________________________ Message header ($GP)                    : For example ($GP)RMC = Recommended Minimum Specific GNSS Data

            Call Nmea_parse()

            Gprmc_utc_string = Buffer_str
            Length = Len(gprmc_utc_string) - 1
            Gprmc_utc_string = Left(gprmc_utc_string , Length)

            Call Nmea_parse()

            Gprmc_status_string = Buffer_str
            Length = Len(gprmc_status_string) - 1
            Gprmc_status_string = Left(gprmc_status_string , Length)

            Call Nmea_parse()

            Gprmc_lat_string = Buffer_str
            Length = Len(gprmc_lat_string) - 1
            Gprmc_lat_string = Left(gprmc_lat_string , Length)

            Call Nmea_parse()

            Gprmc_ns_string = Buffer_str
            Length = Len(gprmc_ns_string) - 1
            Gprmc_ns_string = Left(gprmc_ns_string , Length)

            Call Nmea_parse()

            Gprmc_lon_string = Buffer_str
            Length = Len(gprmc_lon_string) - 1
            Gprmc_lon_string = Left(gprmc_lon_string , Length)

            Call Nmea_parse()

            Gprmc_ew_string = Buffer_str
            Length = Len(gprmc_ew_string) - 1
            Gprmc_ew_string = Left(gprmc_ew_string , Length)

            Call Nmea_parse()

            Gprmc_speed_string = Buffer_str
            Length = Len(gprmc_speed_string) - 1
            Gprmc_speed_string = Left(gprmc_speed_string , Length)

            Call Nmea_parse()

            Gprmc_course_string = Buffer_str
            Length = Len(gprmc_course_string) - 1
            Gprmc_course_string = Left(gprmc_course_string , Length)

            Call Nmea_parse()

            Gprmc_date_string = Buffer_str
            Length = Len(gprmc_date_string) - 1
            Gprmc_date_string = Left(gprmc_date_string , Length)

            Portd.4 = 0

         End If
         '----------------------------------------------------------------------

         If Sentence_header = "GPGSV," Then

            Portd.4 = 1

            Call Nmea_parse()

            Gpgsv_totalmessages_string = Buffer_str
            Length = Len(gpgsv_totalmessages_string) - 1
            Gpgsv_totalmessages_string = Left(gpgsv_totalmessages_string , Length)

            Total_messages = Val(gpgsv_totalmessages_string)

            Call Nmea_parse()

            Gpgsv_currentmessage_string = Buffer_str
            Length = Len(gpgsv_currentmessage_string) - 1
            Gpgsv_currentmessage_string = Left(gpgsv_currentmessage_string , Length)

            Current_message = Val(gpgsv_currentmessage_string)

            Call Nmea_parse()

            Gpgsv_sats_string = Buffer_str
            Length = Len(gpgsv_sats_string) - 1
            Gpgsv_sats_string = Left(gpgsv_sats_string , Length)

            If Current_message = 1 Then

               If Val(gpgsv_sats_string) > 0 Then

                  Call Nmea_parse()

                  Gpgsv_ch1satid_string = Buffer_str
                  Length = Len(gpgsv_ch1satid_string) - 1
                  Gpgsv_ch1satid_string = Left(gpgsv_ch1satid_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch1satel_string = Buffer_str
                  Length = Len(gpgsv_ch1satel_string) - 1
                  Gpgsv_ch1satel_string = Left(gpgsv_ch1satel_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch1sataz_string = Buffer_str
                  Length = Len(gpgsv_ch1sataz_string) - 1
                  Gpgsv_ch1sataz_string = Left(gpgsv_ch1sataz_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch1satdb_string = Buffer_str
                  Length = Len(gpgsv_ch1satdb_string) - 1
                  Gpgsv_ch1satdb_string = Left(gpgsv_ch1satdb_string , Length)

               End If

               If Val(gpgsv_sats_string) > 1 Then

                  Call Nmea_parse()

                  Gpgsv_ch2satid_string = Buffer_str
                  Length = Len(gpgsv_ch2satid_string) - 1
                  Gpgsv_ch2satid_string = Left(gpgsv_ch2satid_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch2satel_string = Buffer_str
                  Length = Len(gpgsv_ch2satel_string) - 1
                  Gpgsv_ch2satel_string = Left(gpgsv_ch2satel_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch2sataz_string = Buffer_str
                  Length = Len(gpgsv_ch2sataz_string) - 1
                  Gpgsv_ch2sataz_string = Left(gpgsv_ch2sataz_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch2satdb_string = Buffer_str
                  Length = Len(gpgsv_ch2satdb_string) - 1
                  Gpgsv_ch2satdb_string = Left(gpgsv_ch2satdb_string , Length)

                  Call Nmea_parse()

               End If

               If Val(gpgsv_sats_string) > 2 Then

                  Gpgsv_ch3satid_string = Buffer_str
                  Length = Len(gpgsv_ch3satid_string) - 1
                  Gpgsv_ch3satid_string = Left(gpgsv_ch3satid_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch3satel_string = Buffer_str
                  Length = Len(gpgsv_ch3satel_string) - 1
                  Gpgsv_ch3satel_string = Left(gpgsv_ch3satel_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch3sataz_string = Buffer_str
                  Length = Len(gpgsv_ch3sataz_string) - 1
                  Gpgsv_ch3sataz_string = Left(gpgsv_ch3sataz_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch3satdb_string = Buffer_str
                  Length = Len(gpgsv_ch3satdb_string) - 1
                  Gpgsv_ch3satdb_string = Left(gpgsv_ch3satdb_string , Length)

                  Call Nmea_parse()

               End If

               If Val(gpgsv_sats_string) > 3 Then

                  Gpgsv_ch4satid_string = Buffer_str
                  Length = Len(gpgsv_ch4satid_string) - 1
                  Gpgsv_ch4satid_string = Left(gpgsv_ch4satid_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch4satel_string = Buffer_str
                  Length = Len(gpgsv_ch4satel_string) - 1
                  Gpgsv_ch4satel_string = Left(gpgsv_ch4satel_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch4sataz_string = Buffer_str
                  Length = Len(gpgsv_ch4sataz_string) - 1
                  Gpgsv_ch4sataz_string = Left(gpgsv_ch4sataz_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch4satdb_string = Buffer_str
                  Length = Len(gpgsv_ch4satdb_string) - 1
                  Gpgsv_ch4satdb_string = Left(gpgsv_ch4satdb_string , Length)

               End If

            Elseif Current_message = 2 Then

               If Val(gpgsv_sats_string) > 4 Then

                  Call Nmea_parse()

                  Gpgsv_ch5satid_string = Buffer_str
                  Length = Len(gpgsv_ch5satid_string) - 1
                  Gpgsv_ch5satid_string = Left(gpgsv_ch5satid_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch5satel_string = Buffer_str
                  Length = Len(gpgsv_ch5satel_string) - 1
                  Gpgsv_ch5satel_string = Left(gpgsv_ch5satel_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch5sataz_string = Buffer_str
                  Length = Len(gpgsv_ch5sataz_string) - 1
                  Gpgsv_ch5sataz_string = Left(gpgsv_ch5sataz_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch5satdb_string = Buffer_str
                  Length = Len(gpgsv_ch5satdb_string) - 1
                  Gpgsv_ch5satdb_string = Left(gpgsv_ch5satdb_string , Length)

               End If

               If Val(gpgsv_sats_string) > 5 Then

                  Call Nmea_parse()

                  Gpgsv_ch6satid_string = Buffer_str
                  Length = Len(gpgsv_ch6satid_string) - 1
                  Gpgsv_ch6satid_string = Left(gpgsv_ch6satid_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch6satel_string = Buffer_str
                  Length = Len(gpgsv_ch6satel_string) - 1
                  Gpgsv_ch6satel_string = Left(gpgsv_ch6satel_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch6sataz_string = Buffer_str
                  Length = Len(gpgsv_ch6sataz_string) - 1
                  Gpgsv_ch6sataz_string = Left(gpgsv_ch6sataz_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch6satdb_string = Buffer_str
                  Length = Len(gpgsv_ch6satdb_string) - 1
                  Gpgsv_ch6satdb_string = Left(gpgsv_ch6satdb_string , Length)

               End If

               If Val(gpgsv_sats_string) > 6 Then

                  Call Nmea_parse()

                  Gpgsv_ch7satid_string = Buffer_str
                  Length = Len(gpgsv_ch7satid_string) - 1
                  Gpgsv_ch7satid_string = Left(gpgsv_ch7satid_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch7satel_string = Buffer_str
                  Length = Len(gpgsv_ch7satel_string) - 1
                  Gpgsv_ch7satel_string = Left(gpgsv_ch7satel_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch7sataz_string = Buffer_str
                  Length = Len(gpgsv_ch7sataz_string) - 1
                  Gpgsv_ch7sataz_string = Left(gpgsv_ch7sataz_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch7satdb_string = Buffer_str
                  Length = Len(gpgsv_ch7satdb_string) - 1
                  Gpgsv_ch7satdb_string = Left(gpgsv_ch7satdb_string , Length)

               End If

               If Val(gpgsv_sats_string) > 7 Then

                  Call Nmea_parse()

                  Gpgsv_ch8satid_string = Buffer_str
                  Length = Len(gpgsv_ch8satid_string) - 1
                  Gpgsv_ch8satid_string = Left(gpgsv_ch8satid_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch8satel_string = Buffer_str
                  Length = Len(gpgsv_ch8satel_string) - 1
                  Gpgsv_ch8satel_string = Left(gpgsv_ch8satel_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch8sataz_string = Buffer_str
                  Length = Len(gpgsv_ch8sataz_string) - 1
                  Gpgsv_ch8sataz_string = Left(gpgsv_ch8sataz_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch8satdb_string = Buffer_str
                  Length = Len(gpgsv_ch8satdb_string) - 1
                  Gpgsv_ch8satdb_string = Left(gpgsv_ch8satdb_string , Length)

               End If

            Elseif Current_message = 3 Then

               If Val(gpgsv_sats_string) > 8 Then

                  Call Nmea_parse()

                  Gpgsv_ch9satid_string = Buffer_str
                  Length = Len(gpgsv_ch9satid_string) - 1
                  Gpgsv_ch9satid_string = Left(gpgsv_ch9satid_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch9satel_string = Buffer_str
                  Length = Len(gpgsv_ch9satel_string) - 1
                  Gpgsv_ch9satel_string = Left(gpgsv_ch9satel_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch9sataz_string = Buffer_str
                  Length = Len(gpgsv_ch9sataz_string) - 1
                  Gpgsv_ch9sataz_string = Left(gpgsv_ch9sataz_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch9satdb_string = Buffer_str
                  Length = Len(gpgsv_ch9satdb_string) - 1
                  Gpgsv_ch9satdb_string = Left(gpgsv_ch9satdb_string , Length)

               End If

               If Val(gpgsv_sats_string) > 9 Then

                  Call Nmea_parse()

                  Gpgsv_ch10satid_string = Buffer_str
                  Length = Len(gpgsv_ch10satid_string) - 1
                  Gpgsv_ch10satid_string = Left(gpgsv_ch10satid_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch10satel_string = Buffer_str
                  Length = Len(gpgsv_ch10satel_string) - 1
                  Gpgsv_ch10satel_string = Left(gpgsv_ch10satel_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch10sataz_string = Buffer_str
                  Length = Len(gpgsv_ch10sataz_string) - 1
                  Gpgsv_ch10sataz_string = Left(gpgsv_ch10sataz_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch10satdb_string = Buffer_str
                  Length = Len(gpgsv_ch10satdb_string) - 1
                  Gpgsv_ch10satdb_string = Left(gpgsv_ch10satdb_string , Length)

               End If

               If Val(gpgsv_sats_string) > 10 Then

                  Call Nmea_parse()

                  Gpgsv_ch11satid_string = Buffer_str
                  Length = Len(gpgsv_ch11satid_string) - 1
                  Gpgsv_ch11satid_string = Left(gpgsv_ch11satid_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch11satel_string = Buffer_str
                  Length = Len(gpgsv_ch11satel_string) - 1
                  Gpgsv_ch11satel_string = Left(gpgsv_ch11satel_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch11sataz_string = Buffer_str
                  Length = Len(gpgsv_ch11sataz_string) - 1
                  Gpgsv_ch11sataz_string = Left(gpgsv_ch11sataz_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch11satdb_string = Buffer_str
                  Length = Len(gpgsv_ch11satdb_string) - 1
                  Gpgsv_ch11satdb_string = Left(gpgsv_ch11satdb_string , Length)

               End If

               If Val(gpgsv_sats_string) > 11 Then

                  Call Nmea_parse()

                  Gpgsv_ch12satid_string = Buffer_str
                  Length = Len(gpgsv_ch12satid_string) - 1
                  Gpgsv_ch12satid_string = Left(gpgsv_ch12satid_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch12satel_string = Buffer_str
                  Length = Len(gpgsv_ch12satel_string) - 1
                  Gpgsv_ch12satel_string = Left(gpgsv_ch12satel_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch12sataz_string = Buffer_str
                  Length = Len(gpgsv_ch12sataz_string) - 1
                  Gpgsv_ch12sataz_string = Left(gpgsv_ch12sataz_string , Length)

                  Call Nmea_parse()

                  Gpgsv_ch12satdb_string = Buffer_str
                  Length = Len(gpgsv_ch12satdb_string) - 1
                  Gpgsv_ch12satdb_string = Left(gpgsv_ch12satdb_string , Length)

               End If

Pleite:

          End If

          Portd.4 = 0

       End If

   End If

End If

Return


Sub Nmea_parse()

            Buffer_str = ""

            Do
               Buffer = Waitkey()
               Buffer_str = Buffer_str + Chr(buffer)
            Loop Until Buffer = "," Or Buffer = "*"

            If Buffer_str = "," Then Buffer_str = ""

            If Buffer_str = "*" Then Buffer_str = ""

End Sub


Globe:
$bgf "globebig.bgf"

[تصویر:  sajdelogo.gif]
۰۹-خرداد-۱۳۸۹, ۰۹:۵۷:۱۷
ارسال‌ها
پاسخ
تشکر شده توسط : t3r!p3000, salehjg, ha_60


پرش به انجمن:


کاربرانِ درحال بازدید از این موضوع: 1 مهمان

صفحه‌ی تماس | IranVig | بازگشت به بالا | | بایگانی | پیوند سایتی RSS