Specifications
5.5. SOFTWARE
5.5.3 Decode Stage
Figure 5.10 shows a simplified flowchart of the decoding stage. Decoding
begins by looking for a start byte. The Read-Only tags employed in this
system have a start byte of 0x7E, or binary 01111110. All bits prior to the
start byte are 0. If it is known that all tags are of this RO variety, it is a simple
case to look for the first occurrence of a “1” bit in the incoming stream. This
system proved sufficiently reliable to forestall the use of more complicated
searches involving correlation of the received bits with the expected start
byte. If no start byte is found within the first 200 samples, then a “no tag
found” report is generated and no further decoding takes place. If a start
byte is found within the first 200 samples, decoding continues.
Assuming a start byte is found, decoding takes place as follows: a loop
executes which averages every four entries in the buffered array beginning
directly after the start byte. This averaged value is compared to a predefined
bit-threshold which is set by default to
57+65
2
= 61 (recall that the differences
are expected to be either 57 or 65 depending on the bit received). This bit
stream is stored in two arrays of 8 bytes and 2 bytes representing the ID of
the tag and the BCC (CRC checksum) respectively.
CRC Check The CRC checking is performed on-the-fly during decoding
on a bit-by-bit basis on the incoming bit stream as illustrated in Figure 5.11.
Recall that the CRC-16-CCITT checksum polynomial is x
16
+ x
12
+ x
5
+ 1.
This is stored in a 16 bit integer variable with the value of 0x1021.
The CRC shift register is initialised to zero before each read. If the check
was successful, the final result will also be zero. Any other value in the shift
register indicates a verification failure. Please refer to Section 5.3.2 for CRC
operation details.
Result Reporting One of three possible responses will be returned:
1. Tag successfully decoded
2. CRC check failed
6
32M Hz ÷ 4
48