/************************************************************************************
****版权所有:
****项目名称:12864液晶显示驱动文件
****版 本:V1.0
****作 者:TianLi.Pan
****QQ联系方式:651063775
****创建日期:2014-2-12
****修改日期:2014-2-12
*************************************************************************************/
#include "LCD12864.h"
/*************************************************************************************
****使用说明:
****第一步:调用LcdInit()初始化
****第二部:调用LcdDiplay(unsigned char posi_y,unsigned char posi_x,unsigned char *str)
**** 显示字符串,posi_y为显示的行数.posi_x为显示的x坐标的位置.str为要发送的
**** 字符串
****备 注:务必要将LCD12864头文件包含进去
*************************************************************************************/
/*************************************************************************************
****函数名称:LcdInit
****函数形参:无
****返 回 值:无
****函数功能:12864初始化函数
*************************************************************************************/
void LcdInit(void)
{
DDRD|=(1<<4)|(1<<5)|(1<<6);
SID_L;
CLK_L;
CS_L;
LcdWirteCmd(0x30);//功能设定为基本指令集动作
LcdDelay(1);
LcdWirteCmd(0x0c);//显示状态打开
LcdDelay(1);
LcdWirteCmd(0x01);//清除显示
LcdDelay(100);
LcdDiplay(1,0,"ATE 自动测试平台$");
LcdDiplay(2,0,"机型:185252$");
}
/*************************************************************************************
****函数名称:LcdDelay
****函数形参:unsigned int x
****返 回 值:无
****函数功能:12864延时函数
*************************************************************************************/
void LcdDelay(unsigned int x)
{
unsigned int y;
for(;x>0;x--)
for(y=110;y>0;y--);
}
/*************************************************************************************
****函数名称:Writebyte
****函数形参:unsigned char bytedata
****返 回 值:无
****函数功能:12864单字节写入函数
*************************************************************************************/
void Writebyte(unsigned char bytedata)
{
int y;
CS_H;//将液晶使能
for(y=0;y<8;y++)
{
if((bytedata<<y)&0x80)
SID_H;
else
SID_L;
CLK_L;
CLK_H;
}
CS_L;//关闭使能
}
/*************************************************************************************
****函数名称:LcdWirteData
****函数形参:unsigned char byte
****返 回 值:无
****函数功能:12864显示数据写入函数
*************************************************************************************/
void LcdWirteData(unsigned char byte)
{
Writebyte(DATA);
Writebyte(byte&0xf0);
Writebyte((byte<<4)&0xf0);
}
/*************************************************************************************
****函数名称:LcdWirteCmd
****函数形参:unsigned char byte
****返 回 值:无
****函数功能:12864控制指令写入函数
*************************************************************************************/
void LcdWirteCmd(unsigned char byte)
{
Writebyte(CMD);
Writebyte(byte&0xf0);
Writebyte((byte<<4)&0xf0);
}
/*************************************************************************************
****函数名称:LcdPosi
****函数形参:unsigned char posi_y,unsigned char posi_x
****返 回 值:无
****函数功能:12864显示位置控制
*************************************************************************************/
void LcdPosi(unsigned char posi_y,unsigned char posi_x)
{
unsigned char posi;
switch(posi_y)
{
case 1:
posi=0x80+posi_x;
break;
case 2:
posi=0x90+posi_x;
break;
case 3:
posi=0x88+posi_x;
break;
case 4:
posi=0x98+posi_x;
break;
default :
posi=0x80;
break;
}
LcdWirteCmd(posi);
}
/*************************************************************************************
****函数名称:LcdDiplay
****函数形参:unsigned char posi_y,unsigned char posi_x,unsigned char *str
****返 回 值:无
****函数功能:12864显示驱动函数
*************************************************************************************/
void LcdDiplay(unsigned char posi_y,unsigned char posi_x,unsigned char *str)
{
LcdPosi(posi_y,posi_x);
LcdWirtestr(str);
}
/*************************************************************************************
****函数名称:LcdWirtestr
****函数形参:unsigned char *str
****返 回 值:无
****函数功能:12864字符串写入函数
*************************************************************************************/
void LcdWirtestr(unsigned char *str)
{
while(*str!='$')
{
LcdWirteData(*str);
LcdDelay(1);
str++;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
12864驱动函数(串行模式)
共19个文件
o:2个
lis:2个
c:2个
4星 · 超过85%的资源 需积分: 9 9 下载量 103 浏览量
2014-02-14
08:33:03
上传
评论
收藏 18KB RAR 举报
温馨提示
12864显示函数,给予初学者应该有比较大的帮助吧!本实例使用串行模式。编译平台ICC 8.0,当然,你可以直接调用.c.H文件调用即可。
资源推荐
资源详情
资源评论
收起资源包目录
ym12864.rar (19个子文件)
ym12864
ym12864.depend 377B
ym12864.default 66B
ym12864.mp 2KB
main.c 129B
ym12864.cof 19KB
ym12864.cbp 1KB
ym12864.lk 9B
ym12864.hex 1KB
ym12864.lst 14KB
LCD12864.c 5KB
.objs
LCD12864.lis 21KB
LCD12864.o 4KB
main.lis 1KB
main.o 383B
ym12864.mak 399B
ym12864.dbg 2KB
ym12864.prj 1KB
LCD12864.h 785B
ym12864.layout 616B
共 19 条
- 1
资源评论
- Garfree1002016-07-01串行模式,小屏LCD显示,小屏显示效果比较差
rygzptl
- 粉丝: 2
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功