Help to setup GPS connection.


Closed Thread
Results 1 to 34 of 34

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Code:
        H       VAR BYTE 'HOURS
        M       VAR BYTE 'MINUTES
        S       VAR BYTE 'SECONDS
    [WAIT("$GPRMC"),WAIT(","),DEC2 H,DEC2 M,DEC2 S]
    [WAIT("$GPRMC"),WAIT(","),DEC2 H,DEC2 M,DEC2 S]
    Waits for GPRMC

    [WAIT("$GPRMC"),WAIT(","),DEC2 H,DEC2 M,DEC2 S]
    Waits for ","

    [WAIT("$GPRMC"),WAIT(","),DEC2 H,DEC2 M,DEC2 S]
    Places the first two digits into VAR H

    [WAIT("$GPRMC"),WAIT(","),DEC2 H,DEC2 M,DEC2 S]
    Places the middle two digits into VAR M

    [WAIT("$GPRMC"),WAIT(","),DEC2 H,DEC2 M,DEC2 S]
    Places the last two digits into VAR S

    "$GPRMC,053740.000"
    053740 =
    H = 05 Hours
    M = 37 Minutes
    S = 40 Seconds
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    If you have not seen this it might be handy
    http://aprs.gids.nl/nmea/
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Oct 2008
    Posts
    65


    Did you find this post helpful? Yes | No

    Thumbs up

    Quote Originally Posted by mackrackit View Post
    Code:
        H       VAR BYTE 'HOURS
        M       VAR BYTE 'MINUTES
        S       VAR BYTE 'SECONDS
    [WAIT("$GPRMC"),WAIT(","),DEC2 H,DEC2 M,DEC2 S]
    [WAIT("$GPRMC"),WAIT(","),DEC2 H,DEC2 M,DEC2 S]
    Waits for GPRMC

    [WAIT("$GPRMC"),WAIT(","),DEC2 H,DEC2 M,DEC2 S]
    Waits for ","

    [WAIT("$GPRMC"),WAIT(","),DEC2 H,DEC2 M,DEC2 S]
    Places the first two digits into VAR H

    [WAIT("$GPRMC"),WAIT(","),DEC2 H,DEC2 M,DEC2 S]
    Places the middle two digits into VAR M

    [WAIT("$GPRMC"),WAIT(","),DEC2 H,DEC2 M,DEC2 S]
    Places the last two digits into VAR S

    "$GPRMC,053740.000"
    053740 =
    H = 05 Hours
    M = 37 Minutes
    S = 40 Seconds
    Thanks so much mackrackit.

    regards,
    mbox

  4. #4
    Join Date
    Oct 2008
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Hi, I want to try to use 38400 baud rate with 20Mz crystal. I want to test it first in the hyperterminal by entering this line "$GPGGA,115209.600,1114.5166,N,12500.3439,E,1,10,0 .83,16.9,M,55.4,M,,*5E" and I use this code
    Code:
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
    DEFINE HSER_SPBRG 32 ' 38400 Baud @ -1.36%
    define HSER_BAUD 38400
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    define OSC 20
    
    gpsin var portc.7 'rx
    gpsout var portc.6 'tx
    
    
    HH VAR byte 
    MM VAR BYTE
    SS VAR BYTE
    ND VAR BYTE
    NM VAR BYTE
    NMD VAR WORD
    WD VAR BYTE
    WM VAR BYTE
    WMD VAR WORD
    AR VAR BYTE[20]
    
    START: 
    SERIN2 gpsin,16572,[WAIT("$GPGGA"),WAIT(","),DEC2 hH,DEC2 mM,DEC2 sS,_
    WAIT(","),DEC2 ND,DEC2 NM,WAIT("."),DEC3 NMD,WAIT(",N,"),_
    DEC3 WD,DEC2 WM,WAIT("."),DEC3 WMD]
    
    PAUSE 1000
    
    SEROUT2 gpsin,16572,[DEC2 HH,DEC2 MM,DEC2 SS,_
    DEC2 ND,DEC2 NM,DEC3 NMD,DEC3 WD,DEC2 WM,DEC3 WMD,13,10]
    
    
    goto START
    end
    but I dont have any display on the recieve window. Please help..

    regards,
    mbox

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


    Did you find this post helpful? Yes | No

    Default

    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
    DEFINE HSER_SPBRG 32 ' 38400 Baud @ -1.36%
    define HSER_BAUD 38400
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    Get rid of the above. You are not using the hardware with SERIN2
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    It looks like you have not quite decided whether to use the hardware serial port, or serin2/serout2. Once you decide which one you are using, you may have better luck. Let us know how it goes.

    EDIT: Once again, beaten by Dave....
    http://www.scalerobotics.com

  7. #7
    Join Date
    Oct 2008
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Hi, I was happy when I got the GPS set to 9600 but yesterday I found out that it reset itself to 57600. I tried to reset it back to 9600 but failed and I tried it the whole afternoon...I use this as my reference http://www.laptopgpsworld.com/3701-d...ocosys-ls20031 it can only lowered to 38400, so I have no choice but to try this baudrate. My first time to use 20Mz crystal. I'm showing my codes when the GPS was running fine in 9600 baudrate. Please forgive my codings, still learning
    Code:
    clear
    Include "modedefs.bas"  
    H VAR BYTE[2] 
    
    TRISD = %00000000 ' PortD.0 LCD connection
    TRISC = %10000000 ' PortC.6 as tx and PortC.7 as rx
    TRISB = %00000001	' PortB.0 as rx from GPS
    PortB =  %00000000 
    PortD =  %00000000 
     
    'This following serout2 command is use for bluetooth initialization 
     SerOut2 PortC.6,84, [$02,$52,$27,$06,$00,$7F,$12,$13,$23,$17,$09,$00,$03]
     pause 200
     SerOut2 PortC.6,84, [$02,$52,$66,$00,$00,$B8,$03]
     pause 200
     Serout2 PortC.6,84, [$02,$52,$04,$11,$00,$67,$10,$4D,$49,$43,$52,$4F,$42,$4F,$58,$42,$54,$31,$20,$20,$20,$20,$00,$03]
     
     RX var byte ' Receive byte
    
     serout PortD.0,T9600,[$1B,$45]
     serout PortD.0,T9600,["Loging on.."]
     pause 300
    
     ''Main Code
     Pause 1000
     
     serout PortD.0,T9600,[$1B,$45]
     serout PortD.0,T9600,["**GPS Locator**"]
     
     Menu:
     pause 200
     
     '****** [Menu setup on PC screen] *************************
     
     serout PortD.0,T9600,[$1B,$45,"**System Ready**"]
     
     Receive:
     ' ***** [Receive the menu selection from Bluetooth receiver] ***************
     serin PortC.7, T9600, RX 'Receive menu from Bluetooth
     'serout PortD.0,T9600,[$D,RX]    'Check Input
     RX = RX - $30 'Convert ASCII to decimal value
     
     If RX > 1 then Error ' Test for good value
     Branch RX, [zero, one] 'redirect to menu selection code
     
     error:
     serout2 PortC.6, 84, ["Oops Try again ",#RX,10,13]
     goto menu
     
     Zero:
     '***** [ Code for zero value ] *****************************
     goto menu 'Return to menu, zero is not a  valid selection
     
     One:
    '***** [Code for selection 1] ************************
    
    ;serout PortD.0,T9600,[$D,"Request ",#rx]
    ;serout PortD.0,T9600,[$1B,$45,"**System Ready**"]
    ;serout PortD.0,T9600,[$D,"Data sent"]
    
    SERIN2 PORTB.0, 84,40, error,[WAIT("$GPRMC"),WAIT("A,"),str H\24]
    pause 500
    serout2 PortC.6, 84, [str H\24,10,13] 'Send data to bt 
    ' example output: 1114.5089,N,12500.3864,E
    pause 500
    goto menu 'Return to main menu
    
    
    goto menu
    
    End
    Please help me make it run to 38400 baudrate, I have the 20Mz crystal.

    thanks in advance,
    mbox

  8. #8
    Join Date
    Oct 2008
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    I am trying to run this code...
    Code:
    define OSC 20
    
    gpsin var portc.7 'rx
    gpsout var portc.6 'tx
    
    
    HH VAR byte 
    MM VAR BYTE
    SS VAR BYTE
    ND VAR BYTE
    NM VAR BYTE
    NMD VAR WORD
    WD VAR BYTE
    WM VAR BYTE
    WMD VAR WORD
    AR VAR BYTE[20]
    
    START: 
    SERIN2 gpsin,16572,[WAIT("$GPGGA"),WAIT(","),DEC2 hH,DEC2 mM,DEC2 sS,_
    WAIT(","),DEC2 ND,DEC2 NM,WAIT("."),DEC3 NMD,WAIT(",N,"),_
    DEC3 WD,DEC2 WM,WAIT("."),DEC3 WMD]
    
    PAUSE 1000
    
    SEROUT2 gpsout,16572,[DEC2 HH,DEC2 MM,DEC2 SS,_
    DEC2 ND,DEC2 NM,DEC3 NMD,DEC3 WD,DEC2 WM,DEC3 WMD,13,10]
    goto start
    I'm testing PC to MCU first, but I don't have response when entering $GPGGA,114708.600,1114.5089,N,12500.3864,E,1,6,1.6 7,23.5,M,55.4,M,,*69

    regards,
    mbox

  9. #9
    Join Date
    Oct 2008
    Posts
    65


    Did you find this post helpful? Yes | No

    Post

    I manage to run this code for a start
    Code:
    @ DEVICE HS_OSC
    DEFINE    OSC 20
    main:
    
    serout2 PortC.6,32774,["To PC",$D]  ;@38400 To PC
    serout2 PortB.6,84,[$1B,$45]
    serout2 PortB.6,84,["To LCD"] ;@9600 To Lcd
    pause 500
    
    goto main
    end
    I will update my codes with the Gps, and post it here later...

    regards,
    mbox

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