请教下面TI的例子中显示缓存的值怎么得来的?根据手册比如“0”显示“段a+b+c+d+e+f”应该是0xEB才对啊?
#include <msp430x44x.h>
const char digit[10] =
{
0xB7, /* "0" LCD segments a+b+c+d+e+f */
0x12, /* "1" */
0x8F, /* "2" */
0x1F, /* "3" */
0x3A, /* "4" */
0x3D, /* "5" */
0xBD, /* "6" */
0x13, /* "7" */
0xBF, /* "8" */
0x3F /* "9" */
};
void main(void)
{
volatile unsigned int i; // Use volatile to prevent removal
// by compiler optimization
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
FLL_CTL0 |= XCAP14PF; // Configure load caps
for (i = 0; i < 10000; i++); // Delay for 32 kHz crystal to
// stabilize
LCDCTL = LCDON + LCD4MUX + LCDSG0_4; // LCD on, 4-Mux, segments S0-S27
BTCTL = BT_fLCD_DIV128; // LCD clock freq is ACLK/128
P5SEL = 0xFC; // Select P5.2-7 as Com and Rxx
for (;;)
{
unsigned char x;
for (x=0; x<7; x++)
{
LCDMEM[x] = digit[x]; // Display "6543210"
}
}
}
下个程序进去看看,适合自己的就是正确的,关键看效果。
这个程序跑出来是正确的,可是我没搞明白。请大家指点
此时显存每个字节8个位对应的段依次为e、h、f、c、g、d、b、a了
显示“0”的代码主要是看LCD的真值表和SEG口以及COM口连接。
这里用的是4MUX方式,在显示缓冲的8位从高到低a b c h f g e d 如果显示“0”则abcdef段为1则应该是11101011为0xEBH才对啊。不知道是我理解错了吗?请指教
下面是datasheet中的一段程序:它显示“0”就为0xEBH它也是用的4-MUX
4-Mux Mode Software Example
; The 4mux rate supports eight segments for each digit.
; All eight segments of a digit can often be located in
; one display memory byte
a EQU 080h
b EQU 040h
c EQU 020h
d EQU 001h
e EQU 002h
f EQU 008h
g EQU 004h
h EQU 010h
;
; The LSDigit of register Rx should be displayed.
; The Ta××e represents the ’on’−segments according to the
; content of Rx.
;
MOV.B Ta××e(Rx),&LCDn ; n = 1 ..... 15
; all eight segments are
; written to the display
; memory
...........
...........
Ta××e DB a+b+c+d+e+f ; displays ”0”
DB b+c ; displays ”1”
...........
...........
DB b+c+d+e+g ; displays ”d”
DB a+d+e+f+g ; displays ”E”
DB a+e+f+g ; displays ”F”