程序中有一个函数看不懂原理,求解这个函数的原理是什么?
/****************** ¶ÔµÚ1~6Êý×Ö×°ÔØÏÔʾº¯Êý ***************************/
u8 code T_LCD_mask[4] = {~0xc0,~0x30,~0x0c,~0x03};
u8 code T_LCD_mask4[4] = {~0x40,~0x10,~0x04,~0x01};
void LCD_load(u8 n,u8 dat) //nΪµÚ¼¸¸öÊý×Ö£¬Îª1~6£¬datΪҪÏÔʾµÄÊý×Ö 10us@22.1184MHZ
{
u8 i,k;
u8 *p;
if((n == 0) || (n > 6)) return;
i = t_display[dat]; //±ê×¼×Ö¿â
if(n <= 4) //1~4
{
n--;
p = LCD_buff;
}
else
{
n = n - 5;
p = &LCD_buff[4];
}
k = 0;
if(i & 0x08) k |= 0x40; //D
*p = (*p & T_LCD_mask4[n]) | (k>>2*n);
p++;
k = 0;
if(i & 0x04) k |= 0x40; //C
if(i & 0x10) k |= 0x80; //E
*p = (*p & T_LCD_mask[n]) | (k>>2*n);
p++;
k = 0;
if(i & 0x02) k |= 0x40; //B
if(i & 0x40) k |= 0x80; //G
*p = (*p & T_LCD_mask[n]) | (k>>2*n);
p++;
k = 0;
if(i & 0x01) k |= 0x40; //A
if(i & 0x20) k |= 0x80; //F
*p = (*p & T_LCD_mask[n]) | (k>>2*n);
}
|