欢迎访问电子工程网!   登录 | 免费注册 ]   

qdgd的个人空间 http://www.chimalift.com/space-uid-161219.html [收藏] [复制] [分享] [RSS]

博客

SSD1325控制器超低温OLED显示模块示例程序参考

已有 331 次阅读2019-8-31 15:28 |个人分类:显示应用| 关键词: 91357, HGS128646

    SSD1325主要应用在超低温OLED显示模块的驱动和控制,一般用于128*64点阵的OLED显示模块上,清达光电编写了SSD1325主控128*64点阵OLED显示模块的示例程序,供大家参考(以下是以HGS128646 外形 92*70mm  工作温度-40~70℃为样例的)
原理图

电路图如下:
//编写人:清达光电  有任何问题可以联系我们 13701081790
#include<reg51.h>
#include <string.h>
#include <intrins.h>
#include <math.h>
#define uchar unsigned char
#define uint unsigned int
#define DATA P1
sbit CD = P3^0;
sbit WR1 = P3^1;
sbit RD1 = P3^3;
sbit CS = P3^4;
sbit RES = P3^5;
//17 18 脚拉高;
uchar RAM_data[4];
uchar code table_88[]={ v>
0x00,0x00,0x00,0xE0,0x10,0x70,0x98,0x70,/*"a",0*/
0x00,0x80,0x80,0xE0,0x90,0x90,0xE0,0x00,/*"b",1*/
0x00,0x00,0x00,0x60,0x90,0x80,0x90,0x60,/*"c",2*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",3*/
0x00,0x60,0x90,0x90,0x90,0x90,0x60,0x00,/*"0",4*/
0x00,0x60,0x20,0x20,0x20,0x20,0x70,0x00,/*"1",5*/
0x00,0x60,0x90,0x10,0x20,0x40,0xF0,0x00,/*"2",6*/
};// @Adobe 明体,逐行式,顺向;
uchar code table_816[]={
0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x42,0x4
2,0x42,0x42,0x24,0x18,0x00,0x00,/*"0",0*/
0x00,0x00,0x00,0x10,0x70,0x10,0x10,0x10,0x10,0x1
0,0x10,0x10,0x10,0x7C,0x00,0x00,/*"1",1*/
0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x04,0x04,0x0
8,0x10,0x20,0x42,0x7E,0x00,0x00,/*"2",2*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0v>
0,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",3*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x1
E,0x22,0x42,0x42,0x3F,0x00,0x00,/*"a",4*/
0x00,0x00,0x00,0xC0,0x40,0x40,0x40,0x58,0x64,0x4
2,0x42,0x42,0x64,0x58,0x00,0x00,/*"b",5*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x4
0,0x40,0x40,0x22,0x1C,0x00,0x00,/*"c",6*/
}; // 宋体,逐行式,顺向;
uchar code table_1616[]={
0x40,0x40,0x23,0xFC,0x20,0x40,0x0B,0xFC,0x88,0x
40,0x57,0xFC,0x50,0x00,0x13,0xF8,0x22,0x08,0x23,
0xF8,0xE2,0x08,0x23,0xF8,0x22,0x08,0x22,0x08,0x
22,0x28,0x22,0x10,/*"",0*/
0x00,0x00,0x40,0x80,0x30,0x80,0x10,0x80,0x0F,0xF
C,0x00,0x80,0x00,0x80,0xE0,0x80,0x21,0x40,0x21,0
x20,0x22,0x18,0x24,0x0C,0x28,0x08,0x50,0x02,0x8F
,0xFC,0x00,0x00,/*"",1*/
0x01,0x00,0x21,0x10,0x19,0x18,0x0D,0x10,0x09,0x
20,0x01,0x04,0x7F,0xFE,0x04,0x40,0x04,0x40,0x04,
0x40,0x04,0x40,0x08,0x42,0x08,0x42,0x10,0x42,0x2
0,0x3E,0x40,0x00,/*"",2*/
0x01,0x00,0x01,0x00,0x01,0x00,0x3F,0xF8,0x21,0x0
8,0x21,0x08,0x3F,0xF8,0x21,0x08,0x21,0x08,0x21,0
x08,0x3F,0xF8,0x21,0x08,0x01,0x02,0x01,0x02,0x00
,0xFE,0x00,0x00,/*"",3*/
}; // 宋体,逐行式,顺向;
uchar code BMP[]={
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x
FF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0
0,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0
x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01
,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x
00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0
0,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0
x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x01
,0x80,0x04,0x1C,0x78,0x00,0x00,0x00,0xF0,0x40,0x
00,0x01,0x00,0x00,0x1C,0x00,0x01,0x80,0x1C,0x22,
0x84,0x00,0x00,0x01,0x10,0xC0,0x00,0x00,0x00,0x0
0,0x04,0x00,0x01,0x80,0x04,0x22,0x84,0x00,0x00,0
x02,0x01,0x40,0x00,0x00,0x00,0x00,0x04,0x00,0x01
,0x80,0x04,0x02,0x48,0x01,0xB8,0x02,0xE2,0x40,0x
0F,0x87,0x1B,0x87,0x04,0x1E,0x01,0x80,0x04,0x04,v>
0x78,0x00,0x90,0x03,0x12,0x40,0x04,0x41,0x09,0x0
8,0x84,0x22,0x01,0x80,0x04,0x08,0x84,0x00,0x60,0
x02,0x14,0x40,0x04,0x41,0x06,0x0F,0x84,0x18,0x01
,0x80,0x04,0x10,0x84,0x00,0x60,0x02,0x13,0xE0,0x
04,0x41,0x06,0x08,0x04,0x04,0x01,0x80,0x04,0x22,
0x84,0x00,0x90,0x02,0x10,0x40,0x04,0x41,0x09,0x0
8,0x84,0x22,0x01,0x80,0x1F,0x3E,0x78,0x01,0xD8,0
x01,0xE0,0xE0,0x07,0x87,0xDD,0x87,0x1F,0x3C,0x
01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x0
0,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0
x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x
01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x0
0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0
x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x
01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x0
0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0
x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x
01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x0
0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0
x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x
01,0x80,0x10,0x00,0x00,0x40,0x00,0xC0,0x01,0x00,
0x00,0x04,0x01,0x00,0x00,0x00,0x01,0x80,0x10,0x0
0,0x00,0x40,0x01,0x00,0x01,0x00,0x41,0x04,0x01,0
x00,0x00,0x00,0x01,0x80,0x10,0x00,0x00,0x40,0x01
,0x00,0x01,0x00,0x00,0x04,0x01,0x00,0x00,0x00,0x
01,0x98,0x1E,0x07,0x03,0xC1,0x81,0xC1,0xE1,0xE0
,0x43,0x04,0x81,0x0E,0xC0,0xF0,0x39,0x84,0x11,0x
08,0x04,0x42,0x41,0x02,0x21,0x10,0x41,0x05,0x01,
0x09,0x20,0x88,0x45,0x9C,0x11,0x08,0x04,0x43,0x
C1,0x02,0x21,0x10,0x41,0x07,0x01,0x09,0x20,0x88,
0x45,0xA4,0x11,0x08,0x04,0x42,0x01,0x02,0x21,0x
10,0x41,0x04,0x81,0x09,0x20,0x88,0x45,0x9C,0x1E,
0x07,0x03,0xC1,0xC1,0x01,0xE1,0x10,0x41,0x04,0x
41,0x09,0x20,0x88,0x39,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x20,0x00,0x01,0x00,0x00,0x00,0x00,0x0
0,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x01,0xC0,0
x00,0x02,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00v>
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x
00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0
0,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0
x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x
00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0
0,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0
x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x
00,0x00,0x00,0x00,0x01,0x80,0x00,0x06,0x00,0x20,
0x0E,0x01,0xC0,0x02,0x01,0xE0,0x0C,0x01,0xE0,0x
00,0x01,0x80,0x00,0x09,0x00,0x60,0x01,0x00,0x20,
0x06,0x01,0x00,0x10,0x00,0x20,0x00,0x01,0x80,0x0
0,0x09,0x00,0x20,0x01,0x00,0x20,0x0A,0x01,0x00,0
x10,0x00,0x40,0x00,0x01,0x80,0x00,0x09,0x00,0x20
,0x02,0x00,0xC0,0x12,0x01,0xC0,0x1C,0x00,0x40,0
x00,0x01,0x80,0x00,0x09,0x00,0x20,0x06,0x00,0x20
,0x1F,0x00,0x20,0x12,0x00,0x80,0x00,0x01,0x80,0x
00,0x09,0x00,0x20,0x08,0x00,0x20,0x02,0x00,0x20,
0x12,0x00,0x80,0x00,0x01,0x80,0x00,0x06,0x00,0x7
0,0x0F,0x01,0xC0,0x02,0x01,0xC0,0x0C,0x01,0x00,
0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x0
0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0
x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x
00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x0
0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0
x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x
00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x0
0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0
x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x
00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x0
0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0
x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x
00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x
FF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,/*"F:\

v>
相册\新建文件夹 (2)\HGS12864-001.bmp",0*/
};// 逐行式,顺向;
/*******************************************
延时子程序;
*******************************************/
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=124;y>0;y--);
}
void delay_100us(uchar z)
{
z=z*16;
while(z--);
}
/*******************************************
写入指令和数据;
*******************************************/
void wr_data(uchar b) //写数据 ;
{
RD1=1;
CS=0;
CD=1;
DATA=b;
WR1=0;
WR1=1;
_nop_();
CS=1;
}
void wr_com(uchar com) //写命令;
{
RD1=1;
CS=0;
CD=0;
DATA=com;
WR1=0;
WR1=1;
_nop_();
CS=1;
}

/*******************************************
工作窗口设置;
*******************************************/
void SET_AW(uchar a,uchar b,uchar c,uchar d)
{
wr_com(0x15);
wr_com(a);
wr_com(b);
wr_com(0x75);
wr_com(0x0c+c);
wr_com(0x0c+d);
}
/*******************************************
隔行,隔列,全屏,隔点程序;
*******************************************/
void all_screen(uchar b) //128*80 整个 RAM 区清屏;
{
uchar i,j;
wr_com(0x15);
wr_com(0x00);
wr_com(0x3f);
wr_com(0x75);
wr_com(0x00);
wr_com(0x4f);
for (j=0;j<80;j++) v>
for (i=0;i<64;i++) wr_data(b);
}
void fill(uchar b)//128*64 显示界面的操作,b=0
;b=F0H 隔列;b=FFH 全屏;
{
uchar i,j;
SET_AW(0,63,0,63);
for (j=0;j<64;j++)
for (i=0;i<64;i++) wr_data(b);
}
/*******************************************
写入一副 128*64 的图片;(逐行式,顺向)
*******************************************/
void wr_BMP(uchar code *s)
{
uchar i,j;
SET_AW(0,63,0,63);
for (j=0;j<64;j++)
for (i=0;i<16;i++) change(*s++);
}
/*******************************************
写入 8*8 字符;
x y-->行列地址;n 首字符序号,end_n 尾字符序号;
*******************************************/
void word_88(uchar x,uchar y,uchar n)
//8*8 字符单个写;
{
uchar i;
SET_AW(x,x+3,y,y+7);
for(i=0;i<8;i++) change(table_88[8*n+i]);
}
void show_88(uchar x,uchar y,uchar n,uchar end_n)
//写入 y 一串 8*8 字符,可自动换行;
{
uchar i;
for(i=n;i<=end_n;i++)
{
if(x>60) {y=y+8;x=0;}
word_88(x,y,i);
x=x+4;
}
} v>
/*******************************************
写入 8*16 16*16 字符;
x y-->行列地址;n 首字符序号,end_n 尾字符序号;
*******************************************/
void word_816(uchar x,uchar y,uchar n)
//8*16 字符单个写;
{
uchar i;
SET_AW(x,x+3,y,y+15);
for(i=0;i<16;i++) change(table_816[16*n+i]);
}
void word_1616(uchar x,uchar y,uchar n)
//16*16 字符单个写;
{
uchar i;
SET_AW(x,x+7,y,y+15);
for(i=0;i<32;i++)
change(table_1616[32*n+i]);
}
void show_816(uchar x,uchar y,uchar n,uchar end_n)
//写入 y 一串 8*16 字符,可自动换行;
{
uchar i;
for(i=n;i<=end_n;i++)
{
word_816(x,y,i);
x=x+4;
}
}
void show_1616(uchar x,uchar y,uchar n,uchar end_n)
//写入 y 一串 16*16 字符,可自动换行;
{
uchar i;
for(i=n;i<=end_n;i++)
{
if(x>60) {y=y+8;x=0;}
word_1616(x,y,i);
x=x+8;
}
}
/*******************************************
初始化函数;
*******************************************/v>
void init(void)
{
delay(50);
RES=1;delay(1);
RES=0;delay(1);
RES=1;delay(1);
// 设置列窗口;
wr_com(0x15);
wr_com(0x00); /* 左边界 0 */
wr_com(0x3F); /* 右边界 127*/
// 设置行窗口;
wr_com(0x75);
wr_com(0x0C); /* 上边界 0*/
wr_com(0x4b); /* 下边界 63*/
// 设置 SEG 电流等级;
wr_com(0x81);
wr_com(0x40); /* 128 */
// 设置 SEG 电流范围;
wr_com(0x86);
/* 84H=1/4,85H=1/2,86H=1 */
// 设置逆转地图;
wr_com(0xA0);
wr_com(0x52);
/* BIT-0=1 列窗口反向 ,BIT-1=1 高半字节在
,BIT-2=1 COM 反向,BIT-6=0/1 EVEN/ODD */
// 设置显示起始行;
wr_com(0xA1);
wr_com(0x0C); /* 0*/
// 设置显示分支
wr_com(0xA2);
wr_com(0x4C); /* 0*/
// 设置显示模式;
wr_com(0xA4);
/* A4H=正常显示,A5H=全显,A6H=关显示,A7H=
*/
// 设置扫描行;
wr_com(0xA8);
wr_com(0x3F); /* 64*/
// 设置 P1 P2 ;
wr_com(0xB1);
wr_com(0x04); /* 4 */
wr_com(0x06<<4); /* 6 */
// 设置行周期;
wr_com(0xB2); v>
wr_com(0X46); /* 70*/
// 设置 D Fosc;
wr_com(0xB3);
wr_com(0x01);
wr_com(0x04<<4); /* Fosc=4 D=2 */
// 设置 Vp2
wr_com(0xBC);
wr_com(0x00); /* 0.51 */
// 设置 Vcomh
wr_com(0xBE);
wr_com(0x00); /* 0.51 */
// 设置 Vsl
wr_com(0xBF);
wr_com(0x0E); /* 连接电容到 VSS */
// 设置灰度;
wr_com(0xB8);
wr_com(0x07); /* L1[2:1] */
wr_com(0x33);
/* L3[6:4], L2[2:0] 0001 0001*/
wr_com(0x33);
/* L5[6:4], L4[2:0] 0010 0010*/
wr_com(0x33);
/* L7[6:4], L6[2:0] 0011 1011*/
wr_com(0x33);
/* L9[6:4], L8[2:0] 0100 0100*/
wr_com(0x33);
/* LB[6:4], LA[2:0] 0101 0101*/
wr_com(0x33);

v>
/* LD[6:4], LC[2:0] 0110 0110*/
wr_com(0x72);
/* LF[6:4], LE[2:0] 1000 0111*/
all_screen(0x00);
// 显示开关;
wr_com(0xAF); /* AF=ON, AE=Sleep Mode */
// 设置 Vcc 来源;
wr_com(0xAD);
wr_com(0x02); /* 03=内部 02=外部 */
}
/*******************************************
主程序;
*******************************************/
main()
{
init();
while(1)
{
show_88(15,2,0,6);
show_816(14,10,0,6);
show_1616(13,30,0,3);delay(1000);
fill(0x00);delay(10);
wr_BMP(BMP); delay(1000);
fill(0x00);delay(10);
}
}

SSD1325宽温OLED显示模块HGS128646显示图片


路过

鸡蛋

鲜花

握手

雷人

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 立即注册
验证问答 换一个 验证码 换一个

回顶部 秒速时时彩 秒速时时彩开奖 安徽快3 秒速时时彩 加拿大28 安徽快3 北京赛车高倍率平台 北京赛车微信二维码进群玩 秒速时时彩开奖 秒速时时彩平台