工业控制 | 能源技术 | 汽车电子 | 通信网络 | 安防监控 | 智能电网 | 移动手持 | 无线技术 | 家用电器 | 数字广播 | 消费电子 | 应用软件 | 其他方案

sed1335c程序-源代码

作者:dolphin时间:2012-11-08

SED1335 是日本SEIKO EPSON 公司出品的液晶显示控制器,它在同类产品中是功能最强的,其特点:
1、较强功能的I/O 缓冲器;
2、指令功能丰富;
3、四位数据并行发送,最大驱动能力为640 256

sed1335 c程序-源代码

#define ioLcdStateXBYTE[0x4000]
#define ioLcdCommandXBYTE[0x4001]
#define ioLcdDataWriteXBYTE[0x4000]
#define ioLcdDataReadXBYTE[0x4001]


/*** 1335初始化 ***/
void Org1335(void)
{
ioLcdCommand=0x40;// 系统设置指令,8个参数
ioLcdDataWrite=0x30;
ioLcdDataWrite=0x87;
ioLcdDataWrite=0x07;
ioLcdDataWrite=40;// 显示域长度为320dot
ioLcdDataWrite=50;// 确定液晶工作频率
ioLcdDataWrite=240;// 显示屏高度为240dot
ioLcdDataWrite=40;// 显示屏一行所占显示缓冲区字节数(L)
ioLcdDataWrite=0;// 显示屏一行所占显示缓冲区字节数(H)

ioLcdCommand=0x44;// 显示区设置,最多10个参数
ioLcdDataWrite=0x00;// 显示1区对应的显示RAM起始地址(L)
ioLcdDataWrite=0x00;// 显示1区对应的显示RAM起始地址(H)
ioLcdDataWrite=240;// 显示1区占用240个dot行

ioLcdCommand=0x5a;// 水平卷动,初始化时必须清零
ioLcdDataWrite=0x00;

ioLcdCommand=0x5b;// 各个显示区的合成方式,1个参数
ioLcdDataWrite=0x0c;// 简单叠加

ioLcdCommand=0x59;// 打开显示,1个参数
ioLcdDataWrite=0x04;// 只保留第一个显示区

ioLcdCommand=0x4c;// 光标向后移动
}

/*** 在液晶屏指定位置显示一个ASCII字符 ***/
void DisplayOneAscii(bit fNormal,uChar ihLine,uChar ihErect,uChar ihAscii)

uChar ihDataSend;
uIntxhVideoAddress;
cChar *pccbhAsciiFont;

if(ihLine14)ihLine=0;
if(ihErect39) ihErect=0;
pccbhAsciiFont=cxhAsciiFontOrg;
pccbhAsciiFont=pccbhAsciiFont+(((uInt)ihAscii)<4);
xhVideoAddress=(((uInt)ihLine) * 640) + ihErect;
for(ihDataSend=0;ihDataSend=15;ihDataSend++)

ioLcdCommand=0x46;
ioLcdDataWrite=(uChar)xhVideoAddress;
ioLcdDataWrite=(uChar)(xhVideoAddress8);
ioLcdCommand=0x42;
if(fNormal==1) ioLcdDataWrite =*pccbhAsciiFont++;
elseioLcdDataWrite =~(*pccbhAsciiFont++);
xhVideoAddress+=40;

/*** 根据汉字机内码查找该汉字点阵的存储位置
*
* 1.小型应用中,只提取了专用字库,按照机内码排序索引
* 2.cbhChineseNumber为最多汉字数
* 3.cxhChineseIndexFont 为索引表开始的位置
* 4.cxhChineseFontOrg为汉字库开始的位置
*/
cChar *PSeekChineseFont(uInt xhChineseMa)

uIntxhLowSeek,xhHighSeek,xhMiddleSeek;
cChar *pccbhChineseFont;
cInt*pccxhChineseMa;

xhLowSeek =0x00;
xhHighSeek=cbhChineseNumber;
pccbhChineseFont=cxhChineseFontOrg;
for(;xhLowSeek=xhHighSeek;)

xhMiddleSeek=(xhLowSeek + xhHighSeek)/2;
pccxhChineseMa=cxhChineseIndexOrg;
pccxhChineseMa+=xhMiddleSeek;
if(*pccxhChineseMa==xhChineseMa)

return(pccbhChineseFont+(xhMiddleSeek*32));

if(*pccxhChineseMa xhChineseMa)

xhHighSeek=xhMiddleSeek-0x01;

else

xhLowSeek=xhMiddleSeek+0x01;


return(pccbhChineseFont);

/*** 在液晶屏指定位置显示一个汉字 ***/
void DisplayOneHz(bit fNormal,uChar ihLine,uChar ihErect,uChar bhMachineMaHigh,uChar bhMachineMaLow)

uChar ihDataSend;
uIntxhChineseMa,xhVideoAddress;
cChar *pccbhChineseFont;

if(ihLine14)ihLine=0;
if(ihErect39) ihErect=0;
if(bhMachineMaLow=0xa0) return;
xhChineseMa=(bhMachineMaHigh*256)+bhMachineMaLow;
pccbhChineseFont=PSeekChineseFont(xhChineseMa);
xhVideoAddress=(((uInt)ihLine) * 640) + ihErect;
for(ihDataSend=0;ihDataSend=31;ihDataSend+=2)

ioLcdCommand=0x46;
ioLcdDataWrite=(uChar)xhVideoAddress;
ioLcdDataWrite=xhVideoAddress8;
ioLcdCommand=0x42;
if(fNormal==1)

ioLcdDataWrite=*pccbhChineseFont++;
ioLcdDataWrite=*pccbhChineseFont++;

else

ioLcdDataWrite=~(*pccbhChineseFont++);
ioLcdDataWrite=~(*pccbhChineseFont++);

xhVideoAddress+=40;



评论

技术专区