我的任务是打开、写入、阅读响应,然后关闭通信端口。所以为了
- 打开Com端口1波特率9600 8、N、1或8无和1
- 将字符串写入仪器“#AddressReading”+返回字符
- 等待并逐渐阅读回应
- 关闭com端口,几分钟后再使用它
我用的是32位的win操作系统,我试过几种不同的方法-
https://gist.github.com/heiswayi/f47dfd8dc38955322bef
这涉及到集成win32.dll,我无法弄清楚如何在VBA Excel中调用win32
What is the best way to access a serial port from VBA?
这只是导致excel崩溃,每次我试图修改和运行代码...不确定再次这是否与睡眠功能有关或没有。
我发现的另一件事是一堆SDK的成本方式出我的预算库VBA串行通信。
1条答案
按热度按时间mspsb9vt1#
类似于Read from Serial port to Excel,我修改了它来回答这个问题。