Titan



hex2bit


This function converts a single hexstring value to a single bitstring. The resulting bitstring represents the same value as the hexstring.

For the purpose of this conversion, a hexstring should be converted into a bitstring, where the hex digits of the hexstring are converted in groups of bits as follows:

'0'H -> '0000'B,   '1'H -> '0001'B,   '2'H -> '0010'B,   '3'H -> '0011'B,   '4'H -> '0100'B,   '5'H -> '0101'B,
'6'H -> '0110'B,   '7'H -> '0111'B,   '8'H-> '1000'B,   '9'H -> '1001'B,   'A'H -> '1010'B,   'B'H -> '1011'B,
'C'H -> '1100'B,   'D'H -> '1101'B,   'E'H -> '1110'B, and 'F'H -> '1111'B.

The consecutive order of the groups of 4 bits in the resulting bitstring is the same as the order of hex digits in the hexstring.


Related keyword:


hex2bit(hexstring value) return bitstring


Example 1:

const bitstring c_perrongen := hex2bit('A7'H);

The constant called c_perrongen will contain the bit string 10100111.