我现在用的是三星的OLED,驱动IC是S6E63D6,弄了一周还没弄好,那位用过的大哥能帮帮我,只要能显示,不管显示什么都可以。
下面是我写的一点显示也没有。
#include "config.h"
//#define M68 // 8-bit 68XX Parallel
// BS0=1; BS1=1
#define I80 // 8-bit 80XX Parallel
// BS0=0; BS1=1
//#define SPI // 4-wire SPI
// BS0=0; BS1=0
// The unused pins should be connected with VSS mostly or floating (D2).
// Please refer to the SSD1351 specification for detail.
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Pin Definition
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#define xData IO2SET //P0 Parallel Data Input/Output
#define LED 1<<29 //P0.29 LED
#define OLED_RES 1<<15 //P0.15 Reset
#define OLED_CS 1<<25 //P3.25 Chip Select
#define OLED_DC 1<<2 //P3.2 A0 Data/Command Control
#define OLED_WR 1<<27 //P3.27 Read/Write Select
#define OLED_RD 1<<1 //P1.1 E Select
#define Flash_CS 1<<0 //P1.0
#define SRAM_CS 1<<26 //P3.26
#define OLED_HVEN 1<<24 //P0.24 ???????í
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Delay Time
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void uDelay(unsigned char l)
{
while(l--);
}
void Delay(unsigned char n)
{
unsigned char i,j,k;
for(k=0;k
{
for(i=0;i<131;i++)
{
for(j=0;j<15;j++)
{
uDelay(203);
}
}
}
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Read/Write Sequence
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#ifdef M68 // 8-bit 68XX Parallel
void Write_Command(unsigned short Data)
{
IO3CLR=OLED_DC; //DC=0;A0
IO3CLR=OLED_CS; //CS=0;
IO3CLR=OLED_WR; //RW=0;
IO1SET=OLED_RD; //E=1;
IO2PIN=Data; //xData=Data;
IO1CLR=OLED_RD; //E=0;
IO3SET=OLED_WR; //RW=1;
IO3SET=OLED_CS; //CS=1;
IO3SET=OLED_DC; //DC=1;
}
void Write_Data(unsigned short Data)
{ IO3SET=OLED_DC;//DC=1; A0
IO3CLR=OLED_CS;//CS=0;
IO3CLR=OLED_WR;//RW=0;
IO1SET=OLED_RD;//E=1;
IO2PIN=Data; //xData=Data;
IO1CLR=OLED_RD;//E=0;
IO3SET=OLED_WR;//RW=1;
IO3SET=OLED_CS;//CS=1;
IO3CLR=OLED_DC;//DC=1; A0
}
#endif
#ifdef I80 // 8-bit 80XX Parallel
void Write_Command(unsigned short Data)
{
//IO1SET=OLED_RD;//E=1; //???±
IO3CLR=OLED_DC;//DC=0; A0
IO3CLR=OLED_CS;//CS=0;
IO3CLR=OLED_WR;//WR=0;
IO2PIN=Data; //xData=Data;
IO3SET=OLED_WR;//WR=1;
IO3SET=OLED_CS;//CS=1;
IO3SET=OLED_DC;//DC=1; A0
}
void Write_Data(unsigned short Data)
{
//IO1SET=OLED_RD;//E=1; //???±
IO3SET=OLED_DC;//DC=1; A0
IO3CLR=OLED_CS;//CS=0;
IO3CLR=OLED_WR;//WR=0;
IO2PIN=Data; //xData=Data;
IO3SET=OLED_WR;//WR=1;
IO3SET=OLED_CS;//CS=1;
IO3CLR=OLED_DC;//DC=0; A0
}
#endif
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Show Regular Pattern (Full Screen)
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Fill_RAM(unsigned short a)
{
unsigned char i,j;
Write_Command(0x35); // Vertical RAM Address
Write_Data(0x000F);
Write_Command(0x38); // Horizontal RAM Address
Write_Data(0x000F);
Write_Command(0x22); // Enable MCU to Write into RAM
for(i=0;i<128;i++)
{
for(j=0;j<128;j++)
Write_Data(a);
}
}
//*********************************************
void OLED_Init(void)
{
Write_Command(0x0003);
Write_Data(0x0030); // 16bit mode
Write_Command(0x0001);
Write_Data(0x881C); // Set scan line
Write_Command(0x0002);
Write_Data(0x0000); //
//Write_Command(0x0003);
//Write_Data(0x0030); // 16bit mode
Write_Command(0x0010);
Write_Data(0x0000); // IC stand by off
Write_Command(0x0018);
Write_Data(0x0028); // Frame Rate=80Hz
Write_Command(0x00f8);
Write_Data(0x000F); // VGH=+5V
Write_Command(0x000f9);
Write_Data(0x0019); // VGL=-7V
Write_Command(0x0005);
Write_Data(0x0001); // Display On
Write_Command(0x0035);
Write_Data(0x0000); // window display
Write_Command(0x0036);
Write_Data(0x00DB); //
Write_Command(0x0037);
Write_Data(0x20CF); //
Write_Command(0x0020);
Write_Data(0x0020); //
Write_Command(0x0021);
Write_Data(0x0000); //
Write_Command(0x0070);
Write_Data(0x3300); //
Write_Command(0x0071);
Write_Data(0x3900); //
Write_Command(0x0072);
Write_Data(0x3800); //
Write_Command(0x0073);
Write_Data(0x2924); //
Write_Command(0x0074);
Write_Data(0x261C); //
Write_Command(0x0075);
Write_Data(0x3125); //
Write_Command(0x0076);
Write_Data(0x271C); //
Write_Command(0x0077);
Write_Data(0x352A); //
Write_Command(0x0078);
Write_Data(0x2A1E); //
Fill_RAM(0x0000); // Clear Screen
}
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Main Program
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
int main()
{
PINSEL0=0x00000005;
PINSEL1=0x00000000;
PINSEL2=0x00000030;
IO0DIR =0xffffffff;
IO1DIR =0xffffffff;
IO2DIR =0xffffffff;
IO3DIR =0xffffffff;
IO0SET =LED;
IO0SET =OLED_HVEN;
IO1SET =Flash_CS;
IO3SET =SRAM_CS;
OLED_Init();
while(1)
{
Fill_RAM(0x55FF);
Delay(50);
}
}