From WikiChip
Representing Letters on a Seven-Segment Display
A common method of indicating an error. |
Representing Letters on a Seven-Segment Display, while highly discouraged, have been done mostly in low-end products such as cheap portable media players and many hobby projects. In such places, 7-segment displays were extended to support letters. Those representations varies from implementation to implementation and are not standardized by any standards organization.
Note that some letters such as K (), M (), V (), W (), X (), and Z () are completely unrecognizable by most people and as such been left out of the table below.
Lookup table
One can decode letters to pins via a simple lookup table.
const unsigned char seven_seg_digits_decode_abcdefg[75]= {
/* 0 1 2 3 4 5 6 7 8 9 : ; */
0x7E, 0x30, 0x6D, 0x79, 0x33, 0x5B, 0x5F, 0x70, 0x7F, 0x7B, 0x00, 0x00,
/* < = > ? @ A B C D E F G */
0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x4E, 0x00, 0x4F, 0x47, 0x5E,
/* H I J K L M N O P Q R S */
0x37, 0x06, 0x3C, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x5B,
/* T U V W X Y Z [ \ ] ^ _ */
0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* ` a b c d e f g h i j k */
0x00, 0x00, 0x1F, 0x0D, 0x3D, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
/* l m n o p q r s t u v w */
0x00, 0x00, 0x15, 0x1D, 0x00, 0x73, 0x05, 0x00, 0x0F, 0x1C, 0x00, 0x00,
/* x y z */
0x00, 0x3B, 0x00
};
const unsigned char seven_seg_digits_decode_gfedcba[75]= {
/* 0 1 2 3 4 5 6 7 8 9 : ; */
0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F, 0x00, 0x00,
/* < = > ? @ A B C D E F G */
0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x39, 0x00, 0x79, 0x71, 0x3D,
/* H I J K L M N O P Q R S */
0x76, 0x30, 0x1E, 0x00, 0x38, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x6D,
/* T U V W X Y Z [ \ ] ^ _ */
0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* ` a b c d e f g h i j k */
0x00, 0x00, 0x7C, 0x58, 0x5E, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00,
/* l m n o p q r s t u v w */
0x00, 0x00, 0x54, 0x5C, 0x00, 0x67, 0x50, 0x00, 0x78, 0x1C, 0x00, 0x00,
/* x y z */
0x00, 0x6E, 0x00
};
/* Invalid letters are mapped to all segments off (0x00). */
unsigned char decode_7seg(unsigned char chr)
{ /* assuming implementation uses ASCII */
if (chr > (unsigned char)'z')
return 0x00;
return seven_seg_digits_decode_abcdefg[chr - '0'];
/* or seven_seg_digits_decode_gfedcba */
}