问题
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