What is the largest decimal number that can be represented with 8-bit BCD? My answer is +128 just like a 8-bit unsigned binary, but am not sure. Am I right?
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.
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: Code ( (Unknown Language)): 0x01 + 0x02 + 0x04 + 0x08 + 0x10 + 0x20 + 0x40 + 0x80 = 0xFF 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}.
That is what I meant. Sorry for the ambiguity. Ironically, I was using a BCD thumbwheel switch in a current project (now replaced with a digital potentiometer) and had labeled the binary outputs in decimal. When I wrote my response, I didn't think how ambiguous my mixed nomenclature would be. John