在Visual C ++中访问USB端口 [英] Accessing USB Port in Visual C++

查看:98
本文介绍了在Visual C ++中访问USB端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Friends,

我是一名电子工程专业的学生,​​目前我不知道接口是什么,但我需要使用USB将我的一台设备连接到电脑,因为我的lappy没有任何串口。请帮助我提供一些非常简单的方法来访问控制台模式应用程序和Windows API中的Visual C ++中的USB端口,因为我使用opencv进行一些图像处理部分,它被设计为windows控制台应用程序。

谢谢

问候

Tushar Srivastava

Hello Friends,
I am an electronics engineering student and currently I don't know about interfacing but I am required to interface one of my device to pc using USB since my lappy doesn't has any serial port. kindly help me by providing some very simple method to access USB port in visual C++ in in console mode application and NOT windows API since I am using opencv for some image processing part and it is designed as windows console application.
Thank you
Regards
Tushar Srivastava

推荐答案

http://www.waitingforfriday.com/index.php/Building_a_PIC18F_USB_device



将有所帮助已完整。
http://www.waitingforfriday.com/index.php/Building_a_PIC18F_USB_device

will be help full.


通常设备制造商提供 API ,用于将设备与 PC (阅读文档)。通常(对于低速设备),它们提供串行端口仿真器,即使用标准 RS232 通信与设备通信(再次查看设备文档)。 br $> b $ b

关于 Windows API

Windows 操作系统,它提供的 API 不仅仅是用于'windows'的那些。特别是串行通信(包括 USB )功能随时可用于控制台应用程序。





[update]

如果你使用 FTDI 筹码芯片那么(假设相应的话)驱动程序已安装在您的PC上)您使用标准 RS232 API 与其进行通信(例如:在MSDN上使用通信资源 [ ^ ])。

另一方面,你通常有一个带有 UART 设备的微控制器。

[ / update]
Usually the device manufacturer provides an API for interfacing the device with the PC (read the documentation). Very often (for low speed devices) they provide a serial port emulator, that is you communicate with the device using standard RS232 communication (again, check out your device documentation).

As about Windows API:
Windows is the Operative System, the API it provides are not only the ones used for 'the windows'. Specifically serial communication (USB included) functions are ready-to-use for console applications.


[update]
If you are using the FTDI chip a chip then (assuming the corrensponding driver is installed on your PC) you use standard RS232 API for communicating with it (see for instance: "Using Communication Resources" at MSDN[^]) on the PC side.
On the other side you typically have a, hopefully, a microcontroller with UART device.
[/update]


要访问USB设备,您必须使用设备制造商(或t的制造商)提供的库与设备特定的USB驱动程序通信。他使用USB接口芯片)。如果不了解使用过的设备,没有人可以帮到你。



控制台应用程序可以调用Windows API函数(大多数现有的控制台应用程序都可以这样做)。如何在不使用API​​函数的情况下从控制台应用程序访问文件或串口?



如果您对接口编程知之甚少,并且您的设备有串口,您可以购买USB转RS232转换器。此类转换器提供虚拟串行端口接口,可以像物理端口一样访问。
To access USB devices you must talk with the device specific USB driver using a library provided by the device manufacturer (or the manufacturer of the used USB interface chip). Whithout knowledge about the used device, nobody may help you here.

Console applications can call Windows API functions (and most existing console applications do so). How would you access a file or a serial port from a console application without using API functions?

If you don't know much about interface programming and your device has a serial port, you may buy an USB-to-RS232 converter. Such converters provide a virtual serial port interface that can be accessed like a physical port.


这篇关于在Visual C ++中访问USB端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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