打印

lcd1601驱动的一点小问题

[复制链接]
1317|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
wyt990|  楼主 | 2011-1-19 15:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
这是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呢?

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

2

主题

37

帖子

1

粉丝