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

📄 1602.c

📁 1602液晶源程序
💻 C
字号:
#include "..\inc\1602.h"
#include "..\inc\uTypes.h"
#include "..\inc\sysUtils.h"


#define LCD1602_WR_H() rPDATC|=0x01;
#define LCD1602_WR_L() rPDATC&=~0x01;

//总线地址声明
volatile U8 * LCD1602_MAdd = (volatile U8 *)(0x6000000);

U8 table1[]="TX-1B MCU";
U8 table2[]="WWW.TXMCU.COM";

//写命令
void write_com(U8 com)
{
	LCD1602_WR_L();
	sysUtilsUSecDelay(1);
	* LCD1602_MAdd=com;
	sysUtilsUSecDelay(15000);
}
//写数据
void write_date(U8 date)
{
	LCD1602_WR_H();
	sysUtilsUSecDelay(1);
	* LCD1602_MAdd=date;
	sysUtilsUSecDelay(15000);
}

void Init_1602(void)
{
	write_com(0x38);
	write_com(0x0f);
	write_com(0x06);
	write_com(0x01);
}

void Lcd_1602Test(void)	
{
	U8 a;
	
	Init_1602();
	
	write_com(0x80+17);
	sysUtilsUSecDelay(2000);
	for(a=0;a<9;a++)
	{
		write_date(table1[a]);
		sysUtilsUSecDelay(2000);	
	}

	write_com(0xc0+17);
	sysUtilsUSecDelay(5000);
	for(a=0;a<13;a++)
	{
		write_date(table2[a]);
		sysUtilsUSecDelay(4000);	
	}

	for(a=0;a<16;a++)
	{
		write_com(0x18);
		sysUtilsUSecDelay(250000);
	}
}

⌨️ 快捷键说明

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