ssd1322用于维信诺25664单色屏的初始化代码
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
/**
---------------------------------------------------------------------
**
** This device driver was created by
** 8-Bit Single-Chip Microcontrollers
**
** Copyright(C) visionox display Corporation 2002 - 2009
** All rights reserved by Kunshan visionox display Corporation.
**
** This program should be used on your own responsibility.
**
** Filename : IC_Init.c
** Abstract : This file implements device driver for Initial SSD1322 function.
**
** Device : STC89LE516RD
**
** Compiler : KEIL uVision2
**
** Module: M00160
**
** Dot Matrix: 256*64
**
** Display Color: Blue
**
** Driver IC: SSD1322
**
** IREF : 680KΩ
**
** Edit : CaoChaoGan
**
** Creation date: 2009-10-30
---------------------------------------------------------------------
**/
//
//
/****************************包含头文件***************************/
#include "reg52.h"
#include "intrins.h"
#include "IC.h"
#include "Delay.h"
//
//
/******************************************************
//
//写命令函数
//
******************************************************/
//
//
void Write_Command(uchar command)
{
CS=low;
DC=low;
WR=low;
_nop_();_nop_();
P0=command;
WR=high;
_nop_();_nop_();
CS=high;
}
//
//
//
/******************************************************
//
//写数据函数
//
******************************************************/
//
//
void Write_Data(uchar date)
{
CS=low;
DC=high;
WR=low;
_nop_();_nop_();
P0=date;
WR=high;
_nop_();_nop_();
CS=high;
}
//
//
/******************************************************
//
//Set Command Lock
//
******************************************************/
//
//
void Command_Lock(uchar lock)
{
uchar value;
value = lock;
Write_Command(0xfd);
Write_Data(value);
}
//
//
/******************************************************
//
//Set Sleep mode ON/OFF
//
******************************************************/
//
//
void Sleep_Mode(uchar mode)
{
uchar value;
value = mode;
Write_Command(value);
}
//
//
/******************************************************
//
//Set Column Address
//
******************************************************/
//
//
void Column_Address(uchar start , uchar end)
{
uchar value_1,value_2;
value_1 = start ;
value_2 = end ;
Write_Command(0x15);
Write_Data(value_1);
Write_Data(value_2);
}
//
//
/******************************************************
//
//Set Row Address
//
******************************************************/
//
//
void Row_Address(uchar start , uchar end)
{
uchar value_1,value_2;
value_1 = start ;
value_2 = end ;
Write_Command(0x75);
Write_Data(value_1);
Write_Data(value_2);
}
//
//
/******************************************************
//
//Set Re-map and Dual COM Line mode
//
******
************************************************/
//
//
void Dual_COM_Line(uchar mode_1, uchar mode_2)
{
uchar value_1,value_2;
value_1 = mode_1;
value_2 = mode_2;
Write_Command(0xA0);
Write_Data(mode_1);
Write_Data(mode_2);
}
//
//
/******************************************************
//
//Set Display Start Line
//
******************************************************/
//
//
void Display_Start_Line(uchar line)
{
uchar value;
value = line;
Write_Command(0xA1);
Write_Data(value);
}
//
//
/******************************************************
//
//Set Display Offset
//
******************************************************/
//
//
void Display_Offset(uchar offset)
{
uchar value;
value = offset;
Write_Command(0xA2);
Write_Data(value);
}
//
//
/******************************************************
//
//Function Selection
//
******************************************************/
//
//
void Fun_Selection(uchar selection)
{
uchar value;
value = selection;
Write_Command(0xAB);
Write_Data(value);
}
//
//
/******************************************************
//
//Set Phase Length
//
******************************************************/
//
//
void Phase_Length(uchar length)
{
uchar value;
value = length;
Write_Command(0xB1);
Write_Data(value);
}
//
//
/******************************************************
//
//Set Front Clock Divider / Oscillator
//
******************************************************/
//
//
void Clock_Divider(uchar divider)
{
uchar value;
value = divider;
Write_Command(0xB3);
Write_Data(value);
}
//
//
/******************************************************
//
//Display Enhancement A
//
******************************************************/
//
//
void Display_En_A(uchar enhance_1, uchar enhance_2)
{
uchar value_1,value_2;
value_1 = enhance_1;
value_2 = enhance_2;
Write_Command(0xB4);
Write_Data(enhance_1);
Write_Data(enhance_2);
}
//
//
/******************************************************
//
//Set GPIO
//
******************************************************/
//
//
void Set_GPIO(uchar gpio)
{
uchar value;
value = gpio;
Write_Command(0xB5);
Write_Data(value);
}
//
//
/******************************************************
//
//Set Second Precharge Period
//
******************************************************/
//
//
void Sec_Pre_Period(uchar period)
{
uchar value;
value = period;
Write_Command(0xB6);
Write_Data(value);
}
//
//
/******************************************************
//
//Select Default Linear Gray Scale table
//
******************************************************/
//
//
void Default_Gray(uchar gray)
{
uchar value;
value = gray;
Write_Command(value
);
}
//
//
/******************************************************
//
//Set Pre-charge voltage
//
******************************************************/
//
//
void Pre_Voltage(uchar voltage)
{
uchar value;
value = voltage;
Write_Command(0xBB);
Write_Data(value);
}
//
//
/******************************************************
//
//Set VCOMH
//
******************************************************/
//
//
void Set_Vcomh(uchar vcomh)
{
uchar value;
value = vcomh;
Write_Command(0xBE);
Write_Data(value);
}
//
//
/******************************************************
//
//Set Contrast
//
******************************************************/
//
//
void Set_Contrast(uchar contrast)
{
uchar value;
value = contrast;
Write_Command(0xC1);
Write_Data(value);
}
//
//
/******************************************************
//
//Master Contrast Current Control
//
******************************************************/
//
//
void Master_Contrast(uchar current)
{
uchar value;
value = current;
Write_Command(0xC7);
Write_Data(value);
}
//
//
/******************************************************
//
//Set MUX Ratio
//
******************************************************/
//
//
void MUX_Ratio(uchar ratio)
{
uchar value;
value = ratio;
Write_Command(0xCA);
Write_Data(value);
}
//
//
/******************************************************
//
//Display Enhancement B
//
******************************************************/
//
//
void Display_En_B(uchar enhance_1, uchar enhance_2)
{
uchar value_1,value_2;
value_1 = enhance_1;
value_2 = enhance_2;
Write_Command(0xD1);
Write_Data(enhance_1);
Write_Data(enhance_2);
}
//
//
/******************************************************
//
//Set Display Mode
//
******************************************************/
//
//
void Display_Mode(uchar mode)
{
uchar value;
value = mode;
Write_Command(value);
}
//
//
/******************************************************
//
//复位1322
//
******************************************************/
//
//
void Reset_IC()
{
Delay_Ms(10);
LED_Work=0;
RES=0;
Delay_Ms(1);
RES=1;
VCC_Change=1;
}
//
//
/******************************************************
//
//初始化SSD1322
//
******************************************************/
//
//
void Init_IC()
{
Command_Lock(0x12); //Set Command Lock
Sleep_Mode(0xAE); //Set Sleep mode OFF
Column_Address(0x1C,0x5B); //Set Column Address
Row_Address(0x00,0x3F); //Set Row Address
Dual_COM_Line(0x14,0x11); //Set Re-map and Dual COM Line mode
Display_Start_Line(0x00); //Set Display Start Line
Display_Offset(0x00);
//Set Display Offset
Fun_Selection(0X00); //Function Selection
Phase_Length(0xE2); //Set Phase Length
Clock_Divider(0x91); //Set Front Clock Divider / Oscillator
Display_En_A(0xA0,0xFD); //Display Enhancement A
Set_GPIO(0x00); //Set GPIO
Sec_Pre_Period(0x08); //Set Second Precharge Period
Default_Gray(0xB9); //Select Default Linear Gray Scale table
Pre_Voltage(0x1F); //Set Pre-charge voltage 0x1F
Set_Vcomh(0x07); //Set VCOMH
Set_Contrast(0x9F); //Set Contrast
Master_Contrast(0x0F); //Master Contrast Current Control
MUX_Ratio(0X3F); //Set MUX Ratio
Display_En_B(0x82,0x20); //Display Enhancement B
Display_Mode(0xA6); //Set Display normal Mode
Sleep_Mode(0xAF); //Set Sleep mode ON
}