/*
DU_12864(RAM_BF) 是12864液晶屏、串行、读数据函数.
RAM_BF=0、是读忙标志和地址.RAM_BF=1、是读RAM数据.
*/
unsigned char DU_12864(bit RAM_BF)
{
unsigned char i,ADD,data1,data2,data3;
if(RAM_BF==0)
ADD=0xfc;
if(RAM_BF==1)
ADD=0xfe;
CS_12864=1;
NOPx;
CLK_12864=0;
for(i=0; i<8; i++)
{
ADD =ADD<<1;
SID_12864=CY;
NOPx;
CLK_12864=1;
NOPx;
CLK_12864=0;
}
for(i=0;i<8;i++)
{
CLK_12864=1;
data1=data1<<1;
if(SID_12864==1)
{
data1=data1 | 0x01;
}
NOPx;
CLK_12864=0;
}
for(i=0;i<8;i++)
{
CLK_12864=1;
data2=data2<<1;
if(SID_12864==1)
{
data2=data2 | 0x01;
}
NOPx;
CLK_12864=0;
}
NOPx;
CS_12864=0;
data1=data1&0xf0;
data2=data2&0xf0;
data2=data2>>4;
data3=data1+data2;
return data3;
}
读数据要注意什么问题????