160160旋转180度显示参考例程
杭州清达光电技术有限公司
杭州佳显科技有限公司
160160旋转180度显示
下面只是初始化部分的代码,需要详细的测试代码请来电或QQ微信在线咨询。
/******** 初始化程序 ********/
void set()
{
delay(15);
rest=0;
delay(1);
rest=1;
delay(150);
write_com(0xac); //关显示
write_com(0xe2); //System Rest
delay(2);
write_com(0x25); //TC[1:0]:Temperature Compensation:-0.05%
write_com(0x2b); //PCI[1:0]:Power Control:Interal V,
write_com(0x40); //LSB[3:0]:Set Scroll Line:
write_com(0x50); //MSB[3:0]:Set Scroll Line:
write_comcom(0x81,0xb0); //PM[7.0]:Potentiometer
write_com(0x84); //LC[8]:Parteal Display Control:disable
/* 正向使用AC[2]=0,指令设置为0x89*/
/* 旋转180度使用AC[2]=1,指令设置为0x8D */
write_com(0x8D); //AC[2:0]:RAM Address Control:CA+1,RA+1/-1
write_comcom(0x90,0x00); //FLT,FLB:Fixed Lines
write_com(0xa3); //LC[4:3]:Line Rate:15.2k/ps
write_com(0xa4); //DC[1]:ALL Pixel OFF
write_com(0xa6); //DC[0]:Inverse Display OFF
write_com(0xa9); //DC[4:2]:Display Enable:sleep ON(显示关),an ON/OFF mode,Green Enhance OFF
write_comcom(0xb8,0x00); //MTP Operation Control:MTPC disnable
/* 正向使用LC[1]=0,指令设置为0xC4*/
/* 旋转180度使用LC[1]=1,指令设置为0xC6 */
write_com(0xc6); //LC[2:0]:LCD Mapping Control:Mirror OFF
write_comcom(0xc8,0x10); //NIV[3:0]:N-Line Inversion:NIV enable,non-XOR,11Lines
/* 正向使用LC[5]=1,选择RGBRGB格式,指令设置为0xd1*/
/* 旋转180度使用LC[5]=0,选择BGRBGR格式,指令设置为0xd0 */
write_com(0xd0); //LC[5]:Color Pattern:BGR-BGR
write_com(0xd5); //LC[7:6]:Color Mode:RRRR-GGGG-BBBB(4K color)
write_com(0xda); //CSF[2:0]:COM Scan Function:ABCDE-ABCDE,FRC enable
write_com(0xe9); //BR[1:0]:LCD Bias Ratio:10
write_comcom(0xf1,0x9f); //CEN:COM END:159
write_comcom(0xf2,0x00); //DST:Partial Display Start:0
write_comcom(0xf3,0x9f); //DEN:Partial Display End:159
write_comcom(0xf4,0x25); //WPC0:Window Rrogram Starting Column Address:SEG112
write_comcom(0xf5,0x00); //WPP0:Window Rrogram Starting Row Address:COM0
write_comcom(0xf6,0x5a); //WPC1:Window Rrogram End Column Address:SEG271
write_comcom(0xf7,0x9f); //WPP1:Window Rrogram End Row Address:COM159
write_com(0xf8); //AC[3]:Window Program Mode:Inside Mode
write_com(0xad); //DC[4:2]:Display Enable:sleep OFF(显示开),an ON/OFF mode,Green Enhance OFF
fill_4k(clear); //清屏
} //*/
void external_int()interrupt 0 //using 1
{
do{x=1;delay(10);}
while(x==1);
delay(10);
}
/********* 主函数 *********/
/********* 12MHz *********/
void main()
{
EA=1; //中断总允许
IT0=0; //设置外部中断INT0为电平触发方式,低电平有效
EX0=1;//外部中断INT0允许(INT0使能)
set();//初始化
/******** RRRR-GGGG-BBBB,4K color ********/
write_com(0xd5); //LC[7:6]:Color Mode:RRRR-GGGG-BBBB(4K color)
dis_1616s(16,8,0,4,TAB1616); //清达光电
dis_1616s(10,30,4,6,TAB1616); //技术有限公司
dis_1616s(16,58,0,4,TAB1616);//清达光电
dis_1616s(10,80,4,6,TAB1616); //技术有限公司
dis_1616s(16,110,0,4,TAB1616);//清达光电
dis_1616s(10,132,4,6,TAB1616);//技术有限公司
while(1);
}
qdgdlcd.b2b168.com/m/