Garmin gps18x VB.NET字符串错误 [英] Garmin gps18x VB.NET string error

查看:104
本文介绍了Garmin gps18x VB.NET字符串错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!我有这个Garmin GPS18x模块。我通过串口接口插入它。我可以从我的vb.net应用程序连接到它。但是当我从中读取数据时,我只是得到了奇怪的消息。我有什么想法吗?



text =& vbCr&?? K?n ??? K ????? ?? ? ?? L?& vbCr&@? J′一世? B' ?B L? ?A C?n ?? ? ?





Hello! I have this Garmin GPS18x module. I plugged it via a serial port interface. I can connect to it from my vb.net application. But when I read data from it, I just get weird messages. Any ideas what I'm doing wrong?

text = "" " & vbCr & "??K?n???K?????? ? ?? L ?" & vbCr & "@? j? i? B? ?B L? ?A C"?n? ?" ? ?""


Dim serialport As New SerialPort
serialport.PortName = "COM9"
serialport.BaudRate ="4800"
serialport.StopBits = 1
serialport.Open()
Dim text As String = serialport.ReadLine()
System.Console.WriteLine(text)





我尝试过的事情:



我已经尝试了一切,不知道是什么别的事呢?我的串口有问题吗?或者是gps坏了?



What I have tried:

I have tried everything and do not know what else to do? Is ther something wrong with my serial port? Or is the gps broken?

推荐答案

首先,一个com端口有更多重要的设置!字符大小(7或8位)和奇偶校验。



建议:使用终端模拟器(如超级终端)并使用设置,直到找到正确的参数组合。
First of all, a com port have more settings that matters ! Char size (7 or 8 bits) and parity.

Advice: use a terminal emulator like HyperTerminal and play with settings until you find the right combination of parameters.


一旦你确定串口设置是正确的,你可以尝试解码消息(据我所知,从产品演示中)是' NMEA 0183格式(行业标准) )'或'专有的Garmin格式'。

由于您收到的消息看起来不是有效的NMEA消息,您可以尝试使用Garmin格式。
Once you are sure the serial settings are correct, you could try to decode the message which (as far as I can understand from product presentation) is either 'NMEA 0183 format (industry standard)' or 'proprietary Garmin format'.
Since the message you received doesn't look a valid NMEA one, you could try to interpret it using the Garmin format.


根据数据表( [ ^ ])有不同的版本,具有不同的串行接口规范:

GPS 18x USB,GPS 18x PC,GPS 18x LVC和GPS 18x-5Hz。

如果你有5Hz版本你必须使用19200波特。



According to the data sheet ([^]) there are different versions with different serial interface specifications:
GPS 18x USB, GPS 18x PC, GPS 18x LVC, and GPS 18x-5Hz.
If you have the 5Hz version you must use 19200 baud.

引用:

GPS 18x LVC和GPS 18x-5Hz:0 V dc至Vin,4至5.5 V dc(异步串行,TIA-232-F(RS-232)兼容极性)

GPS 18x LVC and GPS 18x-5Hz: 0 V dc to Vin, between 4 and 5.5 V dc (Asynchronous Serial, TIA-232-F (RS-232) Compatible Polarity)

表示接口使用逻辑电压电平(TTL, GND和5 V),而RS-232使用+/- 3至15 V(参见 RS-232 - 维基百科 [ ^ ])。因此它无法连接到PC的串行端口。相反,必须使用RS-232电平转换器。



最后,可能需要反转接收的数据(Compatible Polarity表示输出被反转与RS-232一样,但RS-232电平转换器将再次反相,串行TTL输入不会反转)。

indicates that the interfaces use logic voltage levels (TTL, GND and 5 V) while RS-232 uses +/- 3 to 15 V (see RS-232 - Wikipedia[^] ). So it can't be connected to the serial port of a PC. Instead, a RS-232 level shifter must be used.

Finally, it might be necessary to invert the received data ("Compatible Polarity" indicates that the output is inverted like with RS-232 but RS-232 level shifters will invert again and serial TTL inputs will not invert).


这篇关于Garmin gps18x VB.NET字符串错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆