LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String data splitting in spreadsheet problem

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

Download All
0 Kudos
Message 1 of 5
(1,476 Views)

 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.

 

 

0 Kudos
Message 2 of 5
(1,437 Views)

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.

0 Kudos
Message 3 of 5
(1,423 Views)

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…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(1,410 Views)

@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.



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 5 of 5
(1,396 Views)