Six-Bit Visitor Counter and the BCD Display
The computer science club of a higher secondary school is building a digital visitor counter for its annual science exhibition. The counter uses an unsigned 6-bit binary register and a two-digit seven-segment display. The display driver does not accept plain binary; it expects each decimal digit to be sent as a 4-bit BCD code. On the first day 47 visitors enter; on the second day 58. A volunteer converts 58 to binary, obtains 111010, and connects those six bits directly to the display driver. The counter is reset to 000000 each morning. The club also has one spare 4-bit register, which is being used for a lucky-token draw and can hold only the values 0000 to 1111. A member suggests storing the day’s total visitor count in this spare 4-bit register instead of using the 6-bit counter.
1. Determine the maximum value the 6-bit counter can hold and check whether the day-one and day-two counts fit. Show the binary and BCD representations of 47 and 58, and explain why the volunteer’s direct connection is wrong.
Read the worked answer
An unsigned 6-bit register holds values from 000000 to 111111, i.e. 0 to 2^6 − 1 = 63. Both 47 and 58 are below 64, so they fit. 47 in binary is 101111; as two BCD digits it is 0100 0111 (4 for tens, 7 for units). 58 in binary is 111010; as BCD it is 0101 1000 (5 for tens, 8 for units).
The driver expects 8 bits arranged as two 4-bit decimal digits. Sending 111010 directly is wrong because the driver does not interpret the bit pattern as a binary number; it decodes each nibble as a decimal digit. With the upper bits at 0, 111010 is read as 0011 1010, i.e. digit 3 followed by an invalid BCD code 1010 (10). The display will therefore show a wrong or blank reading rather than 58.
2. A teammate says, “Since 58 is less than 63, the 4-bit register can also store it.” Evaluate this claim using range and overflow, and state what the club should do if they want to store 58 in the 4-bit register.
Read the worked answer
A 4-bit register can represent only 0 to 15. 58 is greater than 15, so storing it in 4 bits causes overflow. The lower four bits of 58 (111010) are 1010, i.e. 10, so a display would misleadingly show 10. The claim “58 is less than 63” confuses the 6-bit range with the 4-bit range.
If the club must use the 4-bit register, it can store only one decimal digit at a time. To keep 58 it needs at least 6 bits (2^6 = 64 > 58) or two BCD digits, which require 8 bits (0101 1000).
3. The club wants the display to show the count in decimal with a leading zero (for example, 07). Explain how BCD helps and why binary alone does not.
Read the worked answer
BCD assigns one 4-bit group to each decimal digit. For 7, BCD is 0000 0111; the driver sees tens = 0 and units = 7 and can light the leading zero. Plain binary 111 has no separate tens digit, so a two-digit display driver cannot know that the tens digit should be 0.
BCD makes the decimal digits explicit, which is why it is used for seven-segment decimal displays. The driver can decode each 4-bit group independently; a plain binary value would need a binary-to-BCD conversion first.