From WikiChip
Difference between revisions of "seven-segment display/representing letters"
(Created page with "{{title|Representing Letters on a Seven-Segment Display}} {| style="float: right; text-align: center; width: 190px;" | <span style="border: 1px solid black; display:inline-tab...") |
m (Reverted edits by 203.189.118.234 (talk) to last revision by 70.40.165.225) |
||
(9 intermediate revisions by 6 users not shown) | |||
Line 13: | Line 13: | ||
! a !! b !! c !! d !! e !! f !! g | ! a !! b !! c !! d !! e !! f !! g | ||
|- | |- | ||
− | | A || 1 || 1 || 1 || 0 || 1 || 1 || 1 || 0x77 || 0x77 || {{7seg|A|10}} || rowspan=" | + | | A || 1 || 1 || 1 || 0 || 1 || 1 || 1 || 0x77 || 0x77 || {{7seg|A|10}} || rowspan="25" | [[File:7 segment display labeled.svg|200px]] |
+ | |- | ||
+ | | a || 1 || 1 || 1 || 1 || 1 || 0 || 1 || 0x7D || 0x5F || {{7seg|a|10}} | ||
|- | |- | ||
| b || 0 || 0 || 1 || 1 || 1 || 1 || 1 || 0x1F || 0x7C || {{7seg|b|10}} | | b || 0 || 0 || 1 || 1 || 1 || 1 || 1 || 0x1F || 0x7C || {{7seg|b|10}} | ||
|- | |- | ||
| C || 1 || 0 || 0 || 1 || 1 || 1 || 0 || 0x4E || 0x39 || {{7seg|C|10}} | | C || 1 || 0 || 0 || 1 || 1 || 1 || 0 || 0x4E || 0x39 || {{7seg|C|10}} | ||
+ | |- | ||
+ | | c || 0 || 0 || 0 || 1 || 1 || 0 || 1 || 0x0D || 0x58 || {{7seg|c|10}} | ||
|- | |- | ||
| d || 0 || 1 || 1 || 1 || 1 || 0 || 1 || 0x3D || 0x5E || {{7seg|d|10}} | | d || 0 || 1 || 1 || 1 || 1 || 0 || 1 || 0x3D || 0x5E || {{7seg|d|10}} | ||
Line 28: | Line 32: | ||
|- | |- | ||
| H || 0 || 1 || 1 || 0 || 1 || 1 || 1 || 0x37 || 0x76 || {{7seg|H|10}} | | H || 0 || 1 || 1 || 0 || 1 || 1 || 1 || 0x37 || 0x76 || {{7seg|H|10}} | ||
+ | |- | ||
+ | | h || 0 || 0 || 1 || 0 || 1 || 1 || 1 || 0x17 || 0x74 || {{7seg|h|10}} | ||
|- | |- | ||
| I || 0 || 0 || 0 || 0 || 1 || 1 || 0 || 0x06 || 0x30 || {{7seg|I|10}} | | I || 0 || 0 || 0 || 0 || 1 || 1 || 0 || 0x06 || 0x30 || {{7seg|I|10}} | ||
Line 36: | Line 42: | ||
|- | |- | ||
| n || 0 || 0 || 1 || 0 || 1 || 0 || 1 || 0x15 || 0x54 || {{7seg|n|10}} | | n || 0 || 0 || 1 || 0 || 1 || 0 || 1 || 0x15 || 0x54 || {{7seg|n|10}} | ||
+ | |- | ||
+ | | O || 1 || 1 || 1 || 1 || 1 || 1 || 0 || 0x7E || 0x3F || {{7seg|O|10}} | ||
|- | |- | ||
| o || 0 || 0 || 1 || 1 || 1 || 0 || 1 || 0x1D || 0x5C || {{7seg|o|10}} | | o || 0 || 0 || 1 || 1 || 1 || 0 || 1 || 0x1D || 0x5C || {{7seg|o|10}} | ||
Line 54: | Line 62: | ||
|- | |- | ||
| y || 0 || 1 || 1 || 1 || 0 || 1 || 1 || 0x3B || 0x6E || {{7seg|y|10}} | | y || 0 || 1 || 1 || 1 || 0 || 1 || 1 || 0x3B || 0x6E || {{7seg|y|10}} | ||
+ | |} | ||
+ | |||
+ | == Lookup table == | ||
+ | One can decode letters to pins via a simple lookup table. | ||
+ | <source lang="C"> | ||
+ | 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, 0x1F, 0x4E, 0x3D, 0x4F, 0x47, 0x5E, | ||
+ | /* H I J K L M N O P Q R S */ | ||
+ | 0x37, 0x06, 0x3C, 0x57, 0x0E, 0x55, 0x15, 0x1D, 0x67, 0x73, 0x05, 0x5B, | ||
+ | /* T U V W X Y Z [ \ ] ^ _ */ | ||
+ | 0x0F, 0x3E, 0x1C, 0x5C, 0x13, 0x3B, 0x6D, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
+ | /* ` a b c d e f g h i j k */ | ||
+ | 0x00, 0x77, 0x1F, 0x4E, 0x3D, 0x4F, 0x47, 0x5E, 0x37, 0x06, 0x3C, 0x57, | ||
+ | /* l m n o p q r s t u v w */ | ||
+ | 0x0E, 0x55, 0x15, 0x1D, 0x67, 0x73, 0x05, 0x5B, 0x0F, 0x3E, 0x1C, 0x5C, | ||
+ | /* x y z */ | ||
+ | 0x13, 0x3B, 0x6D | ||
+ | }; | ||
+ | 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, 0x7C, 0x39, 0x5E, 0x79, 0x71, 0x3D, | ||
+ | /* H I J K L M N O P Q R S */ | ||
+ | 0x76, 0x30, 0x1E, 0x75, 0x38, 0x55, 0x54, 0x5C, 0x73, 0x67, 0x50, 0x6D, | ||
+ | /* T U V W X Y Z [ \ ] ^ _ */ | ||
+ | 0x78, 0x3E, 0x1C, 0x1D, 0x64, 0x6E, 0x5B, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
+ | /* ` a b c d e f g h i j k */ | ||
+ | 0x00, 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71, 0x3D, 0x76, 0x30, 0x1E, 0x75, | ||
+ | /* l m n o p q r s t u v w */ | ||
+ | 0x38, 0x55, 0x54, 0x5C, 0x73, 0x67, 0x50, 0x6D, 0x78, 0x3E, 0x1C, 0x1D, | ||
+ | /* x y z */ | ||
+ | 0x64, 0x6E, 0x5B | ||
+ | }; | ||
+ | |||
+ | /* Invalid letters are mapped to all segments off (0x00). */ | ||
+ | unsigned char decode_7seg(unsigned char chr) | ||
+ | { /* Implementation uses ASCII */ | ||
+ | if (chr > (unsigned char)'z') | ||
+ | return 0x00; | ||
+ | return seven_seg_digits_decode_abcdefg[chr - '0']; | ||
+ | /* or | ||
+ | return seven_seg_digits_decode_gfedcba[chr - '0']; */ | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | == Common words == | ||
+ | Some of the most commonly used words are shown below: | ||
+ | {| style="wikitable" | ||
+ | | '''Hello''' || {{7seg|H|10}}{{7seg|E|10}}{{7seg|L|10}}{{7seg|L|10}}{{7seg|O|10}} || '''Echo''' || {{7seg|E|10}}{{7seg|C|10}}{{7seg|H|10}}{{7seg|O|10}} | ||
+ | |- | ||
+ | | '''On''' || {{7seg|O|10}}{{7seg|n|10}} || '''Off''' || {{7seg|O|10}}{{7seg|f|10}}{{7seg|f|10}} | ||
+ | |- | ||
+ | | '''Start''' || {{7seg|S|10}}{{7seg|t|10}}{{7seg|A|10}}{{7seg|r|10}}{{7seg|t|10}} || '''End''' || {{7seg|E|10}}{{7seg|n|10}}{{7seg|d|10}} || '''Pause''' || {{7seg|P|10}}{{7seg|A|10}}{{7seg|U|10}}{{7seg|S|10}}{{7seg|E|10}} || '''Go''' || {{7seg|G|10}}{{7seg|o|10}} | ||
+ | |- | ||
+ | | '''Up''' || {{7seg|U|10}}{{7seg|P|10}} || '''Loop''' || {{7seg|L|10}}{{7seg|O|10}}{{7seg|O|10}}{{7seg|P|10}} | ||
+ | |- | ||
+ | | '''True''' || {{7seg|t|10}}{{7seg|r|10}}{{7seg|u|10}}{{7seg|E|10}} || '''False''' || {{7seg|F|10}}{{7seg|A|10}}{{7seg|L|10}}{{7seg|S|10}}{{7seg|E|10}} | ||
+ | |- | ||
+ | | '''Push''' || {{7seg|P|10}}{{7seg|U|10}}{{7seg|S|10}}{{7seg|H|10}} || '''Pop''' || {{7seg|P|10}}{{7seg|O|10}}{{7seg|P|10}} | ||
+ | |- | ||
+ | || '''Error''' || {{7seg|E|10}}{{7seg|r|10}}{{7seg|r|10}}{{7seg|o|10}}{{7seg|r|10}} || '''Ops''' || {{7seg|O|10}}{{7seg|P|10}}{{7seg|S|10}} || '''Ouch''' || {{7seg|O|10}}{{7seg|u|10}}{{7seg|c|10}}{{7seg|h|10}} | ||
|} | |} |
Latest revision as of 23:16, 22 May 2022
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[edit]
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, 0x1F, 0x4E, 0x3D, 0x4F, 0x47, 0x5E,
/* H I J K L M N O P Q R S */
0x37, 0x06, 0x3C, 0x57, 0x0E, 0x55, 0x15, 0x1D, 0x67, 0x73, 0x05, 0x5B,
/* T U V W X Y Z [ \ ] ^ _ */
0x0F, 0x3E, 0x1C, 0x5C, 0x13, 0x3B, 0x6D, 0x00, 0x00, 0x00, 0x00, 0x00,
/* ` a b c d e f g h i j k */
0x00, 0x77, 0x1F, 0x4E, 0x3D, 0x4F, 0x47, 0x5E, 0x37, 0x06, 0x3C, 0x57,
/* l m n o p q r s t u v w */
0x0E, 0x55, 0x15, 0x1D, 0x67, 0x73, 0x05, 0x5B, 0x0F, 0x3E, 0x1C, 0x5C,
/* x y z */
0x13, 0x3B, 0x6D
};
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, 0x7C, 0x39, 0x5E, 0x79, 0x71, 0x3D,
/* H I J K L M N O P Q R S */
0x76, 0x30, 0x1E, 0x75, 0x38, 0x55, 0x54, 0x5C, 0x73, 0x67, 0x50, 0x6D,
/* T U V W X Y Z [ \ ] ^ _ */
0x78, 0x3E, 0x1C, 0x1D, 0x64, 0x6E, 0x5B, 0x00, 0x00, 0x00, 0x00, 0x00,
/* ` a b c d e f g h i j k */
0x00, 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71, 0x3D, 0x76, 0x30, 0x1E, 0x75,
/* l m n o p q r s t u v w */
0x38, 0x55, 0x54, 0x5C, 0x73, 0x67, 0x50, 0x6D, 0x78, 0x3E, 0x1C, 0x1D,
/* x y z */
0x64, 0x6E, 0x5B
};
/* Invalid letters are mapped to all segments off (0x00). */
unsigned char decode_7seg(unsigned char chr)
{ /* Implementation uses ASCII */
if (chr > (unsigned char)'z')
return 0x00;
return seven_seg_digits_decode_abcdefg[chr - '0'];
/* or
return seven_seg_digits_decode_gfedcba[chr - '0']; */
}
Common words[edit]
Some of the most commonly used words are shown below:
Hello | Echo | ||||||
On | Off | ||||||
Start | End | Pause | Go | ||||
Up | Loop | ||||||
True | False | ||||||
Push | Pop | ||||||
Error | Ops | Ouch |