Passing a Command to a Comm Port Using C#'s SerialPort Class

余生颓废 提交于 2019-12-13 16:57:15

问题


I'm currently trying to pass a specific command from an example test application written in VB6. In VB6 the command looks like:

Comm1.Output = "UUT_SEND ""REMS\n"" " + Chr(10)

Currently I'm trying to figure out how to pass that same data via C#'s SerialPort class.


回答1:


sending stuff out the serialport is relatively straight forward....

var serialPort = new SerialPort("COM1", 9600);
serialPort.Write("UUT_SEND \"REMS\\n\" \n");

To get any responses you will have to hook the DataReceived event.



来源:https://stackoverflow.com/questions/17535998/passing-a-command-to-a-comm-port-using-cs-serialport-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!