Quote:
Originally Posted by KevinH
Hi Steffen,
I am not sure I understand
If I assume the following (note tag1 has more than 1 bit set in its mask)
tag 1 has bitmask 0x03 and requires 1 value be read in as field 1
tag 2 has bitmask 0x01 and requires 1 value be read in as field 2
tag 3 has bitmask 0x02 and requires 1 value be read in as field 3
tag 4 has bitmask 0x08 and requires 1 value to be read in as field 4
And if type == 0x07:
I would read in the first value as field 1, next value as field 2, next value as field 3 and no further values would be read in for this particular entry since the bitmask & type != bitmask for tag 4.
|
0x07 = 0b00000111
Tag 1:
0x03 = 0b00000011
0x07 AND 0x03 = 0x03
This would mean that we have 3 values of tag 1. But as I've said, for multi-bit masks a result of all ones (like in this case) the real number can be anything > 2 and you have to read one byte (or a multibyte value, don't remember which one) to get the real number of tag 1.
If type would be 0x06 instead of 0x07:
0x06 and 0x03 = 0x02
This would mean we have 2 values of tag 1
Tag2:
I'm confused. The mask 0x01 collides with the mask 0x03. It's not possible to have a tag with mask 0x01 and another with mask 0x03 in the same control byte.
The control byte works as follows. You have one byte (8 bits) and want to encode the number of tag values for several tags with these 8 bits.
If a tag can occur only once, you need one bit. If it can occur several times, you need more bits. All masks I've seen so far had a maximum of 2 bits.
Let's say you have 3 tags with one bit and one tag with two bits than you should see the following masks:
0b00000001 = 0x01 for tag1
0b00000010 = 0x02 for tag2
0b00000100 = 0x04 for tag3
0b00011000 = 0x18 for tag4
A control byte of 0x15 would then decode as:
0b00010101
1 * tag 1
0 * tag 2
1 * tag 3
2 * tag 4
I hope it's now clear what I mean.
Ciao,
Steffen