Di=0;

RW=0;

Lcd_Bus=cmdcode;

delay(0); //原来是delay(0)

Enable=1;

delay(0);

Enable=0;

}

/*-------------------写数据到LCD----------------------------*/

void write_data(unsigned char Dispdata)

{ do{delay(10);}while(P0^7==1);

Di=1;

RW=0;

Lcd_Bus=Dispdata;

delay(0);

Enable=1;

delay(0);

Enable=0;

}

/*-------------------读LCD数据----------------------------*/

unsigned char read_data()

{ //do{delay(100);}while(P0^7==1);

unsigned char tmpin;

Di=1;

RW=1;

delay(0);

Enable=1;

delay(0);

Enable=0;do{delay(100);}while(P0^7==1);

tmpin=Lcd_Bus;

return tmpin;

}

/*------------------显示边框-------------------------------*/

void frame()

{

unsigned char i;

Mcs=1;

Scs=1;

write_com(Page_Add+0);

write_com(Col_Add+0);

for(i=0;i《64;i++) write_data(0x01);

write_com(Page_Add+7);

write_com(Col_Add+0);

for(i=0;i《64;i++) write_data(0x80);

for(i=0;i《8;i++)

{

Mcs=0;

Scs=1;

write_com(Page_Add+i);

write_com(Col_Add+63);

write_data(0x55);

Mcs=1;

Scs=0;

write_com(Page_Add+i);

write_com(Col_Add+0);

write_data(0x55);

}

}

/*------------------清除内存AM12864测试程序---------------*/

void Clr_Scr()

{

unsigned char j,k;

Mcs=1;Scs=1;

write_com(Page_Add+0);

write_com(Col_Add+0);

for(k=0;k《8;k++){

write_com(Page_Add+k);

for(j=0;j《64;j++)write_data(0x00);

}

}

/*------------------显示12864图片---------------------------*/

void Disp_Img(unsigned char code *img)

{

unsigned char j,k;