![](/images/new-backgrounds/1188150/188150429x1.webp)
Appendices
[ 3 ] CRC
To check whether data has been transmitted accurately, the BHT-Ir protocol supports CRC (Cyclic Redundancy Check) which employs the CRC-16 generating system. In CRC, a CRC character is suffixed to a sequence of DLE ETX of every transmission block.
Operands for CRC-16
The CRC generates CRC-16 from all bytes of a transmission block excluding DLE SOH or DLE STX characters (which are at the head of a transmission block), DLE character of DLE ETX and DLE character of DLE DLE in the text.
CRC operation
The CRC system generates CRC-16 as follows: It multiplies the polynomial formed by aligning all of the bits starting from the LSB of the first byte to the MSB of the last byte in a transmission block in descending order, by X16. Next, divide the polynomial by the generative polynomial X16 + X15 + X2 + 1. The remainder is the value of CRC-16.
Shown below is a data text transmission block and operands for CRC-16 generation.
| D S | I | Serial | | D E | C |
| L•T | | Data text | L•T | R |
| number |
| |
| E X | D | | | E X | C |
| | | | | | |
Operands
Operand
[ 4 ] ID
ID is a 2-digit hexadecimal and designated in 0000h through FFFFh in (2 bytes). 0000h is assigned to the host computer. Any of 0001h through FFFFh is assigned to the BHT as follows.
¥The system sets an ID when the BHT is initialized.
¥You may set an arbitrary ID in System Mode or by using the OUT statement in BHT-BASIC.