By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,230 Members | 2,471 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,230 IT Pros & Developers. It's quick & easy.

writing ASCII data with the SerialPort component

P: n/a
Hello, I am using Visual Studio .Net 2005 beta. I have my computer's two
comm ports connected with a serial cable (and null modem). I'm trying to
write the letter 'a' out on comm port 1 with the C# program and see it appear
in a Hyperterminal window open on comm port 2. Hyperterminal is configured
with the same settings that the port 1 is opened with (see below), but I do
not get an 'a', I get some funky ASCII character that looks like a spade with
a little block after it. What do I need to do differently?

public String commPortStr = "COM1";
public SerialPort commPort;

commPort = new SerialPort(commPortStr, 19200, Parity.None, 8, StopBits.One);
commPort.Open();
char[] test = new char[1];
test = 'a';
commPort.Write(test, 0, 1);
Thanks,
Don

Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Doh! Nevermind. I had forgotten to change the baud rate in another part of
the code where the SerialPort component was created. Dopey me.

Don

"Don Tucker" wrote:
Hello, I am using Visual Studio .Net 2005 beta. I have my computer's two
comm ports connected with a serial cable (and null modem). I'm trying to
write the letter 'a' out on comm port 1 with the C# program and see it appear
in a Hyperterminal window open on comm port 2. Hyperterminal is configured
with the same settings that the port 1 is opened with (see below), but I do
not get an 'a', I get some funky ASCII character that looks like a spade with
a little block after it. What do I need to do differently?

public String commPortStr = "COM1";
public SerialPort commPort;

commPort = new SerialPort(commPortStr, 19200, Parity.None, 8, StopBits.One);
commPort.Open();
char[] test = new char[1];
test = 'a';
commPort.Write(test, 0, 1);
Thanks,
Don

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.