SDAA287 March 2026 ADS112C04 , ADS112U04 , ADS114S06 , ADS114S08 , ADS122C04 , ADS122U04 , ADS124S06 , ADS124S08 , ADS125H01 , ADS125H02 , ADS1260 , ADS1261 , ADS1262 , ADS1263 , ADS127L01 , ADS127L11 , ADS127L14 , ADS127L18 , ADS127L21 , ADS131A02 , ADS131A04 , ADS131M02 , ADS131M02-Q1 , ADS131M03 , ADS131M03-Q1 , ADS131M04 , ADS131M04-Q1 , ADS131M06 , ADS131M06-Q1 , ADS131M08 , ADS131M08-Q1 , ADS7028 , ADS7038 , ADS7066 , ADS7067 , ADS7128 , ADS7138 , AFE78101 , AFE781H1 , AFE78201 , AFE782H1 , AFE88101 , AFE881H1 , AFE88201 , AFE882H1 , DAC60504 , DAC60508 , DAC61401 , DAC61402 , DAC61404 , DAC61408 , DAC61416 , DAC70504 , DAC70508 , DAC71408 , DAC71416 , DAC7750 , DAC7760 , DAC80504 , DAC80508 , DAC81401 , DAC81402 , DAC81404 , DAC81408 , DAC81416 , DAC8741H , DAC8742H , DAC8750 , DAC8760 , DAC8771 , DAC8775 , HDC3020 , HDC3020-Q1 , HDC3021 , HDC3021-Q1 , HDC3022 , HDC3022-Q1 , LMP90077 , LMP90078 , LMP90079 , LMP90080 , LMP90097 , LMP90098 , LMP90099 , LMP90100 , TMAG5173-Q1 , TMP114 , TMP126 , TMP126-Q1 , TMP1826 , TMP1827
In some CRC algorithms, the input or output data are reflected. In these cases, bytes enter in same order but the bits are reflected by reversing the bit order of each byte. This reflection is sometimes used for improving efficiency in the calculation or in reducing cost in shift register hardware implementation. In this example, the CRC-8-OneWire algorithm is altered to reflect both the input and output data.
Starting with the previous example created with CRC-8-One-Wire, a reflect() function is created for reflecting the data. The function in Figure 2-13 takes in a value (in this example, a byte) with a defined width and reflects the data.
The result of the reflect() function starts as 0h and steps through setting bits in the reflected order from the input data. Starting with an input byte, the output result is a bit reflection of the byte.
The new crc8OneWireZeroesInOutReflect() function has the same CRC polynomial (x8 + x5 + x4 + 1) as shown in a previous section but uses a different initial value (0x00). The only other changes are two additions of the reflect() function for calculating the CRC with input and output reflection. CRC code with input and output reflection is shown in Figure 2-14.
The input byte is reflected in the fourth line of the function as each byte is called. At the end of the crc8OneWireZeroesInOutReflect(), the resulting CRC also reflected. If the input reflection is not needed. The fourth line byte reflection can be removed. If the output reflection is not needed, the crc is returned at the end, not the reflected crc.
Details of the CRC-8-One-Wire algorithm with 00h initial value and input and output reflection listed in Table 2-6.
| CRC | Polynomial | Initial Value | Devices | CRC for 0xABC123 |
|---|---|---|---|---|
| CRC-8-One-Wire Input reflected, output reflected |
x8 + x5 + x4 + 1 (0x31) | 0x00 | TMP1826, TMP1827 | 0x86 |
As in the previous examples, if a user is making changes to the JavaScript, also change in the body text describing the CRC function including the input and output reflection. Then change the calculateCRC() function to call the new crc8OneWireZeroesInOutReflect().
The resulting CRC-8-One-Wire calculation with input and output reflection appears in Figure 2-15.
Figure 2-15 CRC Result for 0xABC123,
CRC-8-OneWire, Initial Value 0x00, Input and Output Data Reflected