2019-07-15 21:07发布
onlygxc 发表于 2014-1-7 12:34 通过位定义液晶的控制管脚这个程序没问题,我想问的是如果通过P2口整体赋值的方式控制液晶,例如: P20-- ...
最多设置5个标签!
void L12864B_Wait() //判忙
{
P0= 0xff;
L12864_RS = 0;
L12864_RW = 1;
L12864_E = 1; //读忙状态
while((P0&0x80)==1); //等待BF不为1
L12864_E = 0;
}
void L12864W_COM( uchar comda)
{
L12864B_Wait();
L12864_RS = 0;
L12864_RW = 0;
P0 = comda;
L12864_E = 1; //写指令
delay(2);
L12864_E = 0;
}
void L12864NoBusy_COM(uchar comda)
{
L12864_RS = 0;
L12864_RW = 0;
P0 = comda;
L12864_E = 1; //写指令
delay(2);
L12864_E = 0;
}
void L12864W_Data(uchar da)
{
L12864B_Wait(); //检测忙信号
L12864_RS = 1;
L12864_RW = 0;
P0 = da;
L12864_E = 1; //写数据
delay(2);
L12864_E = 0;
}
一周热门 更多>