|
-
August 6th, 2009, 10:47 AM
#1
C# SerialPort Class
Q. I'm trying to write a string of characters to the serial port, which is successful, However as soon as i try and read back what has been sent, it only reads half of the the data initially sent. can anybody please help? Do i need some sort of a delay when reading or sending?
Code:
serialPort1.Open();
serialPort1.Write("Communications Solutions");
recieved_data = serialPort1.ReadExisting();
textBox1.Text = recieved_data;
serialPort1.Close();
// Recieved_data only displays half the characters in the text box.
-
August 7th, 2009, 10:07 AM
#2
Re: C# SerialPort Class
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
August 7th, 2009, 11:36 AM
#3
Re: C# SerialPort Class
When you send data, it uses a transmit buffer and when you receive data it uses a receive buffer. You're essentially using two different buffers for serial communication.
If you want to get some of the data "back" that you've sent, you'll need to use whats called a null modem or use a boomerang application that will receive the data on the other end and write it back to the serial port.
I'm studying serial communication with the 8051 architecture and it explains a lot of how serial ports work. I even have to generate my own baud rates! haha
R.I.P. 3.5" Floppy Drives
"I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones." - Albert Einstein
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|