By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,853 Members | 2,007 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,853 IT Pros & Developers. It's quick & easy.

reading binary outputfrom a Sirf GPS

P: 5
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....
May 6 '14 #1
Share this Question
Share on Google+
7 Replies


100+
P: 299
Are you using the BinaryReader? Can you give us your code that isn't working or where it errors out?
May 6 '14 #2

P: 5
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.
May 6 '14 #3

P: 5
I didn't make it clear that I'm using Visual Studio 2010 - i.e VB.NET
May 6 '14 #4

100+
P: 299
Read from serial port:
http://msdn.microsoft.com/en-us/library/7ya7y41k.aspx

Read from binary file:
http://msdn.microsoft.com/en-us/library/9tk3bdxw.aspx

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) :)
May 7 '14 #5

P: 5
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:
Expand|Select|Wrap|Line Numbers
  1. Sub cometohere()
  2.         Dim btr As Integer
  3.         TextBox1.Text = "getting info....in BIG (30000 byte) chunks"
  4.  
  5.         btr = SP1.BytesToRead
  6.         If btr < 30000 Then Exit Sub
  7.         If btr > 30000 Then btr = 30000 'sets maximum size at 30000 to match the byte array
  8.         SP1.Read(dd, 1, btr)
  9.         SP1.Close()
  10.         Call doit() ' sub to process the input
  11.     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.
May 8 '14 #6

100+
P: 299
@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.Ports.SerialPort" in your code. Happy coding!
May 8 '14 #7

P: 5
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.
May 8 '14 #8

Post your reply

Sign in to post your reply or Sign up for a free account.