LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Detecting 3 consecutive bytes in an array

Solved!
Go to solution
Highlighted

Hi all.

 

I have data packets of 1024 bytes coming in via the serial port. About 200 bytes (variable) is real data and the rest is padded with FF.  I need to detect the end of the real data. The value FF appears in the real data and even 2 consecutive FFs occasionally but I think it's safe to say it never appears 3 times in a row.

Any ideas as to how I can detect the end of the data?

Thanks.

Here's a typical packet

 

2847 0044 00B8 5601 0000 00F0 0300 0000 00EA 5401 00B8 5601 0000 0004 02FF FF64 00ED 5401 00FF FF64 0001 5501 00FF FF64 0015 5501 00FF FF64 0029 5501 00FF FF64 153D 5501 00FF FF64 0051 5501 00FF FF63 0065 5501 00FF FF63 0079 550100FF FF63 008D 5501 00FF FF63 00A1 5501 00FF FF63 00B5 5501 00FF FF64 00C9 5501 00FF FF64 00DD 5501 00FF FF64 00F1 5501 00FF FF64 0005 5601 00FF FF63 0019 5601 00FF FF63 002D 5601 00FF FF63 0041 5601 00FF FF64 0055 5601 00FF FF64 0069 5601 00FF FF64 007D 5601 00FF FF64 0091 5601 00FF FF64 00A5 5601 00FF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FF93 3693 7E

 

 

 

0 Kudos
Message 1 of 5
(564 Views)
Highlighted

You can use Match Pattern.vi

 

Using Match Pattern.png

 

Ben64

--------------------------------------------------
The best way to say thanks is to give kudos!
0 Kudos
Message 2 of 5
(530 Views)
Highlighted
Solution
Accepted by topic author ASH2020

@ben64 wrote:

You can use Match Pattern.vi

 

Using Match Pattern.png


If that was the actual ASCII display, yes.  But if using Hex display, you need something like this.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Message 3 of 5
(521 Views)
Highlighted

Thanks Ben. I didn't know about that. Doesn't work though, with FFFFFF.

0 Kudos
Message 4 of 5
(515 Views)
Highlighted

Thanks for that. The \\\ make all the difference. It works nicely!

0 Kudos
Message 5 of 5
(512 Views)