473,325 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

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....
May 6 '14 #1
7 1661
Luk3r
300 256MB
Are you using the BinaryReader? Can you give us your code that isn't working or where it errors out?
May 6 '14 #2
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
I didn't make it clear that I'm using Visual Studio 2010 - i.e VB.NET
May 6 '14 #4
Luk3r
300 256MB
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
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
Luk3r
300 256MB
@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
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

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

Similar topics

4
by: Dimitri Papoutsis | last post by:
Hi there, ... i want to read in a binary data file and to cast each pair of 2 bytes to a signed short value. i try to different ways, but none results in what i suppose it should result. ...
8
by: Yeow | last post by:
hello, i was trying to use the fread function on SunOS and ran into some trouble. i made a simple test as follows: i'm trying to read in a binary file (generated from a fortran code) that...
1
by: Manjunath sp via DotNetMonster.com | last post by:
Hi, How to effectively write and read structures from binary files in .Net? Currently I am using functions like ReadInt32 and the likes to read data from binary file into each elements of a...
0
by: Neo | last post by:
Hello: I am receiving a Binary File in a Request from a application. The stream which comes to me has the boundary (Something like "---------------------------390C0F3E0099" without the quotes),...
2
by: Mad Scientist Jr | last post by:
i'm trying to read a file byte by byte (and later alter the data and write it to a 2nd file byte by byte) and running into a problem where it seems to keep reading the same byte over and over again...
8
by: Shalaka Joshi | last post by:
Hi, I have binary file say, "test.bin". I write "FF" in the file and expect my code to read 255 for me. char * lbuf; int lreadBytes ; long lData; FILE *pFile = fopen ("c:\\testbin","rb");
9
by: Use*n*x | last post by:
Hello, I have a binary file (image file) and am reading 4-bytes at a time. The File size is 63,480,320 bytes. My assumption is that if I loop through this file reading 4 bytes at a time, I...
11
by: Freddy Coal | last post by:
Hi, I'm trying to read a binary file of 2411 Bytes, I would like load all the file in a String. I make this function for make that: '-------------------------- Public Shared Function...
1
by: freeurmind | last post by:
Hi, i have a text file input.txt that contain binary data i'm reading a stream of bytes and then converting them from unreadable symbols to a string of characters. My conversion is from...
6
by: rahul | last post by:
I am reading a binary packet : 32, 8, 8, 2, 1, 1, 4, 128 I am using the following structure to parse the data: struct header { unsigned int a:32; unsigned int b:8; unsigned int c:8; unsigned...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.