Why first time string doesn't come properly?


Closed Thread
Results 1 to 3 of 3

Hybrid View

  1. #1

    Exclamation Why first time string doesn't come properly?

    Hi, here is my code:

    ab:
    DEBUGIN 2000,ab,[WAIT("$GPRMC"),skip 14,DEC2 ladeg,DEC2 lamin,skip 1,DEC4 lasec,skip 3,DEC3 lodeg,DEC2 lomin,skip 1,DEC4 losec]
    pause 1000
    DEBUG "Latitude Deg ",DEC2 ladeg," Min ", DEC2 lamin," Sec ",DEC2 lasec,10,"Longitude Deg ",DEC3 lodeg, " Min ", DEC2 lomin," Sec ",DEC2 losec,13,10,10
    pause 1000
    goto ab

    It grabs the data from GPS string and throws it on my computer screen. Everytime I power the PIC again, the first data string comes like this:

    b…Ñ¥ÑÕ‘•Deg 51 Min 34 Sec 10 ' Only appears at first response only
    Longitude Deg 000Min 07 Sec 32

    After the first time it starts appearing fine

    Latitude Deg 51 Min 34 Sec 10
    Longitude Deg 000Min 07 Sec 32

    I dont seem to understand it as if there is a problem with the code or hardware it should be a regular output, but junk characters only appear first time only.
    Can someone tell me why this is happening? Thanks

  2. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    966


    Did you find this post helpful? Yes | No

    Default

    Do a dummy serout in your initialization routine before you start reading/writing to the screen
    Simply DEBUG 0 should do it. I've seen this issue covered earlier, so, it may help to search here. This happens because the DEBUG port is not initialized till first used by DEBUG.

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,115


    Did you find this post helpful? Yes | No

    Default

    Set the port to HIGH state prior every serial command. Even better before TRIS command.

    That is a good practice, to set the outputs before TRIS commands,so you have no glitches at the outputs.

    Ioannis

Similar Threads

  1. How about String Variables?
    By mytekcontrols in forum PBP Wish List
    Replies: 40
    Last Post: - 20th January 2015, 12:53
  2. I don't understand this code!
    By Russ Kincaid in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 13th February 2008, 02:55
  3. Serout2/serin2 Pbp Problem
    By SOMRU in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th December 2006, 19:55
  4. Visual Basic 6 & Access 2000
    By Demon in forum Off Topic
    Replies: 33
    Last Post: - 7th September 2006, 04:39
  5. Timer in real time
    By martarse in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 29th July 2005, 14:24

Members who have read this thread : 0

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