串行字符串输出 [英] Serial String Output
问题描述
我是这个表格的新手并且通常不会用C编程#我是更多的SCADA / PLC / VB人员并且可以真正使用一些帮助。
我是目前正在WinCE 6中运行Beijer iX应用程序的HMI面板上,该应用程序使用C#作为其脚本。
然后我的问题,
我必须发送一个数据字符串(使用RS232端口)到另一台计算机(在电缆铺设船上进行测量),字符串需要由HMI标签数据库中的各种标签组成。
我可以访问COM端口和发送数据,但只能从屏幕按钮,我真的需要为此设置1秒计时器,到目前为止,我无法弄清楚如何构建要发送的字符串。
我很久以前就用VB编写了这个程序,但到目前为止C#让我难倒了
任何帮助/指针都会非常感激
谢谢
Rab
I''m new to this form and don''t normally program in C# I''m more SCADA/PLC/VB guy and could really use some help.
I''m currently working on an HMI panel running a Beijer iX application in WinCE 6, the app uses C# for its scripts.
My problem then,
I have to send a data string (using an RS232 port) to another computer (survey spread on a cable lay ship), the string needs to be made up from various tags from the HMI tag database.
I can access the COM port and send data out, but only from a screen button and I really need to setup a 1 second timer for this and so far I cannot work out how to build the string to send.
I have written this very program in VB a long time back but so far C# has got me stumped
Any help/pointers would be greatly appreciated
Thanks
Rab
推荐答案
最好的实现的方式即使用 SerialPort [ ^ ]类,有几个方法,属性和事件。
C#示例:使用C#和Whidbey的串行通信 [ ^ ]
基本串口侦听应用程序 [ ^ ]
VB.NET中的示例: http://msmvps.com/blogs/coad/archive/2005/03/23/SerialPort-_2800_RS_2D00_232-Serial-COM-Port_2900_-in- C_2300 _-。NET.aspx [ ^ ]
要在一段时间内发送/接收数据,使用计时器 [ ^ ] class,example:如何在C#中使用定时器控件 [ ^ ]
The best way to achieve that is to use SerialPort[^] class, with its several methids, properties and events.
Example in C#: Serial Communication using C# and Whidbey[^]
Basic serial port listening application[^]
Example in VB.NET: http://msmvps.com/blogs/coad/archive/2005/03/23/SerialPort-_2800_RS_2D00_232-Serial-COM-Port_2900_-in-C_2300_-.NET.aspx[^]
To send/receive data in a period of time, use timer[^] class, example: How to use timer control in C#[^]
这篇关于串行字符串输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!