Sun Jan 31, 2016 7:46 am
// toggle RST low to reset
if (rst > 0) {
digitalWrite(rst, LOW);
delay(10);
digitalWrite(rst, HIGH);
}
clkport = portOutputRegister(digitalPinToPort(sclk));
clkpinmask = digitalPinToBitMask(sclk);
mosiport = portOutputRegister(digitalPinToPort(din));
mosipinmask = digitalPinToBitMask(din);
csport = portOutputRegister(digitalPinToPort(cs));
cspinmask = digitalPinToBitMask(cs);
dcport = portOutputRegister(digitalPinToPort(dc));
dcpinmask = digitalPinToBitMask(dc);
// get into the EXTENDED mode!
command(PCD8544_FUNCTIONSET | PCD8544_EXTENDEDINSTRUCTION);
// LCD bias select (4 is optimal?)
command(PCD8544_SETBIAS | 0x4);
// set VOP
if (contrast > 0x7f)
contrast = 0x7f;
command(PCD8544_SETVOP | contrast); // Experimentally determined
// normal mode
command(PCD8544_FUNCTIONSET);
// Set display to Normal
command(PCD8544_DISPLAYCONTROL | PCD8544_DISPLAYNORMAL);
// initial display line
// set page address
// set column address
// write display data
update();
// toggle RST low to reset
if (rst > 0)
{
digitalWrite(rst, LOW);
delay(10);
digitalWrite(rst, HIGH);
}
command(0xE2); //System Reset//系统软复位
command(0x40); // Set display start line to 0 //从0,0开始显示
command(0xC8); //Set SEG Direction//行扫描顺序0xA1
command(0xA0); //Set COM Direction//列扫描顺序0xC0
command(0xA2); //Set Bias = 1/9//设置偏压比
command(0x2C); //Boost ON//升压开
command(0x2E); //Voltage Regular On//升压步骤一
command(0x2F); //Voltage Follower On//升压步骤二
command(0xF8); //Set booster ratio to
command(0x00); //4x//设置通讯速度
command(0x22); //Set Resistor Ratio = 3//0x23对比度初调
command(0x81); //对比度细调
command(0x32); //Set Electronic Volume = 40
command(0xAC);//Set Static indicator off
command(0x00);
command(0XA6); // Disable inverse//正显A6负显A7
command(0xAF); //Set Display Enable//打开显示
delay(100);
command(0xA5); //display all points//全屏初始化
delay(200);
command(0xA4); //normal display//恢复正常显示
Allclear();
update();
Sun Jan 31, 2016 7:52 am
Thu Mar 17, 2016 5:54 am
Sun Mar 27, 2016 6:55 am
Sun Mar 27, 2016 10:33 am
Sun Mar 27, 2016 11:19 am