关于USB控制开关的使用问题

lc_apple 2021-03-02 10:55:44
想做一个电源控制程序(制作环境:64位WIN10+VFP9),随从网上选购了一个USB控制开关,

这开关由于太过简陋,说明只有
一,How to use in Vistual Studio.
1. Creat a new C++ Porject
2. In stdfax.h file, add this code:
#include "usb_relay_device.h"
#pragma comment(lib, "usb_relay_device.lib")
3. Copy the usb_relay_device.dll file into the dir that generate your applicaiton. Like the Release or Debug dir
二、The way to use funcation:
1. call usb_relay_init() to init the lib.
2. call usb_relay_device_enumerate() to get all the device pluged into pc
3. call usb_relay_device_open() open the device you need
4. other operation funcation:
call sb_relay_device_open_one_relay_channel() to open one way relay
call usb_relay_device_open_all_relay_channel() to open all relays
call usb_relay_device_close_one_relay_channel()to close one way relay
call usb_relay_device_close_all_relay_channel()to close all relays
和一个C++做的小示例程序

开始制作,按照说明,这个开关确实简单,但在VFP中使用也相当方便,初始化,查找设备,打开设备,发送开关信号,关闭设备,很快就做好了程序,开关功能顺利实现。
但在反复测试中发现一个问题:发送开的命令时,随机的会有一次失效,开不了,频率不高,关没有问题。
如果一次没开了,再来一次又好了,一直弄不明白是啥原因,也解决不了这个问题。

盼各位能帮帮忙,谢谢了!
...全文
435 回复 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

2,748

社区成员

发帖
与我相关
我的任务
社区描述
VFP,是Microsoft公司推出的数据库开发软件,用它来开发数据库,既简单又方便。
社区管理员
  • VFP社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧