sed1335 c程序-源代码

IC应用电路图

467人已加入

描述

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

sed1335 c程序-源代码

#define ioLcdState XBYTE[0x4000]
#define ioLcdCommand XBYTE[0x4001]
#define ioLcdDataWrite XBYTE[0x4000]
#define ioLcdDataRead XBYTE[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;
uInt xhVideoAddress;
cChar *pccbhAsciiFont;

if(ihLine>14) ihLine=0;
if(ihErect>39) 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)(xhVideoAddress>>8);
ioLcdCommand=0x42;
if(fNormal==1) ioLcdDataWrite = *pccbhAsciiFont++;
else ioLcdDataWrite =~(*pccbhAsciiFont++);
xhVideoAddress+=40;
}
}

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

if(ihLine>14) ihLine=0;
if(ihErect>39) 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=xhVideoAddress>>8;
ioLcdCommand=0x42;
if(fNormal==1)
{
ioLcdDataWrite=*pccbhChineseFont++;
ioLcdDataWrite=*pccbhChineseFont++;
}
else
{
ioLcdDataWrite=~(*pccbhChineseFont++);
ioLcdDataWrite=~(*pccbhChineseFont++);
}
xhVideoAddress+=40;
}
}

打开APP阅读更多精彩内容
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
  • 相关推荐
  • SED

全部0条评论

快来发表一下你的评论吧 !

×
20
完善资料,
赚取积分