proteus中 基于STC89C51的HDG12864F-3显示器仿真

最近接了个项目涉及到使用HDG12864F-3 即128*64分辨率显示屏的使用.

抽时间顺便谢谢博客吧~

- first step: 分析篇

百度显示屏技术手册:
https://wenku.baidu.com/view/049ff3c5da38376bae1fae0d.html
(百度仅有的技术手册…有点老,凑合着用吧)

教大家一下芯片手册正确的打开步骤:
1.查看芯片结构及引脚图:
在这里插入图片描述
2.查看技术手册:
在这里插入图片描述
由此我们大概知道各个引脚对应得功能了

3.查看时序图:
在这里插入图片描述
从中时序通讯即可了解 PS:注意时序图的规定时序时间

4.查看推荐电路图
在这里插入图片描述

最后由上绘制初步电路图
在这里插入图片描述

。。(为什么P0口要接上拉电阻?   ---因为P0口内部没有上拉,所以需要人为上拉)

至此,芯片分析完毕,下面进入程序篇! (*^▽^*)

.
.
.
.

**

- second step: 程序篇

**
有小伙伴说显示不了? 我就白给了吧,(我之前是好使得),看清楚显示屏型号哦

#include<reg52.h>
#define uchar unsigned char 
#define uint unsigned int 
/************************************************************************************/
#define LCD P0
sbit A0=P2^6;		//指令OR数据输入选择
sbit RW=P2^5;		   //读写选择
sbit EN=P2^7;		  //(时钟)使能选择
sbit RES=P3^2;		   //复位引脚,低电平有效 (电路直接给高)
/************************************************************************************/
//字模
uchar buf1[]={0x00,0x08,0x88,0x48,0x28,0x18,0x0F,0xE8,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,
0x08,0x08,0x09,0x09,0x09,0x09,0x09,0xFF,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x00};

/************************************************************************************/
void delay(uint x)				//延时1ms函数
{
	uint i,j;
	for(i=0;i<x;i++)
	{
		for(j=0;j<110;j++);
	}
}
/*
 @Function:  12864命令输入函数
*/
void lcd_write(uchar cmd)		
{
	A0=0;
	RW=0;
	
	delay(5);
	LCD=cmd;
	delay(5);
	EN=1;
	delay(5);
	EN=0;
	
}
/*
@Function:  12864数据输入函数
*/
void lcd_date(uchar dat)	 
{
	A0=1;
	RW=0;

	delay(5);
	LCD=dat;
	delay(5);
	EN=1;
	delay(5);
	EN=0;
}
/*
@function: initiate the module
*/
void init()				//12864初始化
{
	RES=1;
	
	lcd_write(0xaf);
	delay(5);
	
	lcd_write(0xa1);
	delay(5);

}
/*
@Function:  display 16*16 character to the designate position
@input: a 对应页   b 对应列的高四位	 c 待显示字模数组
@字模绘制格式 :	 从下往上自高到低  从上到下按列扫描,共16列 16行	 
					**** 即倒序纵向取模 ****
*/
void display(int a,int b,char *c)
{
	int n;
	for(n=0;n<=15;n++)
	{
	 lcd_write(a);				//选择页
	 delay(5);	
	 lcd_write(b);
	 delay(5);	
	 lcd_write(0x00+n);
	 delay(5);	
	 lcd_date(c[n]);
	 delay(20);	
	 lcd_write(a+1);			   //选择下一页页
	 delay(5);	
	 lcd_write(b);
	 delay(5);	
	 lcd_write(0x00+n);
	 delay(5);	
	 lcd_date(c[n+16]);
	 delay(20);
	}	
}

void main()
{
	init();
	while(1){

	display(0xB0,0x00,buf1);
	}
}

***最后,Hope you ENJOY~***(*^▽^*)

评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值