03-25-2021 02:19 PM
Hello,
I'm receiving serial data on LabVIEW and it's in string format. It's data from 2 sensors separated by , (2C in hex). I have attached front panel and block diagram for my program. I want separate strings and I'm stuck at this. The elements/ indicators always display zero, is it displaying numbers? I want to first separate the strings.
Regards
Shahid
03-25-2021 05:45 PM
Hi, engrmshahid!
Looks like you're doing correct string splitting. But what about the sensor data? What is the data format you're expecting? Looks like the data is not just simple numeric.
03-25-2021 07:53 PM
Thanks for the reply.
In attached front panel picture raw data is clearly shown in read buffer (hex) and concatenated response. I am using string to byte then index array to display the sensor data.
03-26-2021 02:29 AM - edited 03-26-2021 02:32 AM
Hi engrmshahid,
@engrmshahid wrote:
In attached front panel picture raw data is clearly shown in read buffer (hex)
No, it is not! You forgot to make the display style indicator visible for that string indicator!
Whenever the display style is not the default style you should make it visible, in controls, indicators and constants!
See this example:

Do you ALWAYS receive just 4 bytes?
Are there ALWAYS those "2c" bytes at 2nd and 4th position?
(When you receive binary data (like it seems) then it makes not much sense to use an arbitrary delimiter char as the data byte could have the same value aus your delimiter char…)
03-26-2021 08:24 AM
@GerdW wrote:
(When you receive binary data (like it seems) then it makes not much sense to use an arbitrary delimiter char as the data byte could have the same value aus your delimiter char…)
It makes no sense at all to even have a delimiter when dealing with raw/binary/hex data. But the data should have a structure so we can parse a full message. It is typical to have a start byte, a command byte and/or data length byte, the data, and finally a checksum. Then we can read 1 byte at a time looking for the start byte. We then read the command and/or length bytes, the data, and the checksum. We should then verify the checksum is correct in order to validate the message. The data should just be flattened data. No delimiters required since the message has the data defined.