这是lcd1602的驱动中的两个函数,有点问题
void GotoXY(unsigned char x, unsigned char y)
{
if(y==0)
LCD_Write(LCD_COMMAND,0x80|x);
if(y==1)
LCD_Write(LCD_COMMAND,0x80|(x-0x40));
}
void Printc(Uchar x,unsigned char *str)
{
Uchar l=0,y=0;
if(x>7){y^=1;x=x-8;}
while (str[l] >31)
{
GotoXY(x,y);
LCD_Write(LCD_DATA,str[l]);
x++;l++;
if ( x == 8 ){
x = 0; y ^= 1;
}
};
}
Printc(3,"abcdefghijkl");
用这样子调用的时候为什么它先会在0位置输出a然后跳三格再输出bcdefghijkl呢? |