例如初始化程序
//‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
无效write_command (无符号字符型数据)
{
A0=0;
E=1;
P1 = datum;
CS1=0;
RW=0;
RW=1;
CS1=1;
}
//‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
无效WRITE_DATA (无符号字符型数据)
{
A0=1;
E=1;
P1=datum;
CS1=0;
RW=0;
RW=1;
CS1=1;
}
//‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
无效lcd_init (无效) {
write_command(0xA2); //ICON OFF;
write_command(0xAE); //Display OFF
write_command(0x48); //Set Duty ratio
write_command(0x80); //No operation
write_command(0xa1); //Set scan direction //changed from 0 to 1
write_command(0xc8); //SHL select
write_command(0x40); //Set START LINE
write_command(0x00);
write_command(0xab); //OSC on
write_command(0x64); //3x
delay(2000);
write_command(0x65); //4x
delay(2000);
write_command(0x66); //5x
delay(2000);
write_command(0x67); //6x
delay(2000);
write_command ( Ra_Rb ) ; // SET电阻
write_command(0x81); //Set electronic volume register
write_command(vopcode); //n=0~3f
write_command(0x57); //1/12bias
write_command(0x92); //FRC and pwm
write_command(0x2C);
delay(20000);//200ms
/ *指令寄存器* /
/ *读取无效* /
/*put data on port 1*/
/ *片选有效* /
/ *写*主动/
/ *写活动的;锁存器中的数据* /
/ *片选无效* /
/ * DDRAM数据寄存器* /
[8]