Possible Encoding Q.

Hello all. I have what should be easy, but of course I am stumped :slight_smile:

I am trying to do a simple match of a binary value that resides in a string. The binary value of “11FF” is in the Preamble variable.

Preamble = InputQueue(i).MidB(1,2)
...
If Preamble = "11FF" then

I am trying to simply match this with “IF” statements unsuccessfully. I thought if it was a string I could just match it? :slight_smile: Any advice would be appreciated.
Thanks!
Mike

Are you sure the preamble is, literally, the string “11FF”, or is to the bytes &h11 followed by &hFF? If the latter, you would do:

if Preamble = ( ChrB( &h11 ) + ChrB( &hFF ) ) then ...

Ill post a pic of my IDE values… Thanks Kem!

Here is the Screen shot while debugging in the IDE:

Ugh!! Kem you are right! I keep forgetting to treat the string in 1 Byte chunks!! :slight_smile: Thanks!

if Preamble = ( ChrB( &h11 ) + ChrB( &hFF ) ) then ..

Right, bytes &h11FF. Do it as I posted above, or make Preamble a MemoryBlock and check the bytes directly.

EDIT: Cross-post. Glad it’s working.

Use a Structure on this end as well.

HeaderStructure.StringValue(TargetBigEndian) = InputQueue(i).LeftB(12)
if HeaderStructure.Preamble = &h11FF then

Awesome Thanks Tim!!! I didn’t think of that!