|
主程序中的显示语句:
LCD_write_string(0,3, "C2000 Launchpad");
初始化函数:
void LCDinit(void)
{
send2LCM(0,0xe2); /*软件复位*/
DELAY_US(100L);
send2LCM(0,0xa2);
send2LCM(0,0xa0);
send2LCM(0,0xc8);
DELAY_US(100L);
send2LCM(0,0x2f);
DELAY_US(100L);
send2LCM(0,0x26);
DELAY_US(100L);
send2LCM(0,0x81);
send2LCM(0,0x38);
send2LCM(0,0x40);
send2LCM(0,0xe0);
send2LCM(0,0xaf);
}
void LCDclr(void)/*清屏*/
{
Uint16 i,j;
for (i = 0xb0;i<0xb8;i++)
{
send2LCM(0,i);
send2LCM(0,0x10);
send2LCM(0,0x00);
for (j=0x02;j<0x83;j++)
send2LCM(1,0x00);
}
}
写一个字符:
void LCD_write_char( char c)
{
char line;
c -= 32;
for (line=0; line<6; line++)
send2LCM(1,font6x8[c][line]);
}
设置位置:
void LCD_sit(Uint16 x, Uint16 y)
{
send2LCM(0, ((x>>4)+0x10));
send2LCM(0, (x&0x0f));
send2LCM(0, (y+0xb0));
}
写字符串:
void LCD_write_string(Uint16 X,Uint16 Y, char *s)
{
LCD_sit(X,Y);
while (*s)
{
LCD_write_char(*s);
s++;
}
}
写汉字:
void disp_hz(Uint16 x, Uint16 y, unsigned char *p)
{
Uint16 i;
LCD_sit( x , y );
for (i=0;i<8;i++)
{
send2LCM(1,*p++);
}
} |
|