求12864M-1显示的画点画线子程序!要求是C语言,基于51单片机,谢谢!

2024-12-29 09:12:18
推荐回答(1个)
回答1:

void position(uchar x,uchar y)
{
uchar shuju[16]={0},i;
if(y<32)
{
write_com(0x80|(31-y));
write_com(0x88);
switch(x%8)
{
case 0:shuju[x/8]=0x80;break;
case 1:shuju[x/8]=0x40;break;
case 2:shuju[x/8]=0x20;break;
case 3:shuju[x/8]=0x10;break;
case 4:shuju[x/8]=0x08;break;
case 5:shuju[x/8]=0x04;break;
case 6:shuju[x/8]=0x02;break;
case 7:shuju[x/8]=0x01;break;
}
}
else
{
write_com(0x80|(63-y));
write_com(0x80);
switch(x%8)
{
case 0:shuju[x/8]=0x80;break;
case 1:shuju[x/8]=0x40;break;
case 2:shuju[x/8]=0x20;break;
case 3:shuju[x/8]=0x10;break;
case 4:shuju[x/8]=0x08;break;
case 5:shuju[x/8]=0x04;break;
case 6:shuju[x/8]=0x02;break;
case 7:shuju[x/8]=0x01;break;
}
}
for(i=0;i<16;i++)
write_date(shuju[i]);
}