BCD and Byte

You probably also need to provide a link for the sensors, as what these need is often a structured field crammed into a byte.

A byte is just a collection of 8 bits. It can contain anything you want and as the programmer you give it meaning in your code. For example, the bit pattern

0100 0001 (msb first)

can be read a number of ways:

  • decimal number 65 (same as hex 0x41)
  • ASCII character 'A'
  • 2 BCD integers, 4 and 1
  • a bit mask for something
    but they are all the same value/bit pattern in memory. The context of your code gives it meaning.

The reference you gave is for the standard C/C++ language cast operation that is generally used to convert between different types. For example, taking a 16 bit integer and casting it to byte eliminates the most significant 8 bits from the number. It is not a conversion to/from BCD.