此图来源于网络

共阳数码管:

字符 0 1 2 3 4 5 6 7
数值 0xC0 0xF9 0xA4 0xB0 0x99 0x92 0x82 0xF8
字符 8 9 a b c d e f
数值 0x80 0x90 0x88 0x83 0xC6 0xA1 0x86 0x8E
注:dp编码为0x7F
unsigned char code table[]={
0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,
0x80,0x90,0x88,0x83,0xC6,0xA1,0x86,0x8E};

共阴数码管:

字符 0 1 2 3 4 5 6 7
数值 0x3F 0x06 0x5B 0x4F 0x66 0x6D 0x7D 0x07
字符 8 9 a b c d e f
数值 0x7F 0x6F 0x77 0x7C 0x39 0x5E 0x79 0x71
注:dp编码为0x80
unsigned char code table[]={
0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,
0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x79,0x71};