RA8835参考例程
时间:2021-02-06作者:杭州佳显科技有限公司浏览:250
我司专业设计生产单色液晶模块、TFT液晶模块、OLED显示模块,下面是其中一款RA8835主控芯片的参考例程,
如需要其他控制器的参考例程可与我联系哦!
********************************
* Author Date : 2008/07/21
* Company : TSINGTEK
* Case : 320 x 240
* Device : AT89S52 at 12.0MHZ
* Compiled Using Keil C v7.50
***********************************/
#include <reg52.h>
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int
#define LCD_BUS P1
sbit _RD=P3^0;
sbit _CS=P3^1;
sbit _RES=P3^4;
sbit A0=P3^2;
sbit _WR=P3^5;
uchar code systom[]={0x32,0x87,0x07,0x27,0x42,0xf0,0x28,0x00,};
uchar code scroll[]={0x00,0x00,0xf0,0x00,0x28,0xf0,0x50,0x00,0x00,0x00,};
uchar code tab[]={"*HANGZHOU TSINGTEK TECHNOLOGY CO...,LTD*"};
uchar code tab1[]={"*** HG320240 ***** HG320240 *******"};
uchar code tab2[]={"$$$$$ WEB: $$$$$"};
uchar code tab3[]={" EDITOR: MR QIN QQ:381198464"};
uchar code CGTAB[][32]={
/* 点阵:16x16
提取点阵方向:横向(先上->下, 再左->右)
字节掉转:否
字节方式:C语言 */
0x00,0x40,0x37,0x10,0x83,0x60,0x2F,0x08, // 清
0x13,0x22,0xE3,0x22,0x23,0x22,0x22,0x22,
0x40,0x48,0xFC,0x40,0xF8,0x40,0xFE,0x08,
0xFC,0x08,0xF8,0x08,0xF8,0x08,0x28,0x10,
0x00,0x40,0x20,0x20,0x00,0x0F,0xE0,0x21, // 达
0x21,0x22,0x22,0x24,0x28,0x50,0x8F,0x00,
0x80,0x80,0x80,0x80,0x88,0xFC,0x80,0x00,
0x40,0x20,0x10,0x18,0x08,0x06,0xFC,0x00,
0x01,0x21,0x11,0x09,0x09,0x01,0xFF,0x04, // 光
0x04,0x04,0x04,0x08,0x08,0x10,0x20,0x40,
0x00,0x08,0x0C,0x10,0x20,0x04,0xFE,0x40,
0x40,0x40,0x40,0x40,0x42,0x42,0x3E,0x00,
0x02,0x02,0x02,0x7F,0x42,0x42,0x7F,0x42, // 电
0x42,0x7F,0x42,0x02,0x02,0x02,0x01,0x00,
0x00,0x00,0x10,0xF8,0x10,0x10,0xF0,0x10,
0x10,0xF0,0x10,0x00,0x04,0x04,0xFC,0x00,
0x00,0x7F,0x44,0x47,0x4C,0x52,0x41,0x42, // 图
0x46,0x49,0x70,0x46,0x41,0x40,0x7F,0x40,
0x04,0xFE,0x04,0xE4,0x44,0x84,0x04,0x84,
0x44,0x3C,0x94,0x04,0x04,0x84,0xFC,0x04,
0x00,0x7F,0x11,0x11,0x11,0x11,0x11,0xFF, // 形
0x11,0x11,0x11,0x11,0x21,0x21,0x41,0x01,
0x80,0xC4,0x0C,0x10,0x20,0x44,0x0C,0xD0,
0x20,0x42,0x06,0x08,0x10,0x20,0x40,0x80,
0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F, // 显
0x14,0x44,0x34,0x14,0x04,0x04,0xFF,0x00,
0x10,0xF8,0x10,0x10,0xF0,0x10,0x10,0xF0,
0x50,0x44,0x4C,0x50,0x40,0x44,0xFE,0x00,
0x00,0x3F,0x00,0x00,0x00,0x00,0xFF,0x01, // 示
0x01,0x09,0x19,0x21,0x41,0x01,0x05,0x02,
0x10,0xF8,0x00,0x00,0x00,0x04,0xFE,0x00,
0x00,0x20,0x18,0x0C,0x04,0x00,0x00,0x00,
0x11,0x11,0x1F,0x11,0xFD,0x13,0x32,0x3B, // 模
0x56,0x53,0x90,0x1F,0x10,0x10,0x11,0x16,
0x10,0x14,0xFE,0x10,0x18,0xFC,0x08,0xF8,
0x08,0xF8,0x40,0xFE,0x40,0xB0,0x0E,0x04,
0x10,0x10,0x10,0x10,0x13,0xFC,0x10,0x10, // 块
0x10,0x17,0x1C,0xF1,0x41,0x02,0x04,0x08,
0x80,0x80,0x80,0x88,0xFC,0x88,0x88,0x88,
0x88,0xFE,0x80,0x40,0x20,0x10,0x0E,0x04,
};
/**延迟子程序***/
void delayus(uint us)
{
while(us--);
}
void Delay(uint t)
{
uint i,j;
for(i=0;i<t;i++)
for(j=0;j<10;j++);
}
/*读数据代码*/
uchar Cmdread()
{
uchar cmdcode;
LCD_BUS=0xff;
_CS=0;
A0=0;
_RD=0;
cmdcode=LCD_BUS;
_RD=1;
_WR=1;
_CS=1;
return cmdcode;
}
/***忙标志***/
void lcd_busy(void)
{
uchar busy;
do
{
busy =(Cmdread() & 0x40);
}while(busy);
}
/*****读数据或参数*****/
uchar ReadData(void)
{
char address_data;
lcd_busy();
LCD_BUS=0xff;
A0 = 1;
_CS = 0;
_RD = 0;
address_data = LCD_BUS;
_RD = 1;
_CS = 1;
A0 = 1;
return address_data;
}
/*******写指令代码******/
void CmdWrite(uchar cmdcode)
{
_CS=0;
A0=1;
LCD_BUS=cmdcode; //写入指令代码
_RD=1;
_WR=0;
_WR=1;
_CS=1;
}
/******写数据或参数*****/
void DataWrite(uchar wrdata)
{
lcd_busy();
_CS=0;
A0=0;
LCD_BUS=wrdata; //写入数据或参数
_RD=1;
_WR=0;
_WR=1;
_CS=1;
}
/********整屏幕写入 ******/
void FullScreenFill(uchar low,uchar high,uchar fill_data)
{
uchar i,j;
CmdWrite(0x46); //光标显示位置设置
DataWrite(low);
DataWrite(high);
CmdWrite(0x42);
for(i=0;i<240;i++)
for(j=0;j<40;j++)
DataWrite(fill_data);
}
/****模块初始化***/
void LCD_Initial()
{
unsigned int i;
CmdWrite(0x40); //系统设置
for(i=0;i<8;i++)
{DataWrite(systom[i]);};
CmdWrite(0x44); //显示区域设置
for(i=0;i<10;i++)
{DataWrite(scroll[i]);};
CmdWrite(0x58); //显示状态设置,显示总开关关闭
DataWrite(0x54); //打开各区显示和关光标
CmdWrite(0x5b); //合成方式设置
DataWrite(0x00);
CmdWrite(0x5d); //光标形状设置
DataWrite(0x07);
DataWrite(0x87);
CmdWrite(0x5c); //CGRAM 的起始地址为7800H
DataWrite(0x00);
DataWrite(0x78);
CmdWrite(0x5a); //点设定
DataWrite(0x00);
FullScreenFill(0x00,0x00,0x00); //清显示1区
FullScreenFill(0x00,0x28,0x00); //清显示二区
FullScreenFill(0x00,0x50,0x00); //清显示三区
CmdWrite(0x59); //打开显示总开关
}
/**********写入字符串*********/
void PrintStr(uint x,uint y,uchar code *pstr)
{
unsigned int j;
j=40*y+x;
CmdWrite(0x4c);
CmdWrite(0x46);
DataWrite(j%256);
DataWrite(j/256);
CmdWrite(0x42);
while(*pstr!=0)
{
DataWrite(*pstr);
pstr++;
}}
/**写入自定义字符**/
void cgramwrite()
{uint i,j;
CmdWrite(0x5c);
DataWrite(0x00);
DataWrite(0x10);
CmdWrite(0x46);
DataWrite(0x00);
DataWrite(0x14);//csr=0x1400;字摸地址80H
CmdWrite(0x4c);
CmdWrite(0x42);;
for(i=0;i<10;i++)
for(j=0;j<32;j++)
{DataWrite(CGTAB[i][j]);
}}
/**********文本方式下写入汉字************/
void textwrite(uint x,uint y,uchar coder)
{
uint i,j;
cgramwrite();
i=40;
j=i*y+x;
CmdWrite(0x4f);
CmdWrite(0x46);
DataWrite(j%256);
DataWrite(j/256);
CmdWrite(0x42);
DataWrite(coder);
DataWrite(coder+1);
j++;
CmdWrite(0x46);
DataWrite(j%256);
DataWrite(j/256);
CmdWrite(0x42);
DataWrite(coder+2);
DataWrite(coder+3);
}
/**********图形方式下写入汉字************/
void mapwrite(uchar x,uchar y,uchar coder)
{
uint i,j,k;
CmdWrite(0x4c);
for(i=0;i<16;i++)
{
j=40*(y+i)+x+0x2800;
CmdWrite(0x46);
DataWrite(j%256);
DataWrite(j/256);
CmdWrite(0x42);
DataWrite(CGTAB[coder][i]);
k=40*(y+i)+x+1+0x2800;
CmdWrite(0x46);
DataWrite(k%256);
DataWrite(k/256);
CmdWrite(0x42);
DataWrite(CGTAB[coder][i+16]);
}}
/****图形方式下写入一串汉字***/
void writemaphz(uchar x,uchar y)
{
uint i;
for(i=0;i<10;i++)
{mapwrite(x,y,i);x=x+3;}
}
/**主程序**/
void main()
{
Delay(30);
LCD_Initial();
textwrite(7,12,0x80);
textwrite(10,12,0x84);
textwrite(13,12,0x88);
textwrite(16,12,0x8c);
textwrite(19,12,0x90);
textwrite(22,12,0x94);
textwrite(25,12,0x98);
textwrite(28,12,0x9c);
textwrite(31,12,0xe0);
textwrite(34,12,0xe4);
PrintStr(0,1,tab);
PrintStr(3,3,tab1);
PrintStr(2,5,tab2);
PrintStr(0,28,tab3);
writemaphz(4,200);
while(1);
}
杭州佳显科技有限公司专注于液晶显示屏,OLED显示屏,低温-40度液晶,国产低温串口屏,加固低温显示屏,密封防潮显示屏,TFT液晶,触摸屏等, 欢迎致电 18069861507
词条
词条说明
如何使LCD屏在阳光下可视
随着科技的发展进步,LCD液晶显示屏应用的场所越来越多,而LCD液晶显示屏在我们身边又**着很重要的位置,但是现在很多LCD液晶显示屏在阳光下不可视,室外环境使用非常不方便,不过我们已经有了在阳光下的可视方案。今天小编就带大家来了解一下这种方案吧。我们应该都有这样的困扰,在户外阳光强烈的情况下,手机的可视程度几乎为0,由于屏幕显示的画面的亮度低于反射光的亮度,反射光是白色的,更亮,淹没了黑色和其他
清达光电OLED使用注意事项
杭州清达光电/杭州佳显科技从事OLED显示模块生产销售十多年,批量出货电力、环保、**、医疗等行业客户,在杭州设有工厂,各种老化试验设备,欢迎来电咨询选购。下面介绍下使用OLED显示模块时的注意事项:OLED 模块的功耗 OLED 是主动发光的,只有点亮的像素才需要消耗电,像素点点亮越多,像素点亮度越 高,功耗会越大(过高的亮度也会影响寿命)。 因此,为了降低功耗,客户在成品设计时: ☆ 避免把亮
企业文化
公司信念“诚信、优质、服务”我们坚持以顾客为中心,努力做到**的产品和优质的服务。公司的使命更清晰和生动地显示我们的世界。
工业液晶屏反应迟钝怎么办?
工业液晶屏在使用过程中,会出现一些故障,如不敏感的现象,那是什么原因会导致这种现象发生呢?让我们学习一下如何更好地做好工业液晶屏的维护措施。如果触摸屏反应缓慢,可能是触摸屏系统陈旧,内部时钟频率太低,或者由于触摸屏表面有水滴而无法移动,为了使触摸屏恢复到快速响应,必须重新更换或升级系统,或者用抹布擦拭触摸屏表面。一般来说,这种现象对于多数触摸屏来说是很常见的,但是应该注意维护它们。在详细的操作使用
八方资源网提醒您:
1、本信息由八方资源网用户发布,八方资源网不介入任何交易过程,请自行甄别其真实性及合法性;
2、跟进信息之前,请仔细核验对方资质,所有预付定金或付款至个人账户的行为,均存在诈骗风险,请提高警惕!