So what is the problem here? You can't read the data received, or you cant figure out how to encode \004 properly?
sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735
Write the byte[] array of data received to a text file and upload it, please specify the encoding as well.
Here is how you would get the ascii encoded character:
string s = ASCIIEncoding.ASCII.GetString(new byte[] { 4 });
sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735
At this point:
1. Can you send data across the serial port?
2. Does the device receive the data you send across the serial port?
3. Does the device respond to command sent?
4. Are you receiving the data from the response?
5. How are you receiving the response? In an event, trying to read the buffer?
6. Can you write the byte[] buffer of the response to a text file and upload it?
string PortData = serialPort1.ReadExisting();
You probably want to pick another method to read data off the serial port -- not using strings
sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735
Sometimes manufacturers pick control characters that are not found to be sure they don't have a conflict with any existing structures -- you said you wanted to send a character 4, i assumed 4 was the byte's value?, and you sent it -- but it is not correct?
sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735
albay,
Please do not resurrect threads that are years old. By doing so you run the risk of confusing current posters.Have a look at forum rules .
__avd
Posting Genius (adatapost)
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241