/**
---------------------------------------------------------------------
**
** This device driver was created by
** 8-Bit Single-Chip Microcontrollers
**
** Copyright(C) visionox display Corporation 2002 - 2009
** All rights rerved by Kunshan visionox display Corporation.
**
** This program should be ud 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 Offt
//
******************************************************/
//
//
void Display_Offt(uchar offt)
{
uchar value;
value = offt;
Write_Command(0xA2);
Write_Data(value);
}
//
//
/******************************************************
//
//Function Selection
//
******************************************************/
//
//
void Fun_Selection(uchar lection)
{
uchar value;
value = lection;
Write_Command(0xAB);
Write_Data(value);
}
//
//
/******************************************************
//
//Set Pha Length
/
/
******************************************************/
//
//
void Pha_Length(uchar length)
{
uchar value;
value = length;
Write_Command(0xB1);
Write_Data(value);
}
/
/adverti
//
/******************************************************
//
//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);
}
wild china/
/
//
/******************************************************
//
//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)
{
underestimate
uchar value;
value = contrast;
Write_Command(0xC1);
Write_Data(value);
}
//
//
/
******************************************************
//
jason collins//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 Ret_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_Offt(0x00);
/
/Set Display Offt
Fun_Selection(0X00); //Function Selection
Pha_Length(0xE2); //Set Pha 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
yin daoPre_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
}