/液晶操作子程序
//写一位
void WriteBit(char B)
{
int De;
if(B!=0) P6OUT |= LCDSTD; //STD=1
else P6OUT &= ~LCDSTD;
P6OUT |= LCDSCLK; //SCLK=1
De=18; while(De--);
P6OUT &= ~LCDSCLK; //SCLK=0
}
//写一个字节
void WriteByte(char B,char I)
{
int De,i;
P6OUT |= LCDCS; //片选有效 CS=1
for(i=1;i<6;i++) WriteBit(1); //5个空脉冲,数据为1 synchronizing bitstring
WriteBit(0); //RW=0
De=15;while(De--);
WriteBit(I); //写指令还是数据?
De=15;while(De--);
WriteBit(0); //写一个0
De=15;while(De--);
WriteBit(B&0x0080); //写第7位
De=15;while(De--);
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余2页未读,立即下载