I have a C# window application that needs to talk to a stepper motor assembly over a serial port. When i run hyperterminal and pass commands they are accepted and returned with no issues.
In my application i open the port, send the first command and it returns no problem. The trouble is on any subsequent command issues nothing is sent or received. Same code, different result.
serialPort1.PortName = "COM6";
serialPort1.BaudRate = 38400;
code to fire command, where e is a single char (just for testing)
// If the port is closed, don't try to send a character.
if (!serialPort1.IsOpen) return;
byte data = StrToByteArray(e.KeyChar + "\r\n");
// Send the user's text straight out the port
serialPort1.Write(data, 0, data.Length);
code to listen for receipt of data
private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
string RxString = serialPort1.ReadExisting();
private void DisplayText(object sender, EventArgs e)
What could be the difference between what hyperterminal sends/receives and how I am doing it?
Thanks for any help, sorry if vague but i am new to serial program flow.