⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sed1335.c

📁 sed1335或者ra8835的源代码
💻 C
字号:
//=======================================Copyright (c)==================================================
//                                ANDORIN OptoElec Tech INC.
//                             HomePage http://www.andorin.com
//                             BBS  http://www.lcd-module.com.cn
//======================================================================================================
//Software:		sed1335.c
//Description:	lcd controller
//Device:		
//======================================================================================================
// Created By: 		ARIN
// Created date:   	2006-12-1
// Version: 1.0
//======================================================================================================
// Modified by:
// Modified date:
// Version:
//======================================================================================================
#include "sed1335.h"

char const SystemSetCode[]={IV|WS|M2|M1|M0,
                                     WF|FX,
                                     FY,
                                     CR,
                                     TCR,
                                     LF,
                                     APL,APH};
char const ScrollCode[]={SAD1L,SAD1H,SL1,
                                  SAD2L,SAD2H,SL2,
                                  SAD3L,SAD3H,
                                  SAD4L,SAD4H};
char const CursorFormCode[]={CRX,CM|CRY};
char const HDotScrollCode[]={HDOT};
char const OverLayerCode[]={OV2LAYER|GRAPHICMODE};//|MIXXOR};
char const DispOnCode[]={SCREEN1};//|CURSOR|SCREEN2|SCREEN3};
char const DispOffCode[]={SCREEN1};//|CURSOR|SCREEN2|SCREEN3};
char const CursorAdd1[]={SAD1L,SAD1H};
char const CursorAdd2[]={SAD2L,SAD2H};
char const CursorAdd3[]={SAD3L,SAD3H};
char const CursorAdd4[]={SAD4L,SAD4H};


void Sed1335_SetLcdReg(char cdata,char const *pdata,char n)
{
char i;
	
	RstIo0(CS);
	SetIo0(A0);
	WriteBus(cdata);
	RstIo0(A0);
	for(i=0;i<n;++i)
	{
	    WriteBus(*pdata);
		Delay(200);
		++pdata;
	}
	SetIo0(CS);
}

void Sed1335_WriteLcdData(char *pdata,int n)
{
char i;

	RstIo0(CS);
	SetIo0(A0);
	WriteBus(MemWrite);
	RstIo0(A0);

	for(i=0;i<n;++i)
	{
		WriteBus(*pdata);
		Delay(200);
		++pdata;
	}
	SetIo0(CS);
}

void Sed1335_SetCursorAdd(char cursoraddl,char cursoraddh)
{
	RstIo0(CS);
	SetIo0(A0);
	WriteBus(CursorWrite);
	RstIo0(A0);
    WriteBus(cursoraddl);
    WriteBus(cursoraddh);
	SetIo0(CS);
}

void Sed1335Init()
{
	RstIo0(RST);
	OSTimeDly(OS_TICKS_PER_SEC/10);
	SetIo0(RST);
	OSTimeDly(OS_TICKS_PER_SEC/10);

//	RstIo0(RST);
//	OSTimeDly(OS_TICKS_PER_SEC/10);
//	SetIo0(RST);
//	OSTimeDly(OS_TICKS_PER_SEC/10);

	Sed1335_SetLcdReg(DispOff,DispOffCode,1);
//	Sed1335_SetLcdReg(SystemSet,SystemSetCode,8);
//	OSTimeDly(OS_TICKS_PER_SEC/20);
	
	Sed1335_SetLcdReg(SystemSet,SystemSetCode,8);
	Sed1335_SetLcdReg(Scroll,ScrollCode,10);
	Sed1335_SetLcdReg(CursorForm,CursorFormCode,2);
	Sed1335_SetLcdReg(HDotScroll,HDotScrollCode,1);
	Sed1335_SetLcdReg(OverLayer,OverLayerCode,1);
	Sed1335_SetLcdReg(CursorRight,NULL,1);
	Sed1335_SetLcdReg(CursorWrite,CursorAdd1,2);
	Sed1335_SetLcdReg(DispOn,DispOnCode,1);
}


void Sed1335Update()
{
char csradd[2];
int add,i,j;
char line[40];

	add=0;
	
	for(i=0;i<LCDY+1;++i)
	{
		csradd[0]=add&0xff;
		csradd[1]=add>>8;
		Sed1335_SetCursorAdd(csradd[0],csradd[1]);
		for(j=0;j<LCDX/8;++j)
			line[j]=vram[i][j];
		Sed1335_WriteLcdData(line,LCDX/8+1);
		add += (LCDX/8);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -