两个pic微通过两个FT232H到PC。 [英] Two pic micros through two FT232H to PC.

查看:133
本文介绍了两个pic微通过两个FT232H到PC。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

对此有任何想法。

我有两个带有pic micro的EasyPIC开发板,通过两个UM232R模块连接到PC上。它们正常启动并连接到各自的COM端口。当我在表单上放置两个串口并手动为它们分配COM端口时,一切正常。

但是,我不想手动完成。我希望我的应用程序找到端口(我的代码执行:找到COM端口,序列号和设备类型),创建串行端口然后将它们分配给所需的COM端口。

我的应用程序甚至这样做。

问题在于,当我尝试打开COM端口时,我有消息...拒绝访问...,因为FT模块已经打开了com端口。

我试图打开另外两个线程并在其中创建COM端口但是......拒绝访问... - 再次。

比我做了另一种方法:我是没有在表单上创建串口并直接写入FT设备,但结果是我所做的(通常按序列号打开FT模块)我的写入总是要在列表上的第一个设备 - 设备0。

如何强制应用程序分离模块并允许我独立使用它们。

我的代码有很多评论,而且我一直都没有在这里发布 - 等待想法。当我们解决问题时 - 将发布带有英文注释的整个代码!

提前谢谢。

Hi!
Any idea about this.
I have two EasyPIC development boards with pic micros on them attached to PC by two UM232R modules. They boot up properly and had connected to their respective COM ports. When I put two serial ports on a form and manually assign COM ports to them everything works fine.
But, I do not want to do it manually. I want my application to find the ports (which my code does: find the COM ports, serial numbers and device types), create serial ports and then assign them to desired COM ports.
And my application even does that.
The problem is in that when I try to open COM ports I have message "... access denied..." because the com ports are already opened by FT modules.
I tried to open another two threads and to create COM ports in them but the "... access denied..." - again.
Than I made another approach: I am not creating serial ports on a form and write directly to FT device but the result is that what ever I do (usually open FT modules by serial number) my write is always going to first device on list - device 0.
What to do to "force" the application to separate modules and to allow me to independently work with them.
My code has a lot of comments and at a time I am not posting it here - just waiting for ideas. When we resolve the problem - the whole code with comments in English will be posted!
Thanks in advance.

推荐答案

解决方案是使用FTDI D2XX驱动程序。比我有虚拟串口,可以直接使用其功能与FT232模块通信。有一个函数GetNumberOfDevices,所以我可以确定连接到我的电脑的模块数量。比我做了一个清单。 列表与LT;< FTDI>> 中并通过for()循环将它们添加到列表中。现在,我可以通过一些索引或序列号来汇集任何一个。

添加一个WndProc()当他们中的一些插入或拔出PC时,我正在监视。

工作正常。
The solution is to use FTDI D2XX driver. Than I have virtual serial ports and can talk to FT232 modules directly using its functions. There is a function "GetNumberOfDevices" so I can determine the number of modules attached to my PC. Than I made a list ex. "List<<FTDI>>" and added them by for() loop into the list. Now, I am able to pool any of them by some index or by serial number.
Adding a WndProc() I am monitoring when some of them is plugged or unplugged to/from PC.
Works fine.


这篇关于两个pic微通过两个FT232H到PC。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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