聯系人:劉小姐,李小姐,王小姐
Tel:010-62000662,62051209
Fax:010-82036512
Mobile:13701081790
Email:bjqingda@126.com
Web:www.tsingtek.com
QQ:453189731
微信:13701081790
地址:北京市海淀區花園東路32號花園公寓A402室清達光電25664OLED模塊SSD1322測試程序,示例代碼
清達光電25664OLED模塊SSD1322測試程序,示例代碼:
清達光電為您提供顯示模塊,并提供高質量的技術服務
OLED模塊SSD1322控制器的屏主要是HGS256641,HGS256642,HGS256643,HGS256128等產品。
主要示例代碼(更詳細的代碼請QQ 453189731或者13701081790索?。?br>/*************************************************************
//杭州清達光電OLED演示程序
//2009-08-01
*************************************************************/
#define DATA_BUS P1
sbit REST=P3^4; // Reset
sbit CS=P3^3; // Chip Select
sbit DC=P3^2; // Data/Command Control
sbit SCLK=P3^0; // Serial Clock Input
sbit SDIN=P3^1; // Serial Data Input
void Fill_RAM(unsigned char Data) ;
uchar code tab1616[]={
/* 點陣:16x16
提取點陣方向:橫向(先左->右, 再上->下)
字節掉轉:否
字節方式:C語言 */
0x00,0x40,0x40,0x48,0x37,0xFC,0x10,0x40, // 清
0x83,0xF8,0x60,0x40,0x2F,0xFE,0x08,0x08,
0x13,0xFC,0x22,0x08,0xE3,0xF8,0x22,0x08,
0x23,0xF8,0x22,0x08,0x22,0x28,0x22,0x10,
0x00,0x80,0x40,0x80,0x20,0x80,0x20,0x80, // 達
0x00,0x88,0x0F,0xFC,0xE0,0x80,0x21,0x00,
0x21,0x40,0x22,0x20,0x22,0x10,0x24,0x18,
0x28,0x08,0x50,0x06,0x8F,0xFC,0x00,0x00,
0x01,0x00,0x21,0x08,0x11,0x0C,0x09,0x10, // 光
0x09,0x20,0x01,0x04,0xFF,0xFE,0x04,0x40,
0x04,0x40,0x04,0x40,0x04,0x40,0x08,0x40,
0x08,0x42,0x10,0x42,0x20,0x3E,0x40,0x00,
0x02,0x00,0x02,0x00,0x02,0x10,0x7F,0xF8, // 電
0x42,0x10,0x42,0x10,0x7F,0xF0,0x42,0x10,
0x42,0x10,0x7F,0xF0,0x42,0x10,0x02,0x00,
0x02,0x04,0x02,0x04,0x01,0xFC,0x00,0x00,
0x04,0x10,0x0E,0x10,0xF8,0x90,0x08,0x50, // 科
0x08,0x10,0xFE,0x90,0x08,0x50,0x1C,0x14,
0x1A,0x1E,0x29,0xF0,0x28,0x10,0x48,0x10,
0x88,0x10,0x08,0x10,0x08,0x10,0x08,0x10,
0x10,0x40,0x10,0x40,0x10,0x48,0x13,0xFC, // 技
0xFC,0x40,0x10,0x40,0x10,0x40,0x13,0xF8,
0x1A,0x08,0x31,0x10,0xD1,0x10,0x10,0xA0,
0x10,0x40,0x10,0xB0,0x51,0x0E,0x26,0x04,
0x02,0x00,0x02,0x04,0xFF,0xFE,0x04,0x00, // 有
0x04,0x10,0x0F,0xF8,0x08,0x10,0x18,0x10,
0x2F,0xF0,0x48,0x10,0x88,0x10,0x0F,0xF0,
0x08,0x10,0x08,0x10,0x08,0x50,0x08,0x20,
0x00,0x08,0x7D,0xFC,0x45,0x08,0x49,0x08, // 限
0x49,0xF8,0x51,0x08,0x49,0x08,0x49,0xF8,
0x45,0x04,0x45,0x88,0x45,0x50,0x69,0x20,
0x51,0x10,0x41,0x4E,0x41,0x84,0x41,0x00,
0x00,0x00,0x00,0x80,0x04,0x80,0x04,0x40, // 公
0x08,0x40,0x08,0x20,0x11,0x10,0x21,0x0E,
0xC2,0x04,0x02,0x00,0x04,0x00,0x08,0x40,
0x10,0x20,0x1F,0xF0,0x00,0x10,0x00,0x00,
0x00,0x08,0x3F,0xFC,0x00,0x08,0x00,0x48, // 司
0xFF,0xE8,0x00,0x08,0x00,0x88,0x3F,0xC8,
0x20,0x88,0x20,0x88,0x20,0x88,0x20,0x88,
0x3F,0x88,0x20,0x88,0x00,0x28,0x00,0x10,
};
// 4-wire SPI
void Write_cmd(unsigned char Data)
{
unsigned char i;
CS=0;
DC=0;
for (i=0; i<8; i++)
{
SCLK=0;
SDIN=(Data&0x80)>>7;
Data = Data << 1;
SCLK=1;
}
DC=1;
CS=1;
}
void Write_dat(unsigned char Data)
{
unsigned char i;
CS=0;
DC=1;
for (i=0; i<8; i++)
{
SCLK=0;
SDIN=(Data&0x80)>>7;
Data = Data << 1;
SCLK=1;
}
DC=1;
CS=1;
}
/********************************************
行,列,起始地址設定,寫入命令定義 一個像素對應4位
********************************************/
void Set_Column_Address(unsigned char a, unsigned char b)
{
Write_cmd(0x15); // Set Column Address
Write_dat(a); // Default => 0x00
Write_dat(b); // Default => 0x77
}
void Set_Row_Address(unsigned char a, unsigned char b)
{
Write_cmd(0x75); // Set Row Address
Write_dat(a); // Default => 0x00
Write_dat(b); // Default => 0x7F
}
void Set_Write_RAM()
{
Write_cmd(0x5C); // Enable MCU to Write into RAM
}
void Set_Remap_Format(unsigned char d)
{
Write_cmd(0xA0); // Set Re-Map / Dual COM Line Mode
Write_dat(d); // Default => 0x40
Write_dat(0x11); // Default => 0x01 (Disable Dual COM Mode)
}
/* ***********************************
//初始化程序
***************************************/
void Initial (void)
{
REST=0;
delayms(100);
REST=1;
delayms(100);
Write_cmd(0xFD);
Write_dat(0x12); //打開MCU通信
Set_Column_Address(0x1c,0x5b); //256列
Set_Row_Address(0x00,0x3f); //64行
Write_cmd(0xAE); //開休眠
Write_cmd(0xB3); ///驅動和振蕩時鐘
Write_dat(0x91);
Write_cmd(0xCA); ///設定MUX占空比
Write_dat(0x3F);
Write_cmd(0xA2);
Write_dat(0x00); //卷動地址
Write_cmd(0xA1);
Write_dat(0x00); //起始行
Write_cmd(0xA6); //正常顯示
Write_cmd(0xA0);
Write_dat(0x14);
Write_dat(0x11); //掃描方向
Write_cmd(0xB5); ///set gpio
Write_dat(0x00);
Write_cmd(0xAB);
Write_dat(0x01); //內部調節電壓
Write_cmd(0xB4); ///加深顯示Display Enhancement a
Write_dat(0xA0);
Write_dat(0xfd); //0xb5
//C1C7調節對比度
Write_cmd(0xC1); ///Set Contrast Current
Write_dat(0xaf); //9f
Write_cmd(0xC7); //Master Contrast Current Control
Write_dat(0x0F);
Write_cmd(0xb8); //灰模
Write_dat(0x0c);
Write_dat(0x18);
Write_dat(0x24);
Write_dat(0x30);
Write_dat(0x3c);
Write_dat(0x48);
Write_dat(0x54);
Write_dat(0x60);
Write_dat(0x6c);
Write_dat(0x78);
Write_dat(0x84);
Write_dat(0x90);
Write_dat(0x9c);
Write_dat(0xa8);
Write_dat(0xb4);
Write_cmd(0x00);
Write_cmd(0xB1); //Set Phase Length驅動波形
Write_dat(0xE2);
Write_cmd(0xD1); //Display Enhancement B
Write_dat(0xa2);
Write_dat(0x20);//反顯
Write_cmd(0xBB);
Write_dat(0x1F);
Write_cmd(0xB6);
Write_dat(0x08);
Write_cmd(0xBE);
Write_dat(0x07);//0.86VCC
Write_cmd(0xA6);//正常顯示
Write_cmd(0xA9);//退部分顯示
Write_cmd(0x5c);
Fill_RAM(0x00);
Write_cmd(0xAF); //關休眠
}
/***************************************
主函數
**************************************/
void main(void)
{
Initial ();
while(1)
{
Fill_RAM(0xff);
delay(2);
Fill_RAM(0xf0);
delay(2);
Fill_RAM(0x0f);
delay(2);
gedot(0xf0);
delay(2);
gedot(0x0f);
delay(2);
hang(0xff);
delay(2);
hang(0x00);
delay(2);
Fill_RAM(0x00);
biank();
hzwrite_oled(14,5,0x00);
hzwrite_oled(22,5,0x01);
hzwrite_oled(30,5,0x02);
hzwrite_oled(38,5,0x03);
stinghz(4,25,10) ;
string816(14,45,10);
delay(5);
}}