12-21-2017 08:29 AM
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..
12-21-2017 08:39 AM
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.
12-21-2017 08:43 AM
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?
12-21-2017 09:05 AM
Im sending it as text, here a new VI , I put the indicator before the "search split string"
12-21-2017 09:27 AM
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.
12-21-2017 09:45 AM
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.
01-10-2018 09:38 AM
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
01-10-2018 10:00 AM
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.
01-11-2018 06:57 AM
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)
01-11-2018 07:43 AM - edited 01-11-2018 07:44 AM
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.