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.

How to get Latitude and longitude from GPS using Bascom

Discussion in 'BASCOM 8051 Projects & Doubts' started by joel, May 26, 2013.

  1. joel

    joel New Member

    Likes Received:
    0
    Trophy Points:
    1
    Hi
    My project is vehicle tracking system and i am using the serial port for the GSM modem. Since AT89s52 has only 1 serial port, i am unable to connect the GPS.

    Anyway to connect the gps and to get the Latitude and longitude?
  2. Binu

    Binu Administrator

    Likes Received:
    135
    Trophy Points:
    63
    You can use the software UART feature in bascom. It uses the GET and PUT commands.

    See the following example code.
    Code (Text):
    1. Dim S As String * 12 , I As Byte , A As Byte , Dum As Byte
    2.  
    3. Open "com1.1:9600" For Output As #1
    4. Open "com1.0:9600" For Input As #2
    5.  
    6.  
    7. S = "test this"  'assign string
    8. Dum = Len(s)  'get length of string
    9. For I = 1 To Dum  'for all characters from left to right
    10.   A = Mid(s , I , 1)  'get character
    11.   Put #1 , A  'write it to comport
    12. Next
    13.  
    14. Do
    15.   Get #2 , A  'get character from comport
    16.   Put #1 , A  'write it back
    17.   Print A    'use normal channel
    18. Loop
    19.  
    20. Printbin #1, a  'Printbin is also supported
    21. Inputbin #2, a  'Inputbin is also supported
    22.  
    23. Close #1                                  ' finally close device
    24. Close #2
    25. End
    26.  
    27. 'To use the TIMEOUT option include (without the remarks):
    28. '$TIMEOUT
    29. '  Get #2 , A TIMEOUT = 10000  'get character from comport
    joel likes this.
  3. joel

    joel New Member

    Likes Received:
    0
    Trophy Points:
    1
    Thanks for your quick reply, will try it and get back
Loading...

Share This Page

Loading...