OLED,昨天调试成功!
OLED程序根据网友“草真多”的AVR程序移植修改,在“AS-04单片机实验开发板”上硬件(STC89LE516RD+ 11.0592MHz)实验调试通过。
(AS-04 MCU StudyBoard + LCD1602 + 2.4 TFT LCD touch panel + OLED + VS1003B MP3)
20090701 11.00am pass 周密
20090715 18:05 ok at OLED board + AS-04 (STC89LE516RD+)
(原文件名:OLED SSD1332T7 模块1.jpg)
(原文件名:OLED SSD1332T7 模块2.jpg)
(原文件名:OLED SSD1332T7 模块3.jpg)
(原文件名:SSD1332T7显示效果1.jpg)
(原文件名:SSD1332T7显示效果2.jpg)
OLED实验01: 显示彩条、单 {MOD}彩 {MOD}的测试
Cx51语言程序,文件名:main.c等
程序在“AS-04单片机实验开发板”上硬件(STC89LE516RD+ 11.0592MHz)实验调试通过。
(AS-04 MCU StudyBoard + LCD1602 + 2.4 TFT LCD touch panel + OLED + VS1003B MP3)
电子科技大学成都学院 周密,20090715。QQ1881003,http://shop34222612.taobao.com/
-----------------------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------------------
由于时间关系,没有自己编程写程序(有空还是应该自己写),不是原创;PCB设计和硬件焊接组装是原创。
特此声明!如果网友认为侵权,请联系我(QQ 1881003)!
致谢:
LCD程序根据LCD屏店主提供的以及其他网友的程序移植修改;
触摸屏手写程序根据网友“正点原子@SCUT”的STM32程序移植修改;
OLED程序根据网友“草真多”的AVR程序移植修改。
这里顺便说一句,移植修改程序,有时候比自己编写还费神费事哦!
-----------------------------------------------------------------------------------------------*/
//20090701 11.00am pass 周密
//20090715 18:05 ok at OLED board + AS-04 (STC89LE516RD+)
#include <reg52.h>
#define DAT P2
sbit RW =P1^0;//WR#
sbit E =P1^1;//RD#
sbit REST =P1^2;
sbit RS =P3^6; //DC
sbit CS =P1^6;
sbit ON =P3^7;
#define Uchar unsigned char
#define Uint unsigned int
extern unsigned char code tx9[];
extern unsigned char code tx6[];
extern unsigned char code tx7[];
extern unsigned char code tx8[];
extern unsigned char code tx5[];
void Initial(void);
void dispBmp(Uchar *Pbmp);
void ComWrite(Uchar COM);
void DataWrite(Uchar DATA);
void ColorSet(int ptr1);
void SendDATA(int ptr);
void Display1(void);
void Display2(void);
void Display3(void);
unsigned char RGB[]={0x00,0x1f,0x07,0xe0,0xf8,0x00,0x00,0x00,0xff,0xff};
unsigned char
ColorBar[]={0xff,0xff,0xf8,0x00,0xff,0xe0,0x07,0xe0,0x07,0xff,0x00,0x1f,0x00,0x00};
void delay(Uint x) //延时函数Delay。x=1时为1ms延时程序
{
Uchar j=0; //根据汇编代码分析表明,用j进行的内部循环大约延时8us(12MHz)
while(x--)
{
for(j=0;j<125;j++) //125应根据实验进行补偿调整为123(12MHz)
{;}
}
}
void main(void)
{
ON=0;
ON=1;
Initial();
while(1)
{
dispBmp(tx9);
dispBmp(tx5);
dispBmp(tx8);
dispBmp(tx7);
dispBmp(tx6);
dispBmp(tx5);
Display1();
Display2();
Display3();
ColorSet(0x0000);
ColorSet(0xffff);
ColorSet(0xf800);
ColorSet(0x07e0);
ColorSet(0x001f);
}
}
void Initial(void)
{
CS=0;
delay(10);
REST=0;
delay(10);
REST=1;
delay(10);
ComWrite(0x81); //set High Brightness
ComWrite(0xdf);
ComWrite(0x82); //set High Brightness
ComWrite(0x1f);
ComWrite(0x83); //set High Brightness
ComWrite(0xff);
ComWrite(0x87); //set High Brightness
ComWrite(0x0f);
ComWrite(0xa0);
ComWrite(0x60); //set 65k color format
ComWrite(0xa4); //set Normal Display
ComWrite(0xa8); //set Multiplex Ratio
ComWrite(0x3f);
ComWrite(0xad); //set Power Control
ComWrite(0x8f);
//ComWrite(0xa9); //set Power Control
//ComWrite(0x03);
ComWrite(0xaf); //set Display on
ComWrite(0xb8);
ComWrite(0x01);
ComWrite(0x05);
ComWrite(0x09);
ComWrite(0x0d);
ComWrite(0x11);
ComWrite(0x15);
ComWrite(0x19);
ComWrite(0x1d);
ComWrite(0x21);
ComWrite(0x25);
ComWrite(0x29);
ComWrite(0x2d);
ComWrite(0x31);
ComWrite(0x35);
ComWrite(0x39);
ComWrite(0x3d);
ComWrite(0x41);
ComWrite(0x45);
ComWrite(0x49);
ComWrite(0x4d);
ComWrite(0x51);
ComWrite(0x55);
ComWrite(0x59);
ComWrite(0x5d);
ComWrite(0x61);
ComWrite(0x65);
ComWrite(0x69);
ComWrite(0x6d);
ComWrite(0x71);
ComWrite(0x75);
ComWrite(0x79);
ComWrite(0x7d);
}
void ColorSet(int ptr1)
{
Uchar i;
Uint j;
ComWrite(0x0a1);
ComWrite(0x00);
ComWrite(0x75);
ComWrite(0x00);
ComWrite(0x3f);
for(i=0;i<64;i++)
{
ComWrite(0x15);
ComWrite(0x00);
ComWrite(0x5f);
for(j=0;j<96;j++)
{
SendDATA(ptr1);
}
}
delay(1000);
}
void dispBmp(Uchar *Pbmp)
{
register Uint i, j;
ComWrite(0x0a1);
ComWrite(0x00);
ComWrite(0x75);
ComWrite(0x00);
ComWrite(0x3f);
for(i=0;i<64;i++)
{
ComWrite(0x15);
ComWrite(0x00);
ComWrite(0x5f);
for(j=0;j<96*2;j++)
{
DataWrite(*Pbmp++);
}
}
delay(1000);
}
void ComWrite(Uchar COM)
{
E =1;
RS=0;
RW=0;
CS=0;
P2=COM;
//E =0;
CS=1;
RW=1;
RS=1;
}
void DataWrite(Uchar DATA)
{
E =1;
RS=1;
RW=0;
CS=0;
P2=DATA;
CS=1;
RW=1;
RS=0;
}
void SendDATA(int par)
{
RS=1;
RW=0;
CS=0;
P2=(par>>8);
CS=1;
RW=1;
RS=0;
RS=1;
RW=0;
CS=0;
P2=(0xff&par);
CS=1;
RW=1;
RS=0;
}
void Display1(void)
{
Uint i,j;
ComWrite(0x0a1);
ComWrite(0x00);
ComWrite(0x75);
ComWrite(0x00);
ComWrite(0x3f);
for(i=0;i<64;i++)
{
ComWrite(0x15);
ComWrite(0x00);
ComWrite(0x5f);
for(j=0;j<13;j++)
{
DataWrite(ColorBar[0]);
DataWrite(ColorBar[1]);
}
for(j=0;j<14;j++)
{
DataWrite(ColorBar[2]);
DataWrite(ColorBar[3]);
}
for(j=0;j<14;j++)
{
DataWrite(ColorBar[4]);
DataWrite(ColorBar[5]);
}
for(j=0;j<14;j++)
{
DataWrite(ColorBar[6]);
DataWrite(ColorBar[7]);
}
for(j=0;j<14;j++)
{
DataWrite(ColorBar[8]);
DataWrite(ColorBar[9]);
}
for(j=0;j<14;j++)
{
DataWrite(ColorBar[10]);
DataWrite(ColorBar[11]);
}
for(j=0;j<13;j++)
{
DataWrite(ColorBar[12]);
DataWrite(ColorBar[13]);
}
}
delay(1000);
}
void Display2(void)
{
Uint i,j;
ComWrite(0x0a1);
ComWrite(0x00);
ComWrite(0x75);
ComWrite(0x00);
ComWrite(0x3f);
for(i=0;i<32;i++)
{
ComWrite(0x15);
ComWrite(0x00);
ComWrite(0x5f);
for(j=0;j<32;j++)
{
DataWrite(RGB[0]);
DataWrite(RGB[1]);
}
for(j=0;j<32;j++)
{
DataWrite(RGB[2]);
DataWrite(RGB[3]);
}
for(j=0;j<32;j++)
{
DataWrite(RGB[4]);
DataWrite(RGB[5]);
}
}
for(i=0;i<32;i++)
{
for(j=0;j<48;j++)
{
DataWrite(RGB[6]);
DataWrite(RGB[7]);
}
for(j=0;j<48;j++)
{
DataWrite(RGB[8]);
DataWrite(RGB[9]);
}
}
delay(1000);
}
void display3(void)
{
unsigned int i;
ComWrite(0x0a1);
ComWrite(0x00);
ComWrite(0x75);
ComWrite(0x00);
ComWrite(0x3f);
ComWrite(0x15);
ComWrite(0x00);
ComWrite(0x5f);
for(i=0;i<6144;i++)
{
DataWrite(0xf8);
DataWrite(0x00);
}
delay(1000);
ComWrite(0x0a1);
ComWrite(0x00);
ComWrite(0x75);
ComWrite(0x00);
ComWrite(0x3f);
ComWrite(0x15);
ComWrite(0x00);
ComWrite(0x5f);
for(i=0;i<6144;i++)
{
DataWrite(0x07);
DataWrite(0xc0);
}
delay(1000);
ComWrite(0x0a1);
ComWrite(0x00);
ComWrite(0x75);
ComWrite(0x00);
ComWrite(0x3f);
ComWrite(0x15);
ComWrite(0x00);
ComWrite(0x5f);
for(i=0;i<6144;i++)
{
DataWrite(0x00);
DataWrite(0x1f);
}
delay(1000);
}
价格便宜一般QFP也就5.50元
(原文件名:SSD1332T7显示效果4.jpg)
一周热门 更多>