如何使用Delphi Prism进行串口通信?
我对 Delphi Prism 非常陌生。事实上,你甚至可以说我是一个新手,但我已经用 Delphi 编程了 10 年了。我能够将在以前版本的 Delphi 中编写的遗留软件移植到 Delphi 2010。现在,我准备使用 Delphi Prism 为 WEB (ASP.NET) 的 Delphi.Net 编写相同的软件。对于我的一生,我似乎无法理解 Delphi Prism 的总体布局或工作原理。我已经阅读了教程和示例,甚至在 Stackoverflow 上搜索了示例和代码。尽管如此,我似乎还是无法理解 Delphi Prism,尽管我已经花了整整一个星期的时间来玩 Delphi Prism IDE。
网上有人说,只需使用.NET框架,就可以将一个窗口独立程序编写为完全用于Web的程序。
现在我只是尝试使用 SerialPort 组件创建一个 Web 表单以在 comport 上进行通信。我能够设计网页控件(按钮、标签)...该程序在本地主机启动时编译并加载。我在浏览器上看到按钮,但它无法在串行端口上进行通信。
我很困惑。看来我做得不对。有人能给我一个 Delphi Prism SerialPort 组件使用的例子吗?
我不确定是我安装了它还是它随 Delphi Prism IDE 一起提供。但是,如果启动 Delphi Prism 后查看“组件”部分下的工具箱,您将看到一个名为 SerialPort 的组件。显然,它是 Microsoft .NET Framework 的一部分。
我想问如何使用 Delphi Prism IDE 附带的串行端口组件。
非常感谢,
I am very much new to Delphi Prism. In fact, you can even say I am a newbie, but I have programmed in Delphi for the last good 10 years. I was able to port our legacy software that was written in previous version of Delphi to Delphi 2010. Now, I am ready to write the same software for Delphi.Net for the WEB (ASP.NET) using Delphi Prism. For the life of me, I can't seem to understand the overall layout or idea of how Delphi Prism works. I have gone through tutorials and examples and even searched on Stackoverflow for samples and codes. Still, I can't seem to understand Delphi Prism, even though I have already spent a whole week just playing around with Delphi Prism IDE.
Someone online said that one can take a window standalone program and write it entirely for the web by just using .NET framework.
Right now I am simply trying to create a webform with SerialPort Component to communicate on the comport. I was able to design the webpage controls(buttons, labels)... The program compiles and loads with a localhost started. I see the buttons on the browser, but it won't communicate on the serialport.
I am confused. It looks like I am not doing it right. Can someone give me an example of Delphi Prism SerialPort component usage?
I am not sure if I installed it or it came with the Delphi Prism IDE. However, if you look in the toolbox under Components section after starting Delphi Prism, you will see a component called SerialPort. Apparently, it is part of Microsoft .NET Framework.
I meant to ask how one would use the serial port component that came with the Delphi Prism IDE.
Thank you much,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须寻找 .Net 串行端口组件,而不是寻找用于串行端口的 Delphi prism 组件。您可以使用这篇文章
SerialPort(RS-232 串行 COM 端口) C# .NET
作为有关此主题的指南。现在检查这个处理串行端口通信(仅接收数据)的delphi prism类。
注1:
OutLog
只是一个记录函数,您可以注释对此函数的调用。注2:此代码必须从服务器端运行。
Instead of looking for a Delphi prism component for Serial Port , you must look for an .Net Serial Port component. You can use this article
SerialPort (RS-232 Serial COM Port) in C# .NET
as guide about this topic.Now check this delphi prism class which handle the Serial Port communication (only receive data)
Note 1 : the
OutLog
is just a function to log , you can comment the calls to this function.Note 2 : This code must run from the server side.