(Moved from General Category)
In the course of Work (mutter, mutter) I have come across an oddity I wrote a C# program to communicate via the serial ports which worked fine until a few weeks ago. Some of our boards will now not work with my program so have gone back to try to emmulate HyperTerm which will do the job I have managed to get the out put to appear in real time as it is typed with a Rx Tx short (no click send button for text to be sent as a string) but the board sees the data (a flashing LED will indicate that data is being recieved) but the 12 Volt relay is not switched the input routine I am using is :
private void rtbOutgoing_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)13) // enter key
{
myComPort.Write("\r\n");
Thread.Sleep(200);
tmrPollForRecievedData.Enabled = true;
rtbOutgoing.Text = "";
} else if (e.KeyChar < 32 || e.KeyChar > 126)
{
e.Handled = true; // ignores anything else outside printable ASCII range
} else
{
myComPort.Write(e.KeyChar.ToString());
}
}
This appears to do every thing but the intended to the board I don't want to point fingers and cause my self to look like an idiot if there is a fault at my endbut will this act like Hyper Term?
Glenn
The flashing LED says that data is being received, but you suspect it's not the correct data? Is the relay supposed to open or close every time you send a keypress, or is the firmware reading commands such as "open relay", "close relay", etc.?
I don't know what you mean by this:
I have managed to get the out put to appear in real time as it is typed with a Rx Tx short
In any case, I would suggest using whatever debugging tools you have to find out exactly what the device is receiving. Also check to be sure the port parameters (baud rate, stop and start bits, parity) match.
Jan