Common Lisp 中的串口通信
Windows 上的 Common Lisp 中有用于串口通信的库吗?
Is there a library for serial port communication in Common Lisp on Windows?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
Windows 上的 Common Lisp 中有用于串口通信的库吗?
Is there a library for serial port communication in Common Lisp on Windows?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
下面是一些使用 SBCL 外部函数 POSIX 调用来实现串行通信的函数。它不像完整的库那么好,但我解决了根据此协议与设备通信的问题
package.lisp:
serial.lisp:
focus.lisp:
Here are a few functions that implement serial communication using SBCL foreign function POSIX calls. Its not as nice as a full library but I solved my problem of talking to the device according to this protocol
package.lisp:
serial.lisp:
focus.lisp:
我不知道是否有免费的,但 LispWorks 有一个 - 串行端口。
如果做不到这一点,您可能必须自己编写。您可以尝试简单地为 Windows 调用编写 FFI 包装器 (GetCommState、WaitCommEvent 等)作为开始。这肯定是可行的。
I don't know if there's a free one available, but LispWorks has one - SERIAL-PORT.
Failing that, you might have to write your own. You could try simply writing the FFI wrappers for the Windows calls (GetCommState, WaitCommEvent, etc.) as a start. It's most certainly doable.
这并不是一个真正的口齿不清的问题,但无论如何我都会尝试回答它。简短的回答:不。长答案:可能。这取决于 FFI 的工作方式以及您使用的环境(原始窗口、cygwin、mingw)如果您使用原始窗口,那么机会非常渺茫。事实上,无论哪种方式,我敢打赌机会都很渺茫。 Lisp 是一种相当高级的语言,并不是为此类事情而设计的。
This isn't really a lisp question, but I'll attempt to answer it anyway. Short answer: no. Long answer: possibly. It depends on how the FFI works and what environment you're using(raw windows, cygwin, mingw) If you are using raw windows, the chances is very slim. Actually, either way I'd bet the chances are slim. Lisp is a fairly high-level language, and isn't designed for stuff such as this.