杭州清达光电技术有限公司

主营:液晶模块,OLED显示模块,LCM,超低温液晶,军工显示屏,OLED显示屏,串口显示屏,彩屏模组,耐高温高湿显示屏,带字库液晶,RS232显示屏,UART显示屏

  • 黄金会员
  • 8
您现在的位置:杭州清达光电技术有限公司首页 > 国网160160液晶UC1698U旋转180度显示代码
VIP会员 8
  • 经营模式:生产型
  • 所在地区:浙江 - 杭州
  • 企业类别:私营有限责任公司
公司相册
站内搜索
国网160160液晶UC1698U旋转180度显示代码

国网160160液晶UC1698U旋转180度显示代码

#include<>
#include<>
#include<>
#include<>
#define uchar unsigned char
#define uint unsigned int
#define data P1
sbit wr = P3^0;
sbit rd = P3^1;
sbit cs = P3^3;
sbit a0 = P3^4;
sbit rest = P3^5;
sbit x=P3^2;
#define WD 160 /* 显示区宽度 */
#define HD 160 /* 显示区高度 */
#define clear 0x00 /* Clear Display */
#define time 750 /* 1000延时 1.03895500 s */
uchar code TAB1616[]=
{
0x40,0x40,0x23,0xFC,0x20,0x40,0x0B,0xFC,0x88,0x40,0x57,0xFC,0x50,0x00,0x13,0xF8,
0x22,0x08,0x23,0xF8,0xE2,0x08,0x23,0xF8,0x22,0x08,0x22,0x08,0x22,0x28,0x22,0x10,/*'清',0*/
0x00,0x00,0x40,0x80,0x30,0x80,0x10,0x80,0x0F,0xFC,0x00,0x80,0x00,0x80,0xE0,0x80,
0x21,0x40,0x21,0x20,0x22,0x18,0x24,0x0C,0x28,0x08,0x50,0x02,0x8F,0xFC,0x00,0x00,/*'达',1*/
0x01,0x00,0x21,0x10,0x19,0x18,0x0D,0x10,0x09,0x20,0x01,0x04,0x7F,0xFE,0x04,0x40,
0x04,0x40,0x04,0x40,0x04,0x40,0x08,0x42,0x08,0x42,0x10,0x42,0x20,0x3E,0x40,0x00,/*'光',2*/
0x01,0x00,0x01,0x00,0x01,0x00,0x3F,0xF8,0x21,0x08,0x21,0x08,0x3F,0xF8,0x21,0x08,
0x21,0x08,0x21,0x08,0x3F,0xF8,0x21,0x08,0x01,0x02,0x01,0x02,0x00,0xFE,0x00,0x00,/*'电',3*/
0x10,0x20,0x10,0x20,0x10,0x20,0xFD,0xFE,0x10,0x20,0x14,0x20,0x19,0xFC,0x31,0x08,
0xD0,0x88,0x10,0x90,0x10,0x60,0x10,0x60,0x10,0x90,0x11,0x0E,0x56,0x04,0x20,0x00,/*'技',4*/
0x01,0x00,0x01,0x20,0x01,0x10,0x01,0x00,0xFF,0xFE,0x01,0x00,0x03,0x80,0x05,0x40,
0x05,0x20,0x09,0x10,0x11,0x18,0x21,0x0E,0xC1,0x04,0x01,0x00,0x01,0x00,0x00,0x00,/*'术',5*/
0x01,0x00,0x01,0x00,0x7F,0xFE,0x02,0x00,0x04,0x00,0x0F,0xF0,0x18,0x10,0x28,0x10,
0x4F,0xF0,0x88,0x10,0x08,0x10,0x0F,0xF0,0x08,0x10,0x08,0x90,0x08,0x70,0x08,0x20,/*'有',6*/
0x00,0x00,0xFB,0xF8,0x92,0x08,0x93,0xF8,0xA2,0x08,0xA2,0x08,0x93,0xF8,0x8A,0x80,
0x8A,0x48,0xAA,0x50,0x92,0x20,0x82,0x20,0x82,0x10,0x82,0x8E,0x83,0x04,0x82,0x00,/*'限',7*/
0x00,0x00,0x04,0x40,0x06,0x40,0x04,0x40,0x08,0x20,0x08,0x10,0x10,0x18,0x22,0x0E,
0x43,0x04,0x02,0x00,0x04,0x20,0x08,0x10,0x11,0xF8,0x3F,0x18,0x10,0x10,0x00,0x00,/*'公',8*/
0x00,0x00,0x3F,0xFC,0x00,0x04,0x00,0x04,0x7F,0xE4,0x00,0x04,0x00,0x04,0x3F,0xC4,
0x20,0x44,0x20,0x44,0x3F,0xC4,0x20,0x44,0x20,0x04,0x00,0x14,0x00,0x08,0x00,0x00,/*'司',9*/
};
/********* 时间延时程序 *********/
void delay(uint t) /* 1.02500 ms */
{ uint i,j;
for(i=t;i>0;i--)
for(j=125;j>0;j--);
}
/******** 写“指令”程序 ********/
void write_com(uchar com)
{ cs=0;
a0=0;
wr=0;
rd=1;
data=com;
wr=1;
cs=1;
}
/******** 写“数据”程序 ********/
void write_data(uchar dat)
{ data=0xff;
cs=0;
a0=1;
wr=0;
rd=1;
data=dat;
wr=1;
cs=1;
}
/******** 写“指令指令”程序 ********/
void write_comcom(uchar com1,uchar com2)
{ write_com(com1);
write_com(com2);
}
/******** 读“数据”程序 ********/
uchar read_data()
{ uchar temp;
data=0xff;
cs=0;
a0=1;
wr=1;
rd=0;
temp=data;
rd=1;
cs=1;
return temp;
}
/******** 窗口设置程序 ********/
void window(uchar row0,uchar row1,uchar col0,uchar col1)
{ write_comcom(0xf4,0x25+col0); //WPC0:Window Rrogram Starting Column Address:SEG112
write_comcom(0xf5,row0); //WPP0:Window Rrogram Starting Row Address:COM0
write_comcom(0xf6,0x25+col1); //WPC1:Window Rrogram End Column Address:SEG271
write_comcom(0xf7,row1); //WPP1:Window Rrogram End Row Address:COM159
}
/******** 地址程序 ********/
void address(uchar x,uchar y)
{ uchar col0,row0,col1,row1;
y=0x25+y;
col0=0x00|(y&0x0f);
col1=0x10|((y&0xf0)>>4);
row0=0x60|(x&0x0f);
row1=0x70|((x&0xf0)>>4);
write_com(col0); //列地址
write_com(col1);
write_com(row0); //行地址
write_com(row1);
}
/******** 数据转换(4K color)显示程序 ********/
void conv_write_4k(uchar dat,uchar n)
{ uchar i,temp;
for(i=0;i<n/2;i++)
{ switch(dat&0xc0)
{ case 0x00: temp=0x00; break;
case 0x40: temp=0x0f; break;
case 0x80: temp=0xf0; break;
case 0xc0: temp=0xff; break;
default: break;
}
write_data(temp); //写入转换后的8bit数据
dat<<=2; //左移2位
}
}
/******** 全屏(4K color)显示程序 ********/
void fill_4k(uchar dat)
{ uchar i,j,p;
for(i=0;i<160;i=i+1)
{
p=159-i;
address(p,0); //地址
for(j=0;j<81;j=j+1)
{
write_data(dat);
}
}
}
/*********************************************************************
描点函数:(4K color)显示
x取值范围:0-159(每com)
y取值范围:0-159(每seg)
z=1,绘点;z=0,消点;
************************************************************************/
void point1(uchar x,uchar y,uchar z)
{
uchar y1,temp,data1,data2;
x=159-x;
temp=y%3;
if((y>0)&&(temp!=0))
y1=y/3+1;
else if((y>0)&&(temp==0))
y1=y/3;
else
y1=0;
address(x,y1);
data1=read_data();//空读
data1=read_data();
data2=read_data();//读出数据位16位的BBBBB-GGGGGG-RRRRR
data1=(data1&0xf0)|(((data1&0x07)<<1)|((data2&0x80)>>7));
data2=((data2&0x1f)<<3)&0xf0;
if(z==1)//绘点,置1
switch(temp)
{
case 0:{data1=data1;data2=data2|0xf0;break;}
case 1:{data1=data1|0xf0;data2=data2;break;}
case 2:{data1=data1|0x0f;data2=data2;break;}
default:break;
}
else//消点,置0
switch(temp)
{
case 0:{data1=data1;data2=data2&0x0f;break;}
case 1:{data1=data1&0x0f;data2=data2;break;}
case 2:{data1=data1&0xf0;data2=data2;break;}
default:break;
}
address(x,y1);
write_data(data1);
write_data(data2);
}
/*********************************************************************
16*16点阵字符数组s[]中 第m个字符显示(单个字符显示)
x: 列位置(0-48)一个16*16字符占6个列地址;一行可写9个汉字符;y:行位置(0-159)
************************************************************************/
void dis_1616(uchar x,uchar y,uchar m,uchar *s)
{
uchar i,j,p,temp;
p=0;
for(j=y;j<y+16;j++)
{
temp=159-j;
address(temp,x);
for(i=0;i<2;i++)
{
conv_write_4k(s[i+2*p+m*32],8);
}
p=p+1;
}
}
/*********************************************************************
16*16点阵字符数组s[]中多个字符显示(多个字符显示)
x: 列位置(0-48);y:行位置(0-159)
从第m个开始,连续写n个。
************************************************************************/
void dis_1616s(uchar x,uchar y,uchar m,uchar n,uchar *s)
{
uchar i;
for(i=m;i<m+n;i++)
{
dis_1616(x,y,i,s);
x=x+6;
}
}
/******** 初始化程序 ********/
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);
}

免责声明:以上信息由会员自行提供,内容的真实性、准确性和合法性由发布会员负责。一步电子网(www.kuyibu.com)对此不承担任何责任。
友情提醒:为规避购买风险,建议您在购买相关产品时,优先选择一步电子网(www.kuyibu.com)VIP会员

杭州清达光电技术有限公司 电话:86-0571-89902095 传真:86-0571-89902095
地址:浙江 - 杭州 杭州市余杭区良渚街道博园路1号杭州电子市场西区2楼2A001(门市部)
技术支持:一步电子网  管理商铺入口

声明:以上所展示的信息由企业自行提供,内容的真实性、准确性和合法性由发布企业负责。一步电子网对此不承担任何保证责任。

金瓶儿 <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <文本链> <文本链> <文本链> <文本链> <文本链> <文本链>