|
液晶是金鹏的OCMJ15*20
void Lcd_init()
{
Lcd_regwrite(0x00,0xc8); // 电源正常模式,文字模式
Lcd_regwrite(0x01,0xf2); // 中断忙碌高电位触发,系统8MHz
Lcd_regwrite(0x02,0x10); // 设置ROM/RAM读取速度
// Lcd_regwrite(0x03,0x80); advance display setup regiser(adsr)
Lcd_regwrite(0x10,0x6c); // 粗体字,中英对其,光标显示,光标自动移位
Lcd_regwrite(0x11,0x00); // 光标宽度和行距
Lcd_regwrite(0x12,0x91); // 图形模式时,光标先水后直,只显示page1,read/write运行在page1层
Lcd_regwrite(0x21,0x27); // 设定屏幕长320
Lcd_regwrite(0x31,0xef); // 设定屏幕高240
Lcd_regwrite(0x41,0x00); // 设置窗口左边位置
Lcd_regwrite(0x51,0x00); // 设置窗口顶端位置
Lcd_regwrite(0x20,0x27); // 设置窗口右边位置
Lcd_regwrite(0x30,0xef); // 设置窗口底边位置
Lcd_regwrite(0x40,0x00); // 设置窗口左边位置
Lcd_regwrite(0x50,0x00); // 设置窗口顶边位置
Lcd_regwrite(0x60,0x00); // 设置光标segment地址
// Lcd_regwrite(0x61,0x00);
Lcd_regwrite(0x70,0x00); // 设置光标common地址
Lcd_regwrite(0x71,0x00); // 在水平模式下,设定区块移动的起始Common位置
Lcd_regwrite(0x72,0xef); // 在水平模式下,设定区块移动的结束Common位置
Lcd_regwrite(0x80,0xaa); // 光标/屏幕闪烁时间
Lcd_regwrite(0x81,0x00); // 保留
Lcd_regwrite(0x91,0x00); // 保留
Lcd_regwrite(0x90,0x06); // 设定屏幕更新周期
Lcd_regwrite(0xa0,0x11); // 光标ROW等于缓存器[B1h]INTY,使能INTY中断
Lcd_regwrite(0xa1,0x00); // 键盘控制
Lcd_regwrite(0xa2,0x00); // 键盘输出值
Lcd_regwrite(0xa3,0x00); // 键盘输入值
Lcd_regwrite(0xb0,0x27); // 设定行segment中断地址
Lcd_regwrite(0xb1,0xef); // 设定列Common中断地址
Lcd_regwrite(0xc0,0x00); // 触摸控制
// Lcd_regwrite(0xc1,0x0a); ADS控制
Lcd_regwrite(0xc8,0x80); // 储存触控屏幕行的高字节(bit9~2)的相对位置数据
Lcd_regwrite(0xc9,0x80); // 储存触控屏幕列的高字节(bit9~2)的相对位置数据
Lcd_regwrite(0xca,0x00); // 触摸屏行列的低字节
// Lcd_regwrite(0xd0,0x80); lcd contrast control register (lccr)
Lcd_regwrite(0xe0,0x00); // pattern data register(pdr)
Lcd_regwrite(0xf0,0xa0); // 简体字,使能字形ROM转换电路
Lcd_regwrite(0xf1,0x0f); // 设置字形垂直为两倍大小
}
|
|