User Tools

Site Tools


converting_20binary_20coded_20decimal

Converting Binary Coded Decimal

By JGH, April 2007

Binary Coded Decimal (BCD) is a method of representing a decimal number as a hexadecimal value using the hex digits 0-9 and ignoring A-F. For example, the number 21 (hex &15) would be represented as &21 (decimal 33). It can be a convenient internal representation of decimal numbers as each hexadecimal digit can be displayed without any further processing. See Wikipedia.

BCD values can be decoded with:

          number% = VAL STR$~bcd%


Numbers can be encoded in BCD using:

          bcd% = EVAL("&"+STR$number%)
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
converting_20binary_20coded_20decimal.txt · Last modified: 2024/01/05 00:22 by 127.0.0.1