⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lcd12864.h

📁 lcd1602+lcd12864+led+key 扩展
💻 H
字号:
#include "config.h"


sbit LCD12864_EN=P2^1;
sbit LCD12864_RS = P2^3;
sbit LCD12864_RW = P2^2;
sbit LCD12864_CS1 = P2^5;
sbit LCD12864_CS2 = P2^4;

void write_cmd_12864(uchar command)
{
	//if (flg == 1)check_busy_12864();

	LCD12864_RS = 0;
	LCD12864_RW = 0;

	B= command;
	LCD12864_EN = 1;
	_nop_();_nop_();_nop_();
	LCD12864_EN = 0;
	
}
void  LCD12864INIT(void)
{
	write_cmd_12864(0x3f);//DISPLAY ON
	write_cmd_12864(0xc0);//行
	write_cmd_12864(0xb8);//列

	write_cmd_12864(0x40);//页
}


void write_data_12864(uchar wdata)
{
	
//	if (flg == 1)check_busy_12864();
//	LCD12864_EN = 0;
	LCD12864_RS = 1;
	LCD12864_RW = 0;
	//P1 = 0;
	B = wdata;
	LCD12864_EN = 1;
	_nop_();_nop_();_nop_();
	//delay_5ms();//加上延时函数后显示就很缓慢,看来是E下降沿有效
	LCD12864_EN = 0;



}
void clean_all_12864(void)
{
	uchar row,line;
	LCD12864_CS1 = 0;
	LCD12864_CS2 = 0;
	
	for(row =0; row<8; row++)
	{
		write_cmd_12864(0xb8+row);//页
		write_cmd_12864(0x40);//列
		for(line=0;line<64;line++)
			write_data_12864(0x55);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -