在 windows mobile 上使用虚拟 com 端口 [英] Using virtual com port on windows mobile

查看:72
本文介绍了在 windows mobile 上使用虚拟 com 端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台运行 Windows CE 5.0 的 Windows 移动设备.我现在想将硬件连接到 USB 端口,并通过将其配置为虚拟 com 端口并向其写入/读取字节来与硬件进行通信.

I have a windows mobile device which is running windows CE 5.0. I want to now connect a hardware to the USB port and communicate with the hardware by configuring it as a virutal com port and writing/reading bytes to/from it.

我是否必须为 Windows 移动设备编写虚拟 com 驱动程序?请注意,硬件设备只是发送/接收字节的设备..

Do i have to write a virual com driver for the windows mobile device? Please note that the hardware device that is just a device which sends/receives bytes..

我可以简单地使用 .net 框架的 SerialPort 类吗?

Can i simply use the SerialPort class of .net framework?

将设备连接到 USB 后,我如何知道设备所连接的 COM 端口?windows mobile 有设备管理器吗?

How will i know the COM port to which the device is connected once i connect it to the USB ? is there a device manager in windows mobile?

谢谢.

推荐答案

Windows Mobile != Windows CE 5.0,因此首先您需要验证您的硬件实际运行的是什么.其次,您必须验证USB 端口"是什么.USB 有两种模式"——主机和客户端——它们在物理上和软件上都不同.如果它是您将设备连接到 PC 所通过的端口,那么它就是一个客户端端口,将无法接受外围设备.

Windows Mobile != Windows CE 5.0, so first you need to verify what your hardware is actually running. Second, you have to verify what the "USB port" is. USB has two "modes" - Host and CLient - and they are different both physically and in software. If it's the port that you hoos the device to the PC through, then it's a client port and is not going to be able to accept a peripheral.

现在如果它是一个 CE 5.0 设备并且如果它是一个 USB 主机端口,那么我们将深入研究 USB 设备类型和操作系统驱动程序.它是一种什么样的设备?它是否已经充当串行设备(例如,它具有 FTDI 或 Prolific 芯片组)?如果是这样,只需安装正确的 CE 驱动程序即可.如果没有,那么您需要编写主机设备驱动程序以允许 USB 系统与该特定设备进行通信.该驱动程序的工作方式取决于硬件.

Now if it's a CE 5.0 device and if it's a USB Host port then we get down to the USB device type and the OS drivers. What kind of device is it? Does it act as a serial device already (e.g. it has an FTDI or Prolific chipset in it)? If so, just install the right CE driver and you're set. If it doesn't, then you need to write a host device driver to allow the USB system to communicate with this particular device. How that driver will work depends on the hardware.

端口名称是什么,这取决于主机驱动程序的注册表设置.通常它会从第一个可用端口开始(即,如果您的硬件已经有COM1:",那么它将从COM2:"开始),但这很容易被覆盖,因此请在注册表中进行验证.

AS to what the port name will be, that's up to the host driver's registry settings. Typically it will start at the first available port (i.e. if your hardware already has "COM1:", then it will start at "COM2:"), but that's easily overridden, so verify in the registry.

编辑

有关驱动程序实现的示例,请参见您 PC 上的以下位置(假设您已经安装了 Platform Builder - 我认为自 3.0 以来的任何版本 - 已安装):

For examples of the driver implementations see the following locations on your PC (this assumes you've got Platform Builder - I think any version since about 3.0 - installed):

%WINCEROOT%\PUBLIC\COMMON\OAK\DRIVERS\USB\CLASS\USBSER 用于基本 USB host 串行类驱动程序示例
%WINCEROOT%\PUBLIC\COMMON\OAK\DRIVERS\USBFN\CLASS\SERIAL 用于基本 USB 功能 串行驱动程序示例

%WINCEROOT%\PUBLIC\COMMON\OAK\DRIVERS\USB\CLASS\USBSER for a basic USB host serial class driver example
%WINCEROOT%\PUBLIC\COMMON\OAK\DRIVERS\USBFN\CLASS\SERIAL for a basic USB function serial driver example

这篇关于在 windows mobile 上使用虚拟 com 端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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