C51 PG12864f proteus仿真



《C51 PG12864f proteus仿真》由会员分享,可在线阅读,更多相关《C51 PG12864f proteus仿真(7页珍藏版)》请在装配图网上搜索。
1、真诚为您提供优质参考资料,若有不当之处,请指正。
这个别人是用AVR单片机仿的,我只会C51就把它的仿真图和程序改了下,调试了可以显示。
因为我也没有PG12864f的液晶资料,不过大家可以对着程序理解下,其实原理和1206有点类似。
仿真总图:
单片机接线图:
12864液晶接线:
#include
2、wr=P2^0; sbit rd=P2^1; sbit ce=P2^2; sbit cd=P2^3; sbit rst=P2^4; void delay(uint t); void init_12864(); void write_data(uchar dat); void write_cmd1(uchar cmd); void write_cmd2(uchar dat,uchar cmd); void write_cmd3(uchar data1,uchar data2,uchar cmd); uchar read_status(); void check_sta
3、tus(); void clear_screen(); void display_char(uchar x,uchar y,uchar ch); int main() { uchar i,j=0; init_12864(); for(i=0;i<128;i++) { display_char(i/16,i%16,'0'+i); } clear_screen(); } //处在x y处显示ch void display_char(uchar x,uchar y,uchar ch)//x 0-7
4、y 0-15
{
write_cmd3((((x*2)<<4)+y),0x00,0x24);//地址指针位置
write_cmd2(ch-32,0xc0);//t6963c字符表与ASCII差32@@@@@@@@@@@@@@@@
}
void delay(uint t)
{
uint i,j;
for(i=0;i 5、1;
cd=1;
rst=1;
check_status();
write_cmd3(0x01,0x00,0x21);//光标指针设置
check_status();
write_cmd3(0x00,0x00,0x40);//文本区首地址
check_status();
write_cmd1(0x80);//显示方式设置,正常显示
check_status();
write_cmd1(0x94);//。。显示状态设置 1 0 1 0 N3 N2 N1 N0 文本显示,光标不显示,不闪烁
//write_cmd1(0x98);//图形方式显示,不显示字母,只打点 6、
check_status();
write_cmd1(0xa1);//光标形状设置1 0 1 0 0 N2 N1 N0
}
void clear_screen()
{
uint i;
write_cmd3(0x00,0x00,0x24);//地址指针设置
check_status();
write_cmd1(0xb0);//数据自动写,每写一次,地址指针自动加一
check_status();
for(i=0;i<8192;i++)
{
check_status();
write_data(0X00);
}
check_status 7、();
write_cmd1(0xb2);//数据自动写结束
}
void write_data(uchar dat)
{
rd=1;
cd=0;
ce=0;
wr=0;
P0=dat;
delay(10);
wr=1;
ce=1;
cd=1;
}
void write_cmd1(uchar cmd)
{
rd=1;
cd=1;
ce=0;
wr=0;
P0=cmd;
delay(10);
wr=1;
ce=1;
cd=0;
}
//先送参数,再送指令
void write_cmd2(uchar dat,uch 8、ar cmd)
{
check_status();
write_data(dat);
check_status();
write_cmd1(cmd);
}
void write_cmd3(uchar data1,uchar data2,uchar cmd)
{
check_status();
write_data(data1);
check_status();
write_data(data2);
check_status();
write_cmd1(cmd);
}
uchar read_status()
{
uchar status;
P0=0;//端口b置为输入
rd=0;
wr=1;
ce=0;
cd=1;
status=P1;
return status;
}
void check_status()
{
uchar s;
P0=0Xff;//端口b置为输出
while((s&0x03)!=0x03)
s=read_status();//等待位1,2置为。命令读写准备好。数据读写准备好
}
7 / 7
- 温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年水电工程运行维护管理合同示范文本.docx
- 2025年工程勘测设计合同模板.docx
- 2025年区域产品销售代理合同.docx
- 2025年经销商授权合同样本.docx
- 2025年员工住房资金借贷合同.docx
- 2025年轻钢建筑施工合同示例.docx
- 2025年网络推广托管合同.docx
- 2025年简明个人借款正式合同范例.docx
- 2025年房产按揭贷款合同范例.docx
- 2025年技术合同争议调解.docx
- 2025年电子版城市住宅租赁合同范本.docx
- 2025年简易转让合同协议书样本.docx
- 2025年投资顾问服务合同实例.docx
- 2025年经销合同模板.docx
- 2025年工业项目设计合同样本.docx