There is some amiguity in the reply. You seem to have quoted the values of the bits in hex and then you added them in decimal. This is highly suspect. In hex the following sum is:The BCD bits represent: 1, 2, 4, 8, 10, 20, 40, 80 . So the sum is 165. However, each 4-bit unit cannot exceed 9; therefore, 8 bits equals 99 as the largest decimal with 8 bcd bits. See H&H, Art of Electronics, p. 476. John
Edit: Think of a BCD thumbwheel switch. The binary code out the back of each ganged unit is 4-bit binary (i.e., 0-15); however, the numbers on each wheel go only from 0 to 9. You get the same answer (99) for 8-bit coding. I hope the physical example may help.
0x01 + 0x02 + 0x04 + 0x08 + 0x10 + 0x20 + 0x40 + 0x80 = 0xFF
That is what I meant. Sorry for the ambiguity.On the other hand if you ment for the place values to be decimal the apparent difference in the sum of 165 and the maximum representable number, 99, occurs precisely because some combinations of bits are not legal BCD numbers.
You are certainly correct in stating that an 8-bit byte can represent the BCD numbers in from the set {00,01,...,99}.
by Aaron Carman
by Jake Hertz
by Jake Hertz