-
September 14th, 2013, 12:46 PM
#1
Serial port (com port) reading data
-
September 17th, 2013, 10:23 AM
#2
Re: Serial port (com port) reading data
That is not gibberish. It is formatted numeric data. You need to write your code so that it picks up the start and end characters and grab the data that is between those characters rather than just dumping it all into a text box. Sometimes you will see a partial string in any given read and sometimes you will see more than 1 string or even more depending on how the device is sending data and what your program is doing.
Typically when i write something that is going to be receiving data be it serial or TCP I will append the data to a buffer var then I will check that buffer var for the terminator character/sequence.
If there is a terminator there then I pull the data from the buffer var up to that terminator, put that in my Action var and save the rest back into the buffer var.
Process the data in the action var
Check the buffer for additional terminators and repeat until all items have been processed.
Always use [code][/code] tags when posting code.
-
September 17th, 2013, 11:24 AM
#3
Re: Serial port (com port) reading data
Data miser is correct, this looks to be formatted data from the uits output buffer.
Your code is just reading the output of the unit, and not actually getting the formatted data as the specification define. Typically, this is obtained by a command and responce system, i.e. you send a command and get a formatted responce data packet.
Learn to send commands to the unit and then manually try to intepret the data from the specifications. Once you can do that, you can program your system accordingly.
There are 10 types of people in the world, those that understand binary and those that don't.
Using VS 2010
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
|