mc pgm.bas

来自「gps interface code that using visual bas」· BAS 代码 · 共 112 行

BAS
112
字号
      $baud = 9600
      $crystal = 11059200
      Config Lcd = 16 * 2



      Config Lcdpin = Pin , Db4 = P0.2 , Db5 = P0.3 , Db6 = P0.4 , Db7 = P0.5 , E = P0.1 , Rs = P0.0
      Rem with the config lcdpin statement you can override the compiler settings



'$GPGGA,012211.83,4119.6171,N,07730.0636,W,1,03,3.6,00522,M,,,,*36

'GPS Time, Latitude, Longitude Display

'set up variables

Dim Gps As Byte , X As Byte , Lont(6) As Byte , Latt(6) As Byte
Dim Lat As Byte , Latmin As Byte , Latfrac As Byte , Latns As Byte
Dim Lon As Byte , Lonmin As Byte , Lonfrac As Byte , Lonew As Byte
Dim Timt(6) As Byte
Dim Hours As Byte , Mins As Byte , Secs As Byte


Home
Cls
Cursor Off

Looploop:
Home
Upperline
Startloop:

Gps = Waitkey()
If Gps <> "$" Then Goto Startloop

Gps = Waitkey()
If Gps <> "G" Then Goto Startloop

Gps = Waitkey()
If Gps <> "P" Then Goto Startloop

Gps = Waitkey()
If Gps <> "G" Then Goto Startloop

Gps = Waitkey()
If Gps <> "G" Then Goto Startloop

Gps = Waitkey()
If Gps <> "A" Then Goto Startloop

Gps = Waitkey()
If Gps <> "," Then Goto Startloop


For X = 1 To 6
   Gps = Waitkey()
   Lcd Chr(gps) ;
   Timt(x) = Gps
   If X = 2 Then Lcd ":";
   If X = 4 Then Lcd ":";
Next X


Timlop:
Gps = Waitkey()
If Gps = "," Then Goto Getlat
Goto Timlop


Getlat:
Lowerline
For X = 1 To 6
Getlat1:
   Gps = Waitkey()
   If Gps = "." Then Goto Getlat1
   Latt(x) = Gps
   Lcd Chr(gps);
Next X

Getlat2:
Gps = Waitkey()
If Gps <> "," Then Goto Getlat2
Gps = Waitkey()
Lcd Chr(gps) ; " ";
Latns = Gps
Gps = Waitkey()
Gps = Waitkey()

For X = 1 To 6
Getlon:
   Gps = Waitkey()
   If Gps = "." Then Goto Getlon
   Lont(x) = Gps
   Lcd Chr(gps);
Next X
Getlon1:
Gps = Waitkey()
If Gps <> "," Then Goto Getlon1
Gps = Waitkey()
Lcd Chr(gps);
Gps = Waitkey()
Gps = Waitkey()
Gps = Waitkey()
Locate 1 , 11
Lcd "Sat:"
Gps = Waitkey()
Lcd Chr(gps);
Gps = Waitkey()
Lcd Chr(gps);

Goto Looploop

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?