Help to setup GPS connection.


Closed Thread
Results 1 to 34 of 34

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    For the baud rate to be timed right, PicBasic needs to told exactly what frequency the crystal is. PicBasic only allows certain crystals to be defined. Here are the settings allowed: MHz: 3(3.58) 4 8 10 12 16 20 24 25 32 33 40 48 64. Of course your chip has restrictions as well. (It max's out at 20 mhz).

    If you have a 16mhz crystal, you might give it a try while you wait for a 20mhz to come in. 38400 baud works with debug out at 8 mhz, so at 16mhz I figure your 57600 might work. In the meantime, you could connect the gps to a max232 device, and change the baud lower with your computer. Then you could connect it to your pic at a lower baud rate, using a lower speed crystal. But 20mhz is highly recommended.
    Last edited by ScaleRobotics; - 28th October 2010 at 13:37.
    http://www.scalerobotics.com

  2. #2
    Join Date
    Oct 2008
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Hi,
    Finally I manage to make the baudrate to 9600 with this guide http://docs.trenz-electronic.de/GlobalT ... ket_01.pdf but I have not connected it yet to PIC16F877A.
    I'm going to use SERIN on PortB.0 to fetch data from GPS using 4Mz crytsal....feed back you later the result when I get back home.

    regards,
    mbox
    Last edited by mbox; - 30th October 2010 at 00:04.

  3. #3
    Join Date
    Oct 2008
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Hi, I got a follow up question, I need to get latitude and longitude from this string
    $GPRMC,053740.000,A,250.6319,N,12136.0099,E,2.69,7 9.65,100106,,,A*53. How can I achieve it using SERIN?

    thanks,
    mbox

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    You would be better off using SERIN2.
    Here is a snippet from something .
    Code:
    SERIN2 PORTB.2,16572,[WAIT("$GPGGA"),WAIT(","),DEC2 H,DEC2 M,DEC2 S,_
            WAIT(","),DEC2 ND,DEC2 NM,WAIT("."),DEC3 NMD,WAIT(",N,"),_
            DEC3 WD,DEC2 WM,WAIT("."),DEC3 WMD]
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Oct 2008
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    You would be better off using SERIN2.
    Here is a snippet from something .
    Code:
    SERIN2 PORTB.2,16572,[WAIT("$GPGGA"),WAIT(","),DEC2 H,DEC2 M,DEC2 S,_
            WAIT(","),DEC2 ND,DEC2 NM,WAIT("."),DEC3 NMD,WAIT(",N,"),_
            DEC3 WD,DEC2 WM,WAIT("."),DEC3 WMD]
    Hi, I'm trying to understand SERIN2 command. why this code do not work when I entered "hello"?
    Code:
    Include "modedefs.bas"
    main:
    Serin2 PORTC.7, T9600, error, [WAIT("hello")]
    serout2 PortC.6, T9600, ["Valid"]
    goto main
    
    error:
    serout2 PortC.6, T9600, ["Invalid"]
    goto main
    end
    regards,
    mbox

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I imagine many are thinking, "have you read the manual?".

    Include "modedefs.bas"
    Does nothing with SERIN2/SEROUT2.

    T9600
    Is for SERIN/SEROUT. "T" is for true mode anyways so if you are connecting directly to a PC you want INVERTED mode.

    Appendix A from the manual has the modes for SERIN2. At 9600 baud the mode will be 16468. To see how that is calculated look here. http://www.picbasic.co.uk/forum/cont...SERIN2-SEROUT2

    You will also want to specify a time for the GOTO LABEL "error".

    Try this
    Code:
    SERIN2 PORTC.7, 16468,100, error, [WAIT("hello")]
    The above will wait for 100 milliseconds, then GOTO "error" if "hello" is not received.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Oct 2008
    Posts
    65


    Did you find this post helpful? Yes | No

    Red face

    Hi mackrackit, thanks for the help, appreciated very much. I manage to run this code MCU to PC and use this guide http://melabs.com/resources/ser2modes.htm
    Code:
    main:
    SERIN2 PORTC.7, 84,200, error, [WAIT("Hello")]
    serout2 PortC.6,84, ["Valid",10,13]
    goto main
    
    error:
    serout2 PortC.6, 84, ["Invalid",10,13]
    goto main
    end
    I know u have given me an example, but dont really get it ,
    Is there a way I could receive this value "$GPRMC,053740.000" and place it on a variable?

    thanks and regards,
    mbox
    Last edited by mbox; - 2nd November 2010 at 01:00.

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