Variable = BCD2BIN(bcdvalue)
|Variable|| Variable to store results (returns
|bcdvalue||BCD value to convert to binary|
Bcd2Bin converts a BCD (Binary Coded Decimal) number into a normal binary number, CUBLOC BASIC's default number format. BCD is a way of expressing values as decimals. For example, the number 3451 in binary is as shown below:
The following is 3451 converted to BCD code. As you can see, each 4 bits represent one of the digits.
This command is useful when the user needs to convert a variable for a device such as a 7 segment display, or a real-time clock.
Dim A As Integer A = Bcd2bin(&h1234) Debug Dec A ' Print 1234
See also Bin2Bcd