微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > SSD1963示例程序

SSD1963示例程序

时间:11-11 来源:互联网 点击:

data=sdata<8;

sdata|=DataPortL;

SetSSD1963RD();

SetSSD1963CS();

SFRPAGE = CONFIG_PAGE;

P1MDOUT=0xff;//设置为 上拉 输出 。

P2MDOUT=0xff;

SFRPAGE = SFRPAGE_save; // Restore the SFRPAGE

return sdata;

}

uint GetPixel(uint Col,uint Page)

{

uint temp;

uint color;

SSD1963Command_8(0x2a); //设置行开始和结束的位置

SSD1963Data_8(Col/256);

SSD1963Data_8(Col%256);

temp=Col;

SSD1963Data_8(temp/256);

SSD1963Data_8(temp%256);

SSD1963Command_8(0x2b);

SSD1963Data_8(Page/256);

SSD1963Data_8(Page%256);

temp=Page;

SSD1963Data_8(temp/256);

SSD1963Data_8(temp%256);

SSD1963Command_8(0x2E);

color=GetSSD1963Data_16();

return color;

}

void SetPixel(uint Col,uint Page,uint color)

{

uint temp;

SSD1963Command_8(0x2a); //设置行开始和结束的位置

temp=Col;

SSD1963Data_8(temp/256);

SSD1963Data_8(temp%256);

temp=Col;

SSD1963Data_8(temp/256);

SSD1963Data_8(temp%256);

SSD1963Command_8(0x2b);

temp=Page;

SSD1963Data_8(temp/256);

SSD1963Data_8(temp%256);

temp=Page;

SSD1963Data_8(temp/256);

SSD1963Data_8(temp%256);

SSD1963Command_8(0x2c);

// for(i=0;i<9;i++)

// {

SSD1963Data1_16(color);

// }

}

//初始化程序

void SSD1963Init()

{

//software reset

SSD1963Command_8(0x01);

Delay_Ms(400);

SSD1963Command_8(0x01);

Delay_Ms(400);

//enable pll

SSD1963Command_8(0xe0);

Delay_Ms(400);

SSD1963Data_8(0x01);

Delay_Ms(400);

SSD1963Command_8(0xe0);

Delay_Ms(400);

SSD1963Data_8(0x03);

Delay_Ms(400);

//pll: n= 34 m= 3

SSD1963Command_8(0xe2);

SSD1963Data_8(0x14);

SSD1963Data_8(0x03);

SSD1963Data_8(0x54);

//dotclk setting

SSD1963Command_8(0xe6);

SSD1963Data_8(0x03);

SSD1963Data_8(0xa0);

SSD1963Data_8(0x00);

//panel setting

SSD1963Command_8(0xb0);

Delay_Us(100);

SSD1963Data_8(0x38);

SSD1963Data_8(0x20);

SSD1963Data_8(0x01);

SSD1963Data_8(0xdf);

SSD1963Data_8(0x01);

SSD1963Data_8(0x0f);

SSD1963Data_8(0x00);

//pixel format

SSD1963Command_8(0x3a);

SSD1963Data_8(0x50);

//hsync setting

SSD1963Command_8(0xb4);

SSD1963Data_8(0x02);

SSD1963Data_8(0x0D);

SSD1963Data_8(0x00);

SSD1963Data_8(0x25);

SSD1963Data_8(0x02);

SSD1963Data_8(0x00);

SSD1963Data_8(0x00);

SSD1963Data_8(0x00);

//vsync setting

SSD1963Command_8(0xb6);

SSD1963Data_8(0x01);

SSD1963Data_8(0x1E);

SSD1963Data_8(0x00);

SSD1963Data_8(0x08);

SSD1963Data_8(0x01);

SSD1963Data_8(0x00);

SSD1963Data_8(0x00);

//col start_end

SSD1963Command_8(0x2a);

SSD1963Data_8(0x00);

SSD1963Data_8(0x00);

SSD1963Data_8(0x01);

SSD1963Data_8(0xdf);//480

//row start_end

SSD1963Command_8(0x2b);

SSD1963Data_8(0x00);

SSD1963Data_8(0x00);

SSD1963Data_8(0x01);

SSD1963Data_8(0x0f);//272

SSD1963Command_8(0x36);

SSD1963Data_8(0x00);

//MCU IF setting

//SSD1963Command_8(13);

SSD1963Command_8(0xf0);

SSD1963Data_8(0x03); //02

//SSD1963Command_8(0x35);

//display on

SSD1963Command_8(0x29);

SSD1963Command_8(0xbe);//设置PWM

SSD1963Data_8(0X0E);

SSD1963Data_8(0XFF);

SSD1963Data_8(0X09);

SSD1963Data_8(0XFF);

SSD1963Data_8(0X00);

SSD1963Data_8(0X00);

SSD1963Command_8(0xD4);//(Define the threshold value)

SSD1963Data_8(0X00);

SSD1963Data_8(0X09);

SSD1963Data_8(0X90);

SSD1963Data_8(0X00);

SSD1963Data_8(0X17);

SSD1963Data_8(0XE8);

SSD1963Data_8(0X00);

SSD1963Data_8(0X39);

SSD1963Data_8(0X60);

SSD1963Command_8(0xd0);

SSD1963Data_8(0x0d);

// ReadSSD1963Set();

}

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top