Jump to content
The simFlight Network Forums

Need help to write NMEA sentence to USB port


Recommended Posts

Hi,

I'm doing something similar to GPSout but for falcon 4.

I'm to the point I have the GPS data in the NMEA sentence.

The only thing I miss is the checksum.

I found a VB.net code to calculate it, but I work with VB6 and there is a VB.net function for which I'm unbla to find a VB6 equivalent.

"Convert.ToByte".

It's applied on a Char variable.

Anyone can help?

Link to comment
Share on other sites

Well I am not the best bet to solve your problem since I use Delphi and knows next to nothing about VB/VB.net my my guess is that the code you mention simply convert a char to a byte value. In delphi there is a function called "Ord" (ordinal-value), but I'm not sure if VB/VB.Net has anything similar, but can't the char value not simply be "casted" into a byte value ?

Link to comment
Share on other sites

Dim strData As String

Dim abBytes() As Byte

strData = "Your Char Data Goes Here"

abBytes = StrConv(strData, vbFromUnicode)

As an aside, the Beta2 version of Visual Basic.NET Express is available for free download from the MS web site.

Richard

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

Up!

Sorry to disturb again.

Hi Pete, could you please give me some tips on how to communicate with the pocketPC connected to a USB port, to send my NMEA sentence.

Could you give me a little bit of code?

Link to comment
Share on other sites

Hi Pete, could you please give me some tips on how to communicate with the pocketPC connected to a USB port, to send my NMEA sentence.

Could you give me a little bit of code?

Sorry, I've no idea how to handle USB ports, let alone one with a PDA on the end. If it is merely a named device I would assume you open it as a file

("CreateFile") then WriteFile to it, and CloseHandle at the end. As for any device or file.

Regards,

Pete

Link to comment
Share on other sites

It seems that your code for GPSout also works for USBlike for the COM port by writing this line in gpsout.ini : " Port=\\.\WCEUSBSH001"

Do you think this ability is specific to C or would it work in VB?

Thanks anyway

Best regards

Laurent

Link to comment
Share on other sites

It seems that your code for GPSout also works for USBlike for the COM port by writing this line in gpsout.ini : " Port=\\.\WCEUSBSH001"

Do you think this ability is specific to C or would it work in VB?

That's the device name you need then. It isn't a function of C but of Windows so it is language independent.

All of the routines you need to call arre in KERNEL32.DLL, part of Windows. Surely you have some documentation on reading and writing files in VB?

You want the CreateFile(), ReadFile(), WriteFile(), CloseHandle() routines. Other calls applicable to serial ("Comm") devices include SetCommState(), ClearCommError(), EscapeCommFunction(), SetCommTimeouts() and PurgeComm().

Regards,

Pete

Link to comment
Share on other sites

Thank you for your help Pete.

I'm not very good at programming and I needed this dll to be pointed at.

I will try with this.

If it doesn't work, I'll try to connect my PDA with a serial link.

Best regards

Laurent

Link to comment
Share on other sites

Thank you for your help Pete.

I'm not very good at programming and I needed this dll to be pointed at.

That DLL is an essential part of Windows. It contains nearly al the Windows interface along with USER32.DLL and GDI32.DLL. There may be others, but between them they cover most of what is known as Windows as far as application programs are concerned.

You don't really need to "know" about the DLL to use standard Windows interfaces, they should all be documented in your VB package and you should be able to use them without any explicit links. The ones used for serial ports and other devices are also the standard file access facilities.

Pete

Link to comment
Share on other sites

Thanks to your help, I succeeded in writing the NMEA sentences to the PocketPC, using the createfile() and writefile() functions.

My new problem is that some programs recognize the sentences :

- Pocket FMS

- Tomtom GPS : it seems to lose fix repetedly but it keeps the position

But som others don't:

- CE monitor : fix is always blinks from grey to blue!? :roll:

- Oziexplorer : I wanted to use this one, but it doesn't recognize the signal.

I'm wondering if I use the right sentences and if I send it at the right time.

Can you give me a tip on the good sentence arrangement?

How many sentences of each type?

How much time between sentences?

Thank you in advance

Laurent

Link to comment
Share on other sites

Can you give me a tip on the good sentence arrangement?

How many sentences of each type?

Erone. Why would there be more than one of any type? Or do I misunderstand the question?

How much time between sentences?

Between all the sentences of one batch -- no time at all. Between each batch (i.e. each update) -- most devices seem to operate well with a 1 second update rate.

Don't forget that if you are setting a standard NMEA speed of 4800 you can only get 480 bytes of data out per second in any case. If you try too many sentences per update you'll have problems in any case. Reduce the number or increase the interval.

Regards,

Pete

Link to comment
Share on other sites

Erone. Why would there be more than one of any type? Or do I misunderstand the question?

This question comes from the fact that some sentence types seem to come less than other (i.e. GSV sentences)

If you try CEmonitor, you'll see that by default it's configured to ask the GPS receiver to send 1 GGA sentence every second, and 1 on the other side 1 GSV sentence every 5 seconds.

But, maybe there is no problem to send all the sentences every second, unless it reaches 480 bytes.

Thank you for all.

If you've a technical interest in my code (maybe), I'll send it to you when it's finished. ;)

Link to comment
Share on other sites

Erone. Why would there be more than one of any type? Or do I misunderstand the question?

This question comes from the fact that some sentence types seem to come less than other (i.e. GSV sentences)

I think some sentences, like the ones providing stellite details, can only hold a limited number of such. If you had, say, 15 satellites being received you'd need several successive copies of such a sentence to convey all their positions/times.

But as far as FS data is concerned you only need the position, the altitude, the ground speed, and these only once per interval.

If you try CEmonitor, you'll see that by default it's configured to ask the GPS receiver to send 1 GGA sentence every second, and 1 on the other side 1 GSV sentence every 5 seconds.

You've lost me there I'm afraid. I don't know a "CEmonitor", and I don't know how the GPS receiver "asks" for sentences -- the NMEA 0183 protocol appears to be one-way.

But, maybe there is no problem to send all the sentences every second, unless it reaches 480 bytes.

There shouldn't be a problem -- it's just something to watch.

If you've a technical interest in my code (maybe), I'll send it to you when it's finished. ;)

Thanks for the offer. I'm not sure what I'd be able to do with it though. ;-) But are you going to publish the actual program?

Regards,

Pete

Link to comment
Share on other sites

You've lost me there I'm afraid. I don't know a "CEmonitor", and I don't know how the GPS receiver "asks" for sentences -- the NMEA 0183 protocol appears to be one-way.

Cemonitor is a small PocketPC app that allows you to see the received NMEA sentences, but it also allows you to setup your GPS antenna (if it supports it). In this setup, you can ask your GPS to send data in NMEA or Sirf format, and you can also setup the sentences it will transmit to your Pocket PC. For example 1 GGA sentence every second, one GSV every 5 seconds,....

To summarize, The NMEA protocol is one way, but you can send data to the GPS receiver to configure it.

Thanks for the offer. I'm not sure what I'd be able to do with it though. ;-) But are you going to publish the actual program?

I will ask the programmers of the original extraction code if they allow me to use their code in my program. Then if they agree, I'll put it as free on the Internet. If they don't, I'll try to do the extraction part by myself.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.