Pack digit patterns into bytes

Firmware stores one byte per digit for a common-cathode seven-segment display. The bit order, from bit 7 down to bit 0, is dp g f e d c b a, and a 1 lights that segment. The decimal point stays off. The segments are named as in the figure; on this display the digit 6 includes the top segment a and the digit 9 includes the bottom segment d.


A seven-segment digit with segments a to f named clockwise from the top, g in the middle and the decimal point dp at the lower right.


Complete the table. Write each binary byte as eight digits, most significant bit first, with no spaces. Write each hexadecimal value as two hex digits without a 0x prefix.

DigitBinary (dp g f e d c b a)Hex
2
5
6
9

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Programming the 7-Segment Displays Questions: