文章详情

清达光电SSD1305控制器12864点阵OLED显示屏示例程序

日期:2024-11-23 02:25
浏览次数:2795
摘要: 清达光电为您提供多种OLED显示屏,详情可以QQ 453189731 或者13701081790 刘小姐; 清达光电SSD1305控制器的显示屏有HGS128321,HGS1286418,HGS128643,HGS128644等等 1,以HGS1286418为例: 外形尺寸 93.0(W)×70.0(H)×9.5MAX.(T) mm 可视区 65.0(W)×33.0(H) mm 有效区 61.41(W)×30.69(H) mm 点阵 128 DOTS×64 DOTS --- 点距离 0.48(W)×0.48(H ) mm 点大小 0.455(W)×0.455(H) mm 数据输入 8-bits 8080、4-wire SPI,I2C等接口可选 占空比 1/64 驱动 IC SSD1305 工作温度 -40...

清达光电为您提供多种OLED显示屏,详情可以QQ 453189731 或者13701081790 刘小姐

清达光电SSD1305控制器的显示屏有HGS128321,HGS1286418,HGS128643,HGS128644等等

1,以HGS1286418为例:

外形尺寸 93.0(W)×70.0(H)×9.5MAX.(T) mm
可视区 65.0(W)×33.0(H) mm
有效区 61.41(W)×30.69(H) mm
点阵 128 DOTS×64 DOTS ---
点距离 0.48(W)×0.48(H ) mm
点大小 0.455(W)×0.455(H) mm

数据输入 8-bits 8080、4-wire SPI,I2C等接口可选
占空比 1/64
驱动 IC SSD1305
工作温度 -40  ~80 ℃

效果图:


2,清达光电SSD1305控制器12864点阵OLED显示屏示例程序(*基本的8051单片机):

#include <reg52.h>
#include <intrins.h>
#include <math.h>
#include <stdio.h>

#define   lcddata P1  //P1作为数据口
#define   uchar  unsigned char
#define   uint   unsigned char

#define XLevelL        0x00 //列地址抵位
#define XLevelH        0x10 //列地址高位
#define XLevel        ((XLevelH&0x0F)*16+XLevelL)      //first addr
#define Max_Column    128
#define Max_Row        64
     sbit  _WR=P3^1;
   sbit  _RD=P3^3;
   sbit  CS=P3^4;
   sbit  DC=P3^0;
   sbit  RES=P3^5;

uchar code tab8[][8]={
0x00,0x3E,0x51,0x49,0x45,0x3E,0x00,0x00,    /*"0"=10h*/
0x00,0x00,0x42,0x7F,0x40,0x00,0x00,0x00,    /*"1"=11h*/
0x00,0x42,0x61,0x51,0x49,0x46,0x00,0x00,    /*"2"=12h*/
0x00,0x21,0x41,0x45,0x4B,0x31,0x00,0x00,    /*"3"=13h*/
0x00,0x18,0x14,0x12,0x7F,0x10,0x00,0x00,    /*"4"=14h*/
0x00,0x27,0x45,0x45,0x45,0x39,0x00,0x00,    /*"5"=15h*/
0x00,0x3C,0x4A,0x49,0x49,0x30,0x00,0x00,    /*"6"=16h*/
0x00,0x01,0x01,0x79,0x05,0x03,0x00,0x00,    /*"7"=17h*/
0x00,0x36,0x49,0x49,0x49,0x36,0x00,0x00,    /*"8"=18h*/
0x00,0x06,0x49,0x49,0x29,0x1E,0x00,0x00,    /*"9"=19h*/
0x00,0x00,0x36,0x36,0x00,0x00,0x00,0x00,    /*":"=1Ah*/
0x00,0x00,0x56,0x36,0x00,0x00,0x00,0x00,    /*";"=1Bh*/
0x00,0x7E,0x11,0x11,0x11,0x7E,0x00,0x00,    /*"A"=21h*/
0x00,0x41,0x7F,0x49,0x49,0x36,0x00,0x00,    /*"B"=22h*/
0x00,0x3E,0x41,0x41,0x41,0x22,0x00,0x00,    /*"C"=23h*/
0x00,0x41,0x7F,0x41,0x41,0x3E,0x00,0x00,    /*"D"=24h*/
0x00,0x7F,0x49,0x49,0x49,0x49,0x00,0x00,    /*"E"=25h*/
0x00,0x7F,0x09,0x09,0x09,0x01,0x00,0x00,    /*"F"=26h*/
0x00,0x3E,0x41,0x41,0x49,0x7A,0x00,0x00,    /*"G"=27h*/
0x00,0x7F,0x08,0x08,0x08,0x7F,0x00,0x00,    /*"h"=28h*/
0x00,0x00,0x41,0x7F,0x41,0x00,0x00,0x00,    /*"I"=29h*/
};
uchar code tab16[][32]={
/* 点阵:16x16
   提取点阵方向:纵向
   字节掉转:是
   字节方式:C语言 */
0x10,0x22,0x64,0x0C,0xC0,0x44,0x54,0x54,    // 清
0x54,0x7F,0x54,0x54,0xD6,0x44,0x40,0x00,
0x04,0x04,0xFE,0x01,0x00,0x00,0xFF,0x15,
0x15,0x15,0x55,0x95,0x7F,0x01,0x00,0x00,

0x40,0x42,0xCC,0x00,0x20,0x20,0x20,0xA0,    // 达
0x7F,0x20,0x20,0x20,0x30,0x20,0x00,0x00,
0x40,0x20,0x1F,0x20,0x50,0x48,0x46,0x41,
0x40,0x41,0x42,0x4C,0x58,0x60,0x20,0x00,

0x40,0x40,0x42,0x44,0x58,0xC0,0x40,0x7F,    // 光
0x40,0xC0,0x50,0x48,0x46,0x64,0x40,0x00,
0x00,0x80,0x40,0x20,0x18,0x07,0x00,0x00,
0x00,0x3F,0x40,0x40,0x40,0x40,0x70,0x00,

0x00,0x00,0xC0,0x40,0x40,0x40,0x7F,0x48,    // 电
0x48,0x48,0x48,0xE8,0x4C,0x08,0x00,0x00,
0x80,0x40,0x37,0x04,0x14,0x64,0x04,0x14,
0x24,0x64,0x04,0x17,0x20,0xC0,0x00,0x00,

0x10,0x22,0x64,0x0C,0x80,0x04,0xC4,0x34,    // 液
0x05,0xC6,0xBC,0x24,0x24,0xE6,0x04,0x00,
0x04,0x04,0xFE,0x01,0x02,0x01,0xFF,0x42,
0x21,0x16,0x08,0x15,0x23,0x60,0x20,0x00,

0x00,0x00,0x00,0x00,0xFF,0x49,0x49,0x49,    // 晶
0x49,0x49,0xFF,0x00,0x00,0x80,0x00,0x00,
0x00,0xFF,0x49,0x49,0x49,0x49,0xFF,0x00,
0xFF,0x49,0x49,0x49,0x49,0xFF,0x01,0x00,

0x10,0x10,0xD0,0xFF,0x94,0x14,0xE4,0xBF,    // 模
0xA4,0xA4,0xA4,0xBF,0xF4,0x26,0x04,0x00,
0x04,0x03,0x00,0xFF,0x08,0x89,0x8B,0x4A,
0x2A,0x1E,0x2A,0x2A,0x4B,0xC8,0x48,0x00,

0x20,0x20,0x20,0xFF,0x20,0x20,0x10,0x10,    // 块
0xFF,0x10,0x10,0x10,0xF8,0x10,0x00,0x00,
0x08,0x18,0x08,0x0F,0x84,0x46,0x22,0x1A,
0x07,0x0A,0x12,0x22,0x43,0xC2,0x42,0x00,
};

void uDelay(unsigned char l)
{
    while(l--);
}
void delay(unsigned char n)
{
unsigned char i,j,k;

    for(k=0;k<n;k++)
    {
        for(i=0;i<131;i++)
        {
            for(j=0;j<15;j++)
            {
            uDelay(80);
            }
        }
    }
}
void  Writecom(uchar com)
{
    DC=0;
    CS=0;

    _WR=0;
        _nop_();
        lcddata=com;
        _nop_();
    _WR=1;
        _nop_();
        _nop_();
    CS=1;
    DC=1;
}
void Writedata(uchar dat)
{
    DC=1;
    CS=0;
    _WR=0;
         _nop_();
        lcddata=dat;
        _nop_();
    _WR=1;
         _nop_();
    CS=1;
    DC=1;

}
uchar Readcom()
{
       uchar com;
    DC=0;
    CS=0;
        lcddata=0xff;
    _RD=0;
        _nop_();
        _nop_();
         com=lcddata;
    _RD=1;
        _nop_();
        _nop_();
    CS=1;
    DC=1;
        return com;
}
uchar Readdata()
{
       uchar dat;
    DC=1;
    CS=0;
        lcddata=0xff;
    _RD=0;
         _nop_();
        _nop_();
        dat= lcddata;
    _RD=1;
         _nop_();
        _nop_();
    CS=1;
    DC=1;
        return dat;
}