Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

In serial communication, upon request it sends 2 responses which is correct but i need to separate them in 2 different lines.

Solved!
Go to solution

Hi,

 

I need to know how to seperate the 2 or 3 responses upon a single request, for eg:

 

Request: 3B 16 XX XX XX XX XX

Respoonse i am getting as :  3B16 XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX

 XX3B 16XX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX  3B16 XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX 

 

I want to separate these 3 response which starts from 3B 16, is there any simple way to do that beacuse i can use the offset and separate them but it will become too messy.

 

Thanks 

Aniket

0 Kudos
Message 1 of 11
(5,733 Views)

Assuming LabVIEW, you could use Search/Split String inside of a loop or possibly Spredsheet String To Array.



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 2 of 11
(5,717 Views)

Ok...can you share one sample how to use it beacuse i have used this but not able to get the desired o/p. 

0 Kudos
Message 3 of 11
(5,715 Views)
Solution
Accepted by topic author aniketjha

I am making some assumptions on your data.  So you may need to post some examples if you need more help.



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 4 of 11
(5,711 Views)

Thanks for sharing the screenshot.

 

Now i know how to proceed further.....i will try in my actual programming and will let you know about the progress.

 

Cheers

0 Kudos
Message 5 of 11
(5,683 Views)

Hi,

 

I used your above sample in my code and instead of using 3B16 i am using 3B16 1724 & 3B16 1624, since i want these 2 frames  to be only displayed in the o/p but it is not spliting the result as per the expected, suppose 

 

3B16 1724 xxxx xxxx xxxx xxxx xxx3B 1616 24xx xxxx xxxx xxxx xxxx is the string

 

expected o/p should contains only below 2 frames

 

3B16 1724 xxxx xxxx xxxx xxxx xxxx

3B16 1624 xxxx xxxx xxxx xxxx xxxx

 

 

0 Kudos
Message 6 of 11
(5,651 Views)

Then just use a Search Split String



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 7 of 11
(5,637 Views)

Hi,

 

Thanks for sharing the screenshot,  i have to use the string subset to extract the whole frame based on the length.

 

string.jpg

 

3B16 1724 xxxx xxxx xxxx xxxx xxxx xxxx

3B16 1D24 xxxx xxxx xxxx xxxx xxxx xxxx

3B16 3B22 xxxx xxxx xxxx xxxx xxxx xxxx

 

In all the frame the 6th byte position and the Bit position from 0to2 need to compare to some values suppose 2or3 and based on that output me that whole frame which is single string like 3B16 1724 xxxx xxxx xxxx xxxx xxxx xxxx.

 

Thanks for your patience

0 Kudos
Message 8 of 11
(5,617 Views)

Use String To Byte Array to get an array of bytes.  Then Index Array to extract the exact byte you need to do the comparison with.  If you only want to compare specific bits, then AND the byte with a value that will make all of the bits you don't care about 0 and preserve the bits you do care about.



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 9 of 11
(5,613 Views)

Thanks,  got what i was looking for 🙂

 

Cheers

0 Kudos
Message 10 of 11
(5,583 Views)