reading binary outputfrom a Sirf GPS

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • paulcatc
    New Member
    • May 2014
    • 5

    reading binary outputfrom a Sirf GPS

    I am getting data from a Sirf receiver which, while in NMEA mode is fine. Then I can switch to Sirf binary mode but simply cannot make any sense of downloading the receiver's output. Well I can get it but it doesn't seem to be in binary and shows a hundreds of ? marks with some other characters. Anyone have any sample code because I'm going crazy....
    Last edited by paulcatc; May 6 '14, 05:02 AM. Reason: spelling error
  • Luk3r
    Contributor
    • Jan 2014
    • 300

    #2
    Are you using the BinaryReader? Can you give us your code that isn't working or where it errors out?

    Comment

    • paulcatc
      New Member
      • May 2014
      • 5

      #3
      The answer is Yes but I have just tried so many different things that I have now wiped everything for a clean start.
      My problem seems to be how to catch the data into the binary reader. I think I have to use a byte array which I have as "Dim dd() as byte". When in NMEA mode I simply have a string and use ".readexisting" . When I swap to Sirf binary that will still work but gives me gibberish.
      Do I I have to get it byte by byte into the binaryreader? There doesn't seem to be a suitable method available. The stuff I can get is the same as I get from Sirfdemo software but it doesn't seem to be in binary. Can I set up the binary reader with the serialport as the source? If so I need some guidance on that as I can't find anything apart from info on connecting to a file.

      Comment

      • paulcatc
        New Member
        • May 2014
        • 5

        #4
        I didn't make it clear that I'm using Visual Studio 2010 - i.e VB.NET

        Comment

        • Luk3r
          Contributor
          • Jan 2014
          • 300

          #5
          Read from serial port:


          Read from binary file:


          By combining information from both of those you should be able to get pretty close to doing what you need. Give it a shot and report back (with code this time) :)

          Comment

          • paulcatc
            New Member
            • May 2014
            • 5

            #6
            I really appreciate the help. Seems I was only importing system.IO and should have imported system.IO.ports . That seemed to give me extra options so that I could simply use a read option and a byte array. No binary reader needed viz:
            Code:
            Sub cometohere()
                    Dim btr As Integer
                    TextBox1.Text = "getting info....in BIG (30000 byte) chunks"
                    
                    btr = SP1.BytesToRead
                    If btr < 30000 Then Exit Sub
                    If btr > 30000 Then btr = 30000 'sets maximum size at 30000 to match the byte array
                    SP1.Read(dd, 1, btr)
                    SP1.Close()
                    Call doit() ' sub to process the input
                End Sub
            Doit is my sub to handle the data, dd my byte array.
            I now have to get into processing the raw data I'm getting. Maybe not the best but I'm only a self-taught oldie who likes to learn by doing.
            Last edited by Rabbit; May 8 '14, 05:06 AM. Reason: Please use [code] and [/code] tags when posting code or formatted data.

            Comment

            • Luk3r
              Contributor
              • Jan 2014
              • 300

              #7
              @paulcatc, for the future, if you import System.IO, then you can use System.IO.Ports simply by typing "Ports.". You also never really have to import anything, it just makes coding easier. You could always type something like "System.IO.Port s.SerialPort" in your code. Happy coding!

              Comment

              • paulcatc
                New Member
                • May 2014
                • 5

                #8
                All part of the 'learn by doing' I guess.
                There seemed to be so many other people with the same problem and most blaming Sirf (who make the GPS boards). But, as is usually the case, the answer turned out to be quite simple.
                I'm sure I will be back with further 'mysteries' but thanks again.

                Comment

                Working...