grabbing a serial string and passing it


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2005
    Location
    NC, USA
    Posts
    53

    Default grabbing a serial string and passing it

    Any ideas how I would deal with getting reading this string

    "31..02+00000685 51....+0000+000" using serout2 then passing it to back out using hserout. Ideally I would like to parse it. The 31..002+ is always the same, the number I want is the 685 (which varries - laser distance), then I can dump the remainder 51... but if too hard to parse using the pic I can send the whole piece or pieces using hserout then have my visual basic program parse it.

    Any help would be great, I'm not too smart with this stuff so keep it simple.

    Thanks
    Charlie

  2. #2
    eoasap's Avatar
    eoasap Guest


    Did you find this post helpful? Yes | No

    Default

    is it the same length every time ?

    I'm sure i'm definately not the best, but this is how i'd do it.
    create a var1 which stores "31..02+00000" (which you said always stays the same).



    SERIN2 GPS_TXA, GBAUD, [skip 12,str var2\3] 'assuming the '685' field is 3

    or maybe this:
    SERIN2 GPS_TXA, GBAUD, [wait("00000"),str var2\3]
    'assuming theres always 5 zeros before the '685' string


    then output both variables (var1 & var2) as you see fit. as you can probably tell by my baud rates and pin definitions, i use similar stuff to parse gps.

  3. #3
    Join Date
    Aug 2005
    Location
    NC, USA
    Posts
    53


    Did you find this post helpful? Yes | No

    Smile

    Thanks. the number varies in length. (its the lengh *10 in inches) As it turns out each number/character is separate, so the skip feature works great to jump to the meat. Thanks!

    I have a GPS right next to me that I have to start playing with next. The laser distance is very impressive, hopefull my GPS will wow me too!

  4. #4
    eoasap's Avatar
    eoasap Guest


    Did you find this post helpful? Yes | No

    Default

    i've got code to parse gps sentences parsed if you're interested. i also did speed conversion (to mph) and altitude conversion (to feet).

  5. #5
    Join Date
    Aug 2005
    Location
    NC, USA
    Posts
    53


    Did you find this post helpful? Yes | No

    Default

    Yes, I'd love to see it. I plan on having a PIC receive the data and then relay it back to a PC with a wireless modem. I have been using MaxStream modems and they work real well at long distances. I have not dug into all the different data that is sent back via the GPS, most of it is probably worthless, I am most interested in position and heading, but what ever you have will be great. What type of PIC are you using? Are you using the UART, or just a standard port?

    I have been working with the laser which is mounted a large servo pan and tilt system with a camera. The laser works real well on most surfaces and at any angle. It works from 1 ft to 400+ ( I have not reloved its maximum range yet, my neibors might think I am scoping their house with a riffle). Unfortunately the laser is not mine, just borrowing it (its a $3.5k US item)

    Charlie

  6. #6
    Join Date
    Mar 2005
    Location
    Iowa, USA
    Posts
    216


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by eoasap
    i've got code to parse gps sentences parsed if you're interested. i also did speed conversion (to mph) and altitude conversion (to feet).
    Hey eoasap,
    Is this something you would consider posting in the code examples forum?
    Wisdom is knowing what path to take next... Integrity is taking it.
    Ryan Miller

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