LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP Data stream

Solved!
Go to solution

I hope I done it right,

sorry I know Im annoying, but Im trying to learn how to work with it. And thanks for your patience..

0 Kudos
Message 31 of 43
(928 Views)

Is this data in the ASCII format or the Binary format?

 

If binary, then you should be reading 16 bytes: 8 for the timestamp and 8 for the first channel's data.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 32 of 43
(923 Views)

Hi lepina,

 

right now you only show the string data of the last 4 bytes, but not the first 4 bytes - or the whole received string.

- The last 4 bytes contain just readable chars: are you sure you receive "binary encoded data"???

- When you want to typecast just 4 bytes you (usually) should typecast to SGL instead of DBL!

- Typecasting the string "852 " to SGL gives 4.32004e-5 - is this reasonable?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 33 of 43
(920 Views)

Im sending it as text, here a new VI , I put the indicator before the "search split string"

0 Kudos
Message 34 of 43
(915 Views)

Hmm the interesting thing is (or maybe Im wrong), the first value of the string should be Time. but when I start the data stream the first value isnt increasing linear like in mili seconds, its just giving some (sort of random) numbers out.

0 Kudos
Message 35 of 43
(910 Views)

The Vi that you posted appears that you are receiving the data in ASCII format and that you are not receiving all of the data. The format of the ASCII data will be a timestamp with a space character separating it from the value. Each value is separated by a space character. It appears that the data is using a comma, ',' for the decimal point. The data stream for a single set of values is terminated by a CRLF. So when you are reading 8 bytes are only reading the timestamp. If you look at the data you received it is "54,146\s". That is the timestamp representing 54.146 ms from when the stream started. Since the EMG sensor only has one channel you will only have one value following the timestamp. That value will be followed by a CRLF, "\r\n". If you use the ASCII format you can change your read to read until your receive the new line character, "\n".

 

Give this one a try.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 36 of 43
(906 Views)

Hey Mark

I tried the VI u sent me, it is a step forward. it shows me now the timestamp, and the signal value in the "raw data" indicator.

and the splitted array as a timestamp, however I am not able to see the splitted signal value. It shows only a blank indicator where the signal value should be.

I am wondering wheres the problem so I cant see the signal value on the indicator and graph.

if you have time you can take a look

thanks in advance

0 Kudos
Message 37 of 43
(891 Views)

Please post the raw data that you are receiving. Also, the constants on your search and replace are not correct. You have the space character in all of the constants which means you are searching for a space character (which will not be present given the regular expression which parses the raw data) and replace it with a space character. In effect, that code will accomplish absolutely nothing. If you look at the code I sent the search character is a comma (') and the character to replace it is a period (.). From the documentation the numbers are returned in the following format (5,36) which needs to be in the form of 5.36 for the conversion to a number to work properly.

 

However, what I need to really help is the exact data which is displayed in the Raw Data indicator.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 38 of 43
(883 Views)

So this is how the indicator looks like

The time stamp increases in seconds and the signal increases when I flex my arm (how it is supposed to be)

 

Unbenannt.jpg

0 Kudos
Message 39 of 43
(868 Views)

To decode your data, use the Spreadsheet String To Array.  It looks like you are using the comma as the decimal separator, so you should use "%,;%f" as your format.  The "%,;" part states to use the comma as the decimal separator.  Things tend to default to a period.  So your output should be an array of numbers.  The first element will be your time and the second your signal.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 40 of 43
(865 Views)