您的位置: proteus仿真社区 >> 论坛 >> 单片机仿真 >> 查看帖子
字体: 小 中 大 | 打印 发表于: 2008-7-26 18:57 作者: sinkle 来源: proteus仿真社区
字符手册.rar(2008-07-27 10:13:27, Size: 649 KB, Downloads: 0)
1602.rar(2008-07-27 10:13:27, Size: 1.07 MB, Downloads: 1)
最新回复
yubo2007 (2008-7-26 21:06:13)
http://bbs.cepark.com/search.php?searchid=13&orderby=lastpost&ascdesc=desc&searchsubmit=yes
应该会有你想要的资料!!!
[ 本帖最后由 yubo2007 于 2008-7-26 21:08 编辑 ]
bluechy (2008-7-27 10:13:27)
不知能否用得上!
(2008-07-27 10:13:27, Size: 649 KB, Downloads: 0)
(2008-07-27 10:13:27, Size: 1.07 MB, Downloads: 1)
yongxiang6091 (2008-7-27 13:06:34)
2008_05_27编写LCD程序,实验LCD显示
ok
*********************************************/
#include"reg51.h"
#include"intrins.h"
typedef unsigned char uchar;
typedef unsigned int uint;
sfr AUXR=0x8e; //AUXR_RAM
/**********************************************
定义LCD接线
**********************************************/
#define LCD_DB P0
sbit LCD_RS=P2^7;
sbit LCD_RW=P2^6;
sbit LCD_E=P2^5;
sbit LCDBusy=LCD_DB^7;
/********************************************
定义显示的内容
********************************************/
struct LCD_DispBuf
{ uchar name[16];
uchar day[16];
}Buf={"abcdefgh","20080528"};
/******************************************
延时程序
delay(10)=1ms 244Hz
_nop_() 4.34us
*******************************************/
void delay(uchar i)
{ uchar p=100;
for(;i>0;i--)
for(;p>0;p--)
{;}
}
/******************************************
检查LCD忙状态
返回值:bit busy
busy:busy=1
free:busy=0
******************************************/
void LCD_Busy(void)
{ LCD_DB=0xff;
_nop_();_nop_();_nop_();
LCD_RS=0;
LCD_RW=1;
LCD_E=1;
_nop_();_nop_();_nop_();
while(LCDBusy);
_nop_();_nop_();
LCD_E=0;
}
/*****************************************
写指令到指令寄存器
*****************************************/
void LCD_WriteCMD(uchar command)
{ LCD_Busy();
LCD_DB=command;
_nop_();_nop_();_nop_();
LCD_RS=0;
LCD_RW=0;
LCD_E=1;
_nop_();_nop_();_nop_();
LCD_E=0;
}
/*****************************************
向LCD写入数据
*****************************************/
void LCD_WriteData(uchar dat)
{ LCD_Busy();
LCD_DB=dat;
_nop_();_nop_();_nop_();
LCD_RS=1;
LCD_RW=0;
LCD_E=1;
_nop_();_nop_();_nop_();
LCD_E=0;
}
/*****************************************
初始化LCD
*****************************************/
void LCD_Ini(void)
{ LCD_WriteCMD(0x38);
LCD_WriteCMD(0x0c);
LCD_WriteCMD(0x06);
LCD_WriteCMD(0x01);
LCD_WriteCMD(0x02);
}
/******************************************
向LCD送显示数据
第一行:80H
第二行:90H
******************************************/
void LCDDisp(uchar add,uchar *str)
{ LCD_WriteCMD(add);
while(*str!='\0')
{ LCD_WriteData(*str++);
}
*str=0;
}
void main()
{
AUXR=0x02; //禁止访问内部扩展的AUX_RAM
LCD_Ini();
LCDDisp(0x82,Buf.name);
LCDDisp(0xc3,Buf.day);
delay(1);
}
ff_5wq (2008-7-27 14:07:15)
tourlost (2008-7-28 09:31:50)