与 u-blox gps 的 C# 串行通信

C# serial communication with u-blox gps(与 u-blox gps 的 C# 串行通信)
本文介绍了与 u-blox gps 的 C# 串行通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个来自 u-blox.com 的 GPS,带有 USB 连接和驱动程序.驱动程序会安装一个虚拟 COM 端口,当您插入 USB 时会弹出该端口.使用超级终端,我可以观察来自 GPS 的数据流.

I have a GPS from u-blox.com with a USB-connection and driver. The driver installs a virual COM port that pops up when you plug the USB in. Using a hyperterminal I can then watch the flow of data from the GPS.

那我要我程序里的数据,没那么容易……

Then I want the data in my program, not so easy...

我已经实现了一些使用 serialPort 类从 GPS 读取的方法,但没有成功.我之前用 C# 编写了几个串行设备读写器,但是这个让我停止了.

I have implemented some methods using the serialPort class to read from the GPS, but am unsuccessful. I have programmed several serial device readers and writers before in C#, but this one stops me.

例如,simpleSerial 中的简单代码不会给您任何东西,除非您拔下并重新插入USB.

As an example, the simple code in simpleSerial will not give you anything unless you unplug and replug the USB.

已尝试使用 matlab 读取它,效果很好,但由于需要 GPS 数据的程序的其余部分在 c# 中,这并不能完全解决问题.

Have tried reading it with matlab, which works great, but as the rest of my program that needs the GPS data is in c#, that doesn't quite fix the problem.

serialPort 类中是否有一些我可以规避的高级 C# 事情?或者在读取 USB 串行端口时是否存在任何已知问题,我认为它就像我的 GPS 一样工作?

Is there some high level C# things going on in the serialPort class that I can circumvent? Or is there any known problems reading USB-serialports, which I assume works like my GPS?

推荐答案

从 u-blox 支持中得到这个.

Got this from u-blox support.

以下十六进制命令将强制在 GPS 模块上重置看门狗.

The following hex command will force a watchdog reset on the GPS module.

B5 62 06 04 04 00 00 00 00 00 0E 64

B5 62 06 04 04 00 00 00 00 00 0E 64

这是 GPS 中 ARM7 uP 的低级命令它适用于所有 u-blox GPS 接收器.

this a low level command for the ARM7 uP in the GPS It works with all u-blox GPS receiver.

byte[] data = new byte[]{0xB5, 0x62, 0x06, 0x04, 0x04, 0x00,
                         0x00, 0x00, 0x00, 0x00, 0x0E, 0x64}; 
sp.Write(data, 0, data.Length);

它对我有用.

这篇关于与 u-blox gps 的 C# 串行通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)