本文介绍了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?

推荐答案



引用:

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(参见 [])。因此它无法连接到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字符串错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 08:16