1. You can now buy finished microcontroller project from us, Check out the Store for the complete list of projects.
  2. Need a custom project, Send us some details about your project. So that we can quote the price for it.

Circuit Diagram and Program to Interface a GPS Receiver with AT89S51 1.0

Circuit Diagram and Program to Interface a GPS Receiver with AT89S51

  1. Binu
    [​IMG]
    Bascom 8051 Program
    Code (Text):
    1. $baud = 9600
    2.       $crystal = 11059200
    3.       Config Lcd = 16 * 2
    4.  
    5.  
    6.  
    7.       Config Lcdpin = Pin , Db4 = P0.2 , Db5 = P0.3 , Db6 = P0.4 , Db7 = P0.5 , E = P0.1 , Rs = P0.0
    8.       Rem with the config lcdpin statement you can override the compiler settings
    9.  
    10.  
    11.  
    12. '$GPGGA,012211.83,4119.6171,N,07730.0636,W,1,03,3.6,00522,M,,,,*36
    13.  
    14. 'GPS Time, Latitude, Longitude Display
    15.  
    16. 'set up variables
    17.  
    18. Dim Gps As Byte , X As Byte , Lont(6) As Byte , Latt(6) As Byte
    19. Dim Lat As Byte , Latmin As Byte , Latfrac As Byte , Latns As Byte
    20. Dim Lon As Byte , Lonmin As Byte , Lonfrac As Byte , Lonew As Byte
    21. Dim Timt(6) As Byte
    22. Dim Hours As Byte , Mins As Byte , Secs As Byte
    23.  
    24.  
    25. Home
    26. Cls
    27. Cursor Off
    28.  
    29. Looploop:
    30. Home
    31. Upperline
    32. Startloop:
    33.  
    34. Gps = Waitkey()
    35. If Gps <> "$" Then Goto Startloop
    36.  
    37. Gps = Waitkey()
    38. If Gps <> "G" Then Goto Startloop
    39.  
    40. Gps = Waitkey()
    41. If Gps <> "P" Then Goto Startloop
    42.  
    43. Gps = Waitkey()
    44. If Gps <> "G" Then Goto Startloop
    45.  
    46. Gps = Waitkey()
    47. If Gps <> "G" Then Goto Startloop
    48.  
    49. Gps = Waitkey()
    50. If Gps <> "A" Then Goto Startloop
    51.  
    52. Gps = Waitkey()
    53. If Gps <> "," Then Goto Startloop
    54.  
    55.  
    56. For X = 1 To 6
    57.   Gps = Waitkey()
    58.   Lcd Chr(gps) ;
    59.   Timt(x) = Gps
    60.   If X = 2 Then Lcd ":";
    61.   If X = 4 Then Lcd ":";
    62. Next X
    63.  
    64.  
    65. Timlop:
    66. Gps = Waitkey()
    67. If Gps = "," Then Goto Getlat
    68. Goto Timlop
    69.  
    70.  
    71. Getlat:
    72. Lowerline
    73. For X = 1 To 6
    74. Getlat1:
    75.   Gps = Waitkey()
    76.   If Gps = "." Then Goto Getlat1
    77.   Latt(x) = Gps
    78.   Lcd Chr(gps);
    79. Next X
    80.  
    81. Getlat2:
    82. Gps = Waitkey()
    83. If Gps <> "," Then Goto Getlat2
    84. Gps = Waitkey()
    85. Lcd Chr(gps) ; " ";
    86. Latns = Gps
    87. Gps = Waitkey()
    88. Gps = Waitkey()
    89.  
    90. For X = 1 To 6
    91. Getlon:
    92.   Gps = Waitkey()
    93.   If Gps = "." Then Goto Getlon
    94.   Lont(x) = Gps
    95.   Lcd Chr(gps);
    96. Next X
    97. Getlon1:
    98. Gps = Waitkey()
    99. If Gps <> "," Then Goto Getlon1
    100. Gps = Waitkey()
    101. Lcd Chr(gps);
    102. Gps = Waitkey()
    103. Gps = Waitkey()
    104. Gps = Waitkey()
    105. Locate 1 , 11
    106. Lcd "Sat:"
    107. Gps = Waitkey()
    108. Lcd Chr(gps);
    109. Gps = Waitkey()
    110. Lcd Chr(gps);
    111.  
    112. Goto Looploop