writing ASCII data with the SerialPort component

G

Guest

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top