使用虚拟显存方式操作12864液晶

通常操作12864液晶时,画点函数没有TFT那么方便,我一直都是使用内存虚拟一个显存方式,画点函数将使用内存的一个bit,然后更新到实际屏幕上。12864液晶将需要1KB的内存,我使用的256128需要4KB的内存作为显存。
这样做的好处是,画点函数非常灵活,可以随意在屏幕的任意位置画点,并且不受LCD厂家限制,对于UI的移植会非常方便。


//C文件

/*************************************************************************************************************
 * 文件名:		LCD256128.c
 * 功能:		JLX12864G-0088 LCD256128液晶驱动
 * 作者:		[email protected]
 * 邮箱:		[email protected]
 * 创建时间:	2017年02月25日08:58
 * 最后修改时间:2017年02月25日
 * 详细:		汉字模取模方式:阴码,逐行式,顺向,高字节在前
				ASCII字符取模方式:阴码,列行式,逆向,低字节在前
				2017-07-19:增加12x24大小的ASCII字符显示
*************************************************************************************************************/
#include "LCD256128.h"
#include "ascii_8x16.h"
#if(LCD_ASCII_12X24_EN) //12X24大小字符显示
#include "ASCII_12x24.h"
#endif //LCD_ASCII_12X24_EN


//保存LCD对比度
static u8 LCD_Cont = 40;	//LCD对比度调节



#if LCD_BUFF_ENABLE
	static u8 LCD_BUFF[16][256];//显存
#endif

//汉字支持
#define CHINESE_ENABLE		1
							
#if	CHINESE_ENABLE
#include "fontlib.h"
#endif	


#if LCD_BUFF_ENABLE		//使能了显存
//获取显存地址
//2016-02-01:增加获取显存函数
u8 *LCD256128_GetGramBuff(void)
{
	return (u8 *)&LCD_BUFF[0][0];
}

//上电状态
static bool isPowerStatus = FALSE;	

#endif


//LCD掉电,将所有的IO设置为下拉输入模式
//唤醒后需要重新初始化							
void LCD256128_PowerDown(void)
{
	LCD256128_DEFAULT();
	isPowerStatus = FALSE;	//屏幕掉电了
}	

//获取上电状态						
bool LCD256128_GetPowerStatus(void)
{
	return isPowerStatus;
}	


/*************************************************************************************************************************
* 函数	:	void LCD256128_WriteData(u8 data)
* 功能	:	向LCD256128写入一字节数据
* 参数	:	data:数据
* 返回	:	无
* 依赖	:	底层宏定义
* 作者	:	[email protected]
* 时间	:	20120530
* 最后修改时间 : 20120530
* 说明	: 	CD=1,时钟上升沿数据有效,先发送高位
*************************************************************************************************************************/
void LCD256128_WriteData(u8 data)
{
	u8 i;

	LCD_CS_L();
	nop;nop;nop;
	LCD_CD = 1;	
	nop;nop;nop;
	for(i = 0;i < 8;i ++)
	{
		 LCD_SCK = 0;
	 	 LCD_SDA = 	(data & 0x80) ? 1 : 0;
		 nop;nop;
		 LCD_SCK = 1;
		 nop;nop;
		 data <<= 1;
		nop;nop;nop;nop;
	}
	LCD_SCK = 0;
	LCD_CS_H();
}



/*************************************************************************************************************************
* 函数	:	void LCD256128_WriteCommand(u8 cmd)
* 功能	:	向LCD256128写入一字节命令
* 参数	:	cmd:命令
* 返回	:	无
* 依赖	:	底层宏定义
* 作者	:	[email protected]
* 时间	:	20120530
* 最后修改时间 : 20120530
* 说明	: 	CD=0,时钟上升沿数据有效,先发送高位
*************************************************************************************************************************/
void LCD256128_WriteCommand(u8 cmd)
{
	u8 i;

	LCD_CS_L();
	nop;nop;nop;
	LCD_CD = 0;	
	nop;nop;nop;
	for(i = 0;i < 8;i ++)
	{
		LCD_SCK = 0;
	 	 LCD_SDA = 	(cmd & 0x80) ? 1 : 0;
		 nop;nop;
		 LCD_SCK = 1;
		 nop;nop;
		 cmd <<= 1;
		 nop;nop;nop;nop;
	}
	LCD_SCK = 0;
	LCD_CS_H();
}



/*************************************************************************************************************************
* 函数			:	static void LCD256128_SetAddress(u8 StartX,u8 StartY, u8 EndX,u8 EndY)
* 功能			:	设置光标地址
* 参数			:	StartX:开始列地址;StartY:开始行地址;EndX:结束列地址;EndY:结束行地址
* 返回			:	无
* 依赖			:	底层宏定义
* 作者			:	[email protected]
* 时间			:	2017-02-25
* 最后修改时间 	: 	2017-02-25
* 说明			: 	16行(每行8点阵),256列,从0开始
*************************************************************************************************************************/
static void LCD256128_SetAddress(u8 StartX,u8 StartY, u8 EndX,u8 EndY)
{
	LCD256128_WriteCommand(0x15); 	//设置列地址
	LCD256128_WriteData(StartX);	//起始地址
	LCD256128_WriteData(EndX);		//结束地址
	LCD256128_WriteCommand(0x75); 	//设置页地址
	LCD256128_WriteData(StartY);	//起始地址
	LCD256128_WriteData(EndY);		//结束地址
	LCD256128_WriteCommand(0x30); 	//扩展指令1
	LCD256128_WriteCommand(0x5c); 	//写数据
}

/*************************************************************************************************************************
* 函数	:	void LCD256128_ClearAll(void)
* 功能	:	LCD256128液晶清屏
* 参数	:	无
* 返回	:	无
* 依赖	:	底层宏定义
* 作者	:	[email protected]
* 时间	:	20120530
* 最后修改时间 : 20120530
* 说明	: 	无
*************************************************************************************************************************/
void LCD256128_ClearAll(void)
{
	u16 i,j;

	LCD256128_SetAddress(0,0, 255,16);
	for(i = 0;i < 17;i ++)
	{
		for(j = 0;j < 256;j ++)
		{
			LCD256128_WriteData(0x00);
		}	
	}
}



/*************************************************************************************************************************
* 函数			:	void LCD256128_ShowChar(u8 x,u8 y,char CHAR,u8 FontSize)
* 功能			:	在指定位置显示一个字符
* 参数			:	x:列地址,共256列;y:行地址,共16行,CHAR:需要显示的字符,FontSize:字体大小
* 返回			:	无
* 依赖			:	底层宏定义
* 作者			:	[email protected]
* 时间			:	20120530
* 最后修改时间 	: 	2017-02-25
* 说明			: 	显示一个ASCII字符
*************************************************************************************************************************/
void LCD256128_ShowChar(u8 x,u8 y,char CHAR,u8 FontSize)
{
	const unsigned char *p;
	u16 i;
	u16 xend,yend;
	u16 size;
	


	CHAR -= 32;
	if(CHAR > ASCII_MAX - 1)
		return;

	if(FontSize == 12)
	{
		p = ASCII_8X12[CHAR];		//12号
		xend = x+8-1;
		yend = y+2-1;
		size = 2*8;
	}		
	else if(FontSize==16)
	{
		p = ASCII_8X16[CHAR];		//16号
		xend = x+8-1;
		yend = y+2-1;
		size = 2*8;
	}
		
#if(LCD_ASCII_12X24_EN) //12X24大小字符显示
	else if(FontSize==24)
	{
		p = ASCII_12X24[CHAR];		//24号
		xend = x+12-1;
		yend = y+3-1;
		size = 3*12;
	}	
#endif //LCD_ASCII_12X24_EN	
	else
	{
		p = ASCII_8X12[CHAR];		//12号
		xend = x+8-1;
		yend = y+2-1;
		size = 2*8;
	}
	
	LCD256128_SetAddress(x,y, xend, yend);
	for(i = 0;i < size;i ++)
	{
		LCD256128_WriteData(p[i]);
	}	
			
}



/*************************************************************************************************************************
* 函数			:	void LCD_PrintfChar(u8 PageAdd,u8 LineAdd,const char *p,u8 FontSize)
* 功能			:	在指定位置显示字符串																					  
* 参数			:	x:列地址,共256列;y:行地址,共16行,;p:字符指针,FontSize:子大小;16或者12
* 返回			:	无
* 依赖			:	LCD256128_ShowChar
* 作者			:	[email protected]
* 时间			:	20120601
* 最后修改时间 	: 	2017-02-25
* 说明			: 	FontSize = 16或者 12
*************************************************************************************************************************/
void LCD_PrintfChar(u8 x,u8 y,const char *p,u8 FontSize)
{
	u8 width;
	
	switch(FontSize)
	{
		case 12:width=8;break;
		case 16:width=8;break;
		case 24:width=12;break;
		default:width=8;break;
	}
	
	while(*p != 0) 
	{
		LCD256128_ShowChar(x,y,*p,FontSize);
		p ++;
		x += width;
	}	
}


/*************************************************************************************************************************
* 函数	:	void LCD256128_SetConAdj(u8 cont)
* 功能	:	设置液晶的对比度
* 参数	:	cont:对比度值
* 返回	:	无
* 依赖	:	底层宏定义
* 作者	:	[email protected]
* 时间	:	2014-08-24
* 最后修改时间 : 2014-08-24
* 说明	: 	需要先初始化LCD
*************************************************************************************************************************/
void LCD256128_SetConAdj(u8 cont)
{
	if(cont > 63) cont = 63;
	LCD256128_WriteCommand(0x81); //设置对比度,“0x81”不可改动,紧跟着的2 个数据是可改的,但“先微调后粗调”这个顺序别乱了
	LCD256128_WriteData(cont); //对比度微调,可调范围0x00~0x3f,共64 级
	LCD256128_WriteData(0x04); //对比度粗调,可调范围0x00~0x07,共8 级
	
	
	LCD_Cont = cont;		//更新对比度
}


/*************************************************************************************************************************
* 函数	:	void LCD256128_Init(void)
* 功能	:	初始化LCD256128液晶
* 参数	:	无
* 返回	:	无
* 依赖	:	底层宏定义
* 作者	:	[email protected]
* 时间	:	20120530
* 最后修改时间 : 20120530
* 说明	: 	初始化LCD256128液晶
*************************************************************************************************************************/
void LCD256128_Init(u8 LCDCont)
{
	LCD256128_DeInit();		//初始化液晶IO
	LCD_RST = 0;  			//液晶复位开始
	Delay_MS(1);
	LCD_RST = 1;  			//液晶复位结束
	Delay_MS(1);
	
	LCD256128_WriteCommand(0x30); 	//EXT1=0,EXT0=0,表示选择了“扩展指令表1”
	LCD256128_WriteCommand(0x94); 	//退出睡眠
	LCD256128_WriteCommand(0x31);	//EXT=1
	LCD256128_WriteCommand(0xD7); 	//Autoread disable
	LCD256128_WriteData(0X9F); 		//
	LCD256128_WriteCommand(0x32); 	//LCD 偏压比设置
	LCD256128_WriteData(0x00); 		//振荡频率的调整
	LCD256128_WriteData(0x01); 		//升压电容器的频率->6KHz
	LCD256128_WriteData(0x04); 		//Bias=1/11
	LCD256128_WriteCommand(0x20); 	//灰度设置
	LCD256128_WriteData(0x01);
	LCD256128_WriteData(0x03);
	LCD256128_WriteData(0x05);
	LCD256128_WriteData(0x07);
	LCD256128_WriteData(0x09);
	LCD256128_WriteData(0x0b);
	LCD256128_WriteData(0x0d);
	LCD256128_WriteData(0x10);
	LCD256128_WriteData(0x11);
	LCD256128_WriteData(0x13);
	LCD256128_WriteData(0x15);
	LCD256128_WriteData(0x17);
	LCD256128_WriteData(0x19);
	LCD256128_WriteData(0x1b);
	LCD256128_WriteData(0x1d);
	LCD256128_WriteData(0x1f);
	LCD256128_WriteCommand(0x30); // EXT1=0,EXT0=0,表示选择了“扩展指令表1”
	LCD256128_WriteCommand(0x75); // 页地址设置
	LCD256128_WriteData(0X00); // 起始页地址:YS=0X00
	LCD256128_WriteData(0X1f); // 结束页地址:YE=0x1F 每4 行为一页,第0~3 行为第0 页,第124~127 行为第31 页(31=0x1f)
	LCD256128_WriteCommand(0x15); // 列地址设置
	LCD256128_WriteData(0X00); // 起始列地址:XS=0
	LCD256128_WriteData(0Xff); // 结束列地址:XE=256(0xff)
	LCD256128_WriteCommand(0xBC); //数据扫描方向
	LCD256128_WriteData(0x00); //MX.MY=Normal
	LCD256128_WriteData(0xA6);
	LCD256128_WriteCommand(0x0c); //数据格式选择,0x0C 是低位在前D0-D7,0x08 是高位在前D7-D0
	LCD256128_WriteCommand(0xCA); //显示控制
	LCD256128_WriteData(0X00); //设置CL 驱动频率:CLD=0
	LCD256128_WriteData(0X7F); //占空比:Duty=128
	LCD256128_WriteData(0X20); //N 行反显:Nline=off
	LCD256128_WriteCommand(0xF0); //显示模式
	LCD256128_WriteData(0X10); //如果设为0x11:表示选择4 灰度级模式,如果设为0x10:表示选择黑白模式
	LCD256128_WriteCommand(0x81); //设置对比度,“0x81”不可改动,紧跟着的2 个数据是可改的,但“先微调后粗调”这个顺序别乱了
	LCD256128_WriteData(0x10); //对比度微调,可调范围0x00~0x3f,共64 级
	LCD256128_WriteData(0x04); //对比度粗调,可调范围0x00~0x07,共8 级
	LCD256128_WriteCommand(0x20); //Power control
	LCD256128_WriteData(0x0B); //D0=regulator ; D1=follower ; D3=booste, on:1 off:0
	LCD256128_SetConAdj(LCDCont);
	Delay_US(100);
	LCD256128_WriteCommand(0xAF); //打开显示	
	LCD256128_ClearAll();		//清屏

	

//#if(LCD_ROTATE_180)	//旋转180度显示
//	LCD256128_WriteCommand(0xc0); /*行扫描顺序:从下到上*/
//	LCD256128_WriteCommand(0xa1); /*列扫描顺序:从右到左*/
//#else
//	LCD256128_WriteCommand(0xc8); /*行扫描顺序:从上到下*/
//	LCD256128_WriteCommand(0xa0); /*列扫描顺序:从左到右*/
//#endif

	
	LCD_LED_ON();			//开液晶背光
	
	LCD_Cont = LCDCont;
	isPowerStatus = TRUE;	//上电完成
}




#if LCD_BUFF_ENABLE		//使能了显存


/*************************************************************************************************************************
* 函数	:	void GRAM_DrawPoint(u8 x,u8 y)
* 功能	:	在显存里面指定位置画点
* 参数	:	x:X坐标,0-127;y:y坐标,0-63
* 返回	:	无
* 依赖	:	底层宏定义
* 作者	:	[email protected]
* 时间	:	20120531
* 最后修改时间 : 20120531
* 说明	: 	无
*************************************************************************************************************************/
void GRAM_DrawPoint(u8 x,u8 y)
{
	if(y > 127)
		return;
	LCD_BUFF[y / 8][x] |= (1 << (y % 8));
}




/*************************************************************************************************************************
* 函数	:	void GRAM_ClearPoint(u8 x,u8 y)
* 功能	:	擦除显存里面指定位置的点
* 参数	:	x:X坐标,0-127;y:y坐标,0-63
* 返回	:	无
* 依赖	:	底层宏定义
* 作者	:	[email protected]
* 时间	:	20120531
* 最后修改时间 : 20120531
* 说明	: 	无
*************************************************************************************************************************/
void GRAM_ClearPoint(u8 x,u8 y)
{
	if(y > 127)
		return;
	LCD_BUFF[y / 8][x] &= ~(1 << (y % 8));
}



/*************************************************************************************************************************
* 函数	:	void GRAM_ClearAll(void)
* 功能	:	清除全部显存
* 参数	:	无
* 返回	:	无
* 依赖	:	底层宏定义
* 作者	:	[email protected]
* 时间	:	20120531
* 最后修改时间 : 20120531
* 说明	: 	无
*************************************************************************************************************************/
void GRAM_ClearAll(void)
{
	u16 i,j;

	for(i = 0;i < 16;i ++)
	{
		for(j = 0;j < 256;j ++)
		{
		 	LCD_BUFF[i][j] = 0x00;
		}
	}
}


/*************************************************************************************************************************
* 函数	:	void GRAM_Up(u8 x1,u8 y1,u8 x2,u8 y2)
* 功能	:	更新显存至液晶
* 参数	:	x1,y1:起始坐标;x2,y2:终点坐标
* 返回	:	无
* 依赖	:	底层宏定义
* 作者	:	[email protected]
* 时间	:	20120531
* 最后修改时间 : 20120531
* 说明	: 	y坐标会页对齐
*************************************************************************************************************************/
void GRAM_Up(u8 x1,u8 y1,u8 x2,u8 y2)
{
 	u16 i,j;
//	static u8 cnt = 0;

	y1 /= 8;  //计算页地址
	y2 /= 8;
	
	/*cnt ++;
	if(cnt > 3)
	{
		LCD_RST = 0;  			//液晶复位开始
		Delay_US(1);
		LCD_RST = 1;  			//液晶复位结束
		LCD256128_WriteCommand(0xe2); //软复位
		LCD256128_WriteCommand(0x2c); //升压步聚1
		LCD256128_WriteCommand(0x2e); //升压步聚2
		LCD256128_WriteCommand(0x2f); //升压步聚3
		LCD256128_WriteCommand(0x23); //粗调对比度,可设置范围20~27
		LCD256128_SetConAdj(LCD_Cont);
		LCD256128_WriteCommand(0xa2); //1/9 偏压比(bias)
		LCD256128_WriteCommand(0xaf); //开显示
		cnt = 0;
		
	#if(LCD_ROTATE_180)	//旋转180度显示
		LCD256128_WriteCommand(0xc0); //行扫描顺序:从下到上
		LCD256128_WriteCommand(0xa1); //列扫描顺序:从右到左
	#else
		LCD256128_WriteCommand(0xc8); //行扫描顺序:从上到下
		LCD256128_WriteCommand(0xa0); //列扫描顺序:从左到右
	#endif

		LCD256128_WriteCommand(0x40); //初始化显示行为0
	}*/
	
	
	LCD256128_SetAddress(x1,y1, x2,y2);
	for(i = 0;i < (y2 - y1 + 1);i ++)
	{
		for(j = 0;j < (x2 - x1 + 1);j ++)
		{
			LCD256128_WriteData(LCD_BUFF[y1 + i][x1 + j]);
		}
	}
}




/*************************************************************************************************************************
* 函数	:	void GRAM_ShowChina(u8 x,u8 y,const u8 *p,FONT_MODE FontMode)
* 功能	:	在指定位置显示一个指定大小的汉字 
* 参数	:	x,y:显示开始坐标,p:汉子点阵缓冲区;
			FontMode:汉子显示模式,
				0x80:叠加显示,0x40:反显, 0:16号字体;1:12号字体
* 返回	:	无
* 依赖	:	画点函数
* 作者	:	[email protected]
* 时间	:	20120531
* 最后修改时间 : 20120531
* 说明	: 	FontSize = 16或者 12
*************************************************************************************************************************/
void GRAM_ShowChina(u8 x,u8 y,const u8 *p,FONT_MODE FontMode)
{
	u8 i,j;
	u8 FontSize = (u8)FontMode & 0x3f;	//获取字体大小
	void (*DrawPoint)(u8 i,u8 j);
	void (*ClearPoint)(u8 i,u8 j);


	if(FontMode & 0x40)	//反显
	{
		DrawPoint = GRAM_ClearPoint;
		ClearPoint =  GRAM_DrawPoint;
	}
	else //正常模式
	{
		ClearPoint =  GRAM_ClearPoint;
		DrawPoint =  GRAM_DrawPoint;
	}

	if(FontMode & 0x80)	//叠加显示
	{
		for(i = 0;i < FontSize;i ++)
		{
		 	for(j = 0;j < 8;j ++)
			{
			 	if(*p & 0x80 >> j)
					(*DrawPoint)(x + j,y + i);
			}
			p ++;
			for(j = 0;j < FontSize - 8;j ++)
			{
				if(*p & 0x80 >> j)
					(*DrawPoint)(x + j + 8,y + i);
			}
			p ++;
		}
	}
	else	//非叠加显示
	{
		for(i = 0;i < FontSize;i ++)
		{
		 	for(j = 0;j < 8;j ++)
			{
			 	if(*p & 0x80 >> j)
					(*DrawPoint)(x + j,y + i);
				else
					(*ClearPoint)(x + j,y + i);
			}
			p ++;
			for(j = 0;j < FontSize - 8;j ++)
			{
				if(*p & 0x80 >> j)
					(*DrawPoint)(x + j + 8,y + i);
				else
					(*ClearPoint)(x + j + 8,y + i);
			}
			p ++;
		}
	}
	
}




/*************************************************************************************************************************
* 函数	:	void GRAM_ShowChar(u8 x,u8 y,char ,FONT_MODE FontMode)
* 功能	:	在指定位置显示一个指定大小的字符
* 参数	:	x,y:显示开始坐标,p:汉子点阵缓冲区;
			FontMode:汉子显示模式,
				0x80:叠加显示,0x40:反显, 0:16号字体;1:12号字体
* 返回	:	无
* 依赖	:	画点函数
* 作者	:	[email protected]
* 时间	:	20120603
* 最后修改时间 : 20120603
* 说明	: 	FontSize = 16或者 12
*************************************************************************************************************************/
void GRAM_ShowChar(u8 x,u8 y,u8 CHAR,FONT_MODE FontMode)
{
	u8 i,j,k;
	u8 FontSize = (u8)FontMode&0x3f;	//获取字体大小
	u8 *p;
	u8 rows;							//一个字符占用几个8行
	u8 column;							//列数量
	u8 temp;
	void (*DrawPoint)(u8 i,u8 j);
	void (*ClearPoint)(u8 i,u8 j);

	CHAR -= 32;
	if(CHAR > ASCII_MAX - 1)
		return;

	

	if(FontSize==12)
	{
		rows = 2;
		column = 8;
		p = (u8 *)ASCII_8X12[CHAR];		//12号
	}
	else if(FontSize == 16)
	{
		rows = 2;
		column = 8;
		p = (u8 *)ASCII_8X16[CHAR];		//16号
	}
#if(LCD_ASCII_12X24_EN) //12X24大小字符显示
	else if(FontSize==24)
	{
		rows = 3;
		column = 12;
		p = (u8 *)ASCII_12X24[CHAR];		//24号
	}	
#endif //LCD_ASCII_12X24_EN	
	else 
	{
		rows = 2;
		column = 8;
		p = (u8 *)ASCII_8X12[CHAR];		//12号
	}
	
	if(FontMode & 0x40)	//反显
	{
		DrawPoint = GRAM_ClearPoint;
		ClearPoint =  GRAM_DrawPoint;
	}
	else //正常模式
	{
		ClearPoint =  GRAM_ClearPoint;
		DrawPoint =  GRAM_DrawPoint;
	}

	temp = 8;
	if(FontMode & 0x80)	//叠加显示
	{
		for(k = 0;k < rows;k ++)
		{
			for(j = 0;j < column;j ++)
			{

				for(i = 0;i < temp;i ++)
				{
					if(*p & (1 << i))
						(*DrawPoint)(x + j,k*8+y + i);
				}
				
				p ++;
			}
			
			FontSize -= 8;
			if(FontSize >= 8) temp = 8;
			else temp = FontSize;	
		}
		
		/*for(j = 0;j < 8;j ++)
		{
		 	for(i = 0;i < FontSize - 8;i ++)
			{
				if(*p & (1 << i))
					(*DrawPoint)(x + j,y + 8 + i);
			}
			p ++;
		}*/
	}
	else	//非叠加显示
	{
		
		for(k = 0;k < rows;k ++)
		{
			for(j = 0;j < column;j ++)
			{
				for(i = 0;i < temp;i ++)
				{
					if(*p & (1 << i))
						(*DrawPoint)(x + j,k*8+y + i);
					else
						(*ClearPoint)(x + j,k*8+y + i);
				}
				
				p ++;
			}
			FontSize -= 8;
			if(FontSize >= 8) temp = 8;
			else temp = FontSize;	
		}
		
		
		/*
		for(j = 0;j < 8;j ++)
		{
		 	for(i = 0;i < FontSize - 8;i ++)
			{
				if(*p & (1 << i))
					(*DrawPoint)(x + j,y + 8 + i);
				else
					(*ClearPoint)(x + j,y + 8 + i);
			}
			p ++;
		}*/
	}	
}



/*************************************************************************************************************************
* 函数	:	void LCD_Fill(u16 xStart, u16 xEnd, u16 yStart, u16 yEnd)
* 功能	:	指定位置填充颜色
* 参数	:	位置坐标
* 返回	:	无
* 依赖	:	底层函数
* 作者	:	[email protected]
* 时间	:	20110920
* 最后修改时间 : 20110920
* 说明	: 	无
*************************************************************************************************************************/
void GRAM_Fill(u16 xStart, u16 yStart,u16 xEnd,  u16 yEnd)
{
 	u16 i,j;

	for(i = xStart;i < (xEnd+1); i ++)
	{
		for(j = yStart;j < (yEnd+1);j ++)
		{
			GRAM_DrawPoint(i,j);
		}
	}
}


/*************************************************************************************************************************
* 函数	:	void GRAM_Clear(u16 xStart, u16 yStart, u16 xEnd, u16 yEnd)
* 功能	:	清除指定位置
* 参数	:	位置坐标
* 返回	:	无
* 依赖	:	底层函数
* 作者	:	[email protected]
* 时间	:	20110920
* 最后修改时间 : 20110920
* 说明	: 	无
*************************************************************************************************************************/
void GRAM_Clear(u16 xStart, u16 yStart, u16 xEnd, u16 yEnd)
{
 	u16 i,j;

	for(i = xStart;i < (xEnd+1); i ++)
	{
		for(j = yStart;j < (yEnd+1);j ++)
		{
			GRAM_ClearPoint(i,j);
		}
	}
}



/*************************************************************************************************************************
* 函数	:	void GRAM_DrawLine(u16 x1, u16 y1, u16 x2, u16 y2)
* 功能	:	画线函数
* 参数	:	起点终点坐标
* 返回	:	无
* 依赖	:	画点函数
* 作者	:	[email protected]
* 时间	:	20110920
* 最后修改时间 : 20110920
* 说明	: 	无
*************************************************************************************************************************/ 
void GRAM_DrawLine(u16 x1, u16 y1, u16 x2, u16 y2)
{
	u16 t; 
	int xerr=0,yerr=0,delta_x,delta_y,distance; 
	int incx,incy,uRow,uCol;
	
	//TFT_LCD_SetRamAddr(0,239,0,319);//设置显示窗口 

	delta_x=x2-x1; //计算坐标增量 
	delta_y=y2-y1; 
	uRow=x1; 
	uCol=y1; 
	if(delta_x>0)incx=1; //设置单步方向 
	else if(delta_x==0)incx=0;//垂直线 
	else {incx=-1;delta_x=-delta_x;} 
	if(delta_y>0)incy=1; 
	else if(delta_y==0)incy=0;//水平线 
	else{incy=-1;delta_y=-delta_y;} 
	if( delta_x>delta_y)distance=delta_x; //选取基本增量坐标轴 
	else distance=delta_y; 
	for(t=0;t<=distance+1;t++ )//画线输出 
	{  
		GRAM_DrawPoint(uRow,uCol);//画点 
		xerr+=delta_x ; 
		yerr+=delta_y ; 												
		if(xerr>distance) 
		{ 
			xerr-=distance; 
			uRow+=incx; 
		} 
		if(yerr>distance) 
		{ 
			yerr-=distance; 
			uCol+=incy; 
		} 
	}  
}
									 					   
/*************************************************************************************************************************
* 函数	:	void GRAM_DrawRectangle(u16 x1, u16 y1, u16 x2, u16 y2)
* 功能	:	在指定位置画一个矩形
* 参数	:	多边形的两个坐标
* 返回	:	无
* 依赖	:	画线函数
* 作者	:	[email protected]
* 时间	:	20110920
* 最后修改时间 : 20110920
* 说明	: 	无
*************************************************************************************************************************/
void GRAM_DrawRectangle(u16 x1, u16 y1, u16 x2, u16 y2)
{
	GRAM_DrawLine(x1,y1,x2,y1);
	GRAM_DrawLine(x1,y1,x1,y2);
	GRAM_DrawLine(x1,y2,x2,y2);
	GRAM_DrawLine(x2,y1,x2,y2);
}		





/*************************************************************************************************************************
* 函数	:	void GRAM_ShowString(u16 x,u16 y,const u8 *pStr,FONT_MODE Font_MODE)
* 功能	:	在显存指定位置显示字符串
* 参数	:	x,y:显示开始坐标,pStr:字符串缓冲区;
			FontMode:显示模式,
				0x80:叠加显示,0x40:反显, 0:16号字体;1:12号字体
* 返回	:	无
* 依赖	:	画点函数
* 作者	:	[email protected]
* 时间	:	2014-08-20
* 最后修改时间 : 2014-08-20
* 说明	: 	FontSize = 16或者 12
*************************************************************************************************************************/
void GRAM_ShowString(u16 x,u16 y,const char *pStr,FONT_MODE Font_MODE)
{
	u8 Font_Size = Font_MODE & 0x3f;
	u8 width;
#if	CHINESE_ENABLE
	u8 buff[32];
#endif
	
	switch(Font_Size)
	{
		case 12:width=16;break;
		case 16:width=16;break;
		case 24:width=24;break;
		default:width=16;break;
	}
	
	while(*pStr != 0)
	{	
#if	CHINESE_ENABLE		
		if(*pStr > 0x80)//汉字
		{
			FONT_GetFontLattice(buff, (u8*)pStr, ST16X16);	//获取汉字点阵
		 	GRAM_ShowChina(x,y,buff,Font_MODE);				//显示汉字
			pStr += 2;
			if(x > 256 - 16)  //自动换行
			{
			 	x = 0;
				y += Font_Size;
			}
			else
			{
				x += width;
			}
		}
		else //ASCII
#endif
		{
			GRAM_ShowChar(x,y,*pStr,Font_MODE);
			pStr++;
			if(x > 256 - 8)  //自动换行
			{
			 	x = 0;	
				y += Font_Size;
			}
			else
			{
				x += width/2;
			}
		}

	}
}




/*************************************************************************************************************************
* 函数			:	void GRAM_ShowLattice(u16 x,u16 y,u16 width, u16 height, const u8 LatticeBuff[], bool isInvert)
* 功能			:	在指定位置显示一个指定大小的点阵数据
* 参数			:	x,y:显示开始坐标,width:点阵宽度;height:点阵高度;LatticeBuff:点阵数据缓冲区;isInvert:是否反色显示
* 返回			:	无
* 依赖			:	画点函数
* 作者			:	[email protected]
* 时间			:	2016-03-25
* 最后修改时间 	: 	2016-03-25
* 说明			: 	用于显示自定义字符
					字符高度任意,宽度不足8的倍数需要补充为8的倍数进行存储,但是不显示
					字模取模方式:阴码,逐行式,顺向,高字节在前
*************************************************************************************************************************/
void GRAM_ShowLattice(u8 x,u8 y,u16 width, u16 height, const u8 LatticeBuff[], bool isInvert)
{
	u16 i,j,k;
	u8 *p;
	void (*DrawPoint)(u8 i,u8 j);


	u16 w = width / 8;		//计算整数行
	u16 res = width % 8;	//计算非整数行
	p = (u8 *)LatticeBuff;
	
	if(isInvert)	//反显
	{
		DrawPoint = GRAM_ClearPoint;			//清除点函数
		GRAM_Fill(x,y,x+width-1,y+height-1);	//填充满区域	
	}
	else //正常模式
	{
		DrawPoint =  GRAM_DrawPoint;			//画点函数
		GRAM_Clear(x,y,x+width-1,y+height-1);	//清空显示区域
	}
	
	
	for(i = 0;i < height;i ++)	//逐行绘制
	{
		for(j = 0;j < w;j ++)	//整8的倍数的列先进行绘制
		{
			for(k = 0;k < 8;k ++)
			{
				if(*p & (0x80 >> k))
					(*DrawPoint)(x + j*8+k,y + i);
			}
			p ++;
		}
		for(k = 0;k < res;k ++)
		{
			if(*p & (0x80 >> k))
				(*DrawPoint)(x + w*8+k,y + i);
		}
		if(res > 0) p ++;
		
	}

/*
	for(i = 0;i < 16;i ++)
	{
		for(j = 0;j < 8;j ++)
		{
			if(*p & 0x80 >> j)
				(*DrawPoint)(x + j,y + i);
		}
		p ++;
		for(j = 0;j < 16 - 8;j ++)
		{
			if(*p & 0x80 >> j)
				(*DrawPoint)(x + j + 8,y + i);
		}
		p ++;
	}	*/
}



#endif




//H文件
/*************************************************************************************************************
 * 文件名:		LCD256128.H
 * 功能:		JLX12864G-0088 LCD256128液晶驱动
 * 作者:		[email protected]
 * 邮箱:		[email protected]
 * 创建时间:	2017年02月25日08:58
 * 最后修改时间:2017年02月25日
 * 详细:		
*************************************************************************************************************/
#ifndef _LCD256128_H_
#define _LCD256128_H_

#include "system.h"
#include "gpio_init.h"
#include "delay.h"


//LCD型号							
#define 	JLX256128G_256		0



#if(BOARD_SUPPORT)	//需要板级支持

#include "board.h" 

#else				//默认支持

#define LCD_SDA		PFout(6)		//数据线
#define LCD_SCK		PFout(7)		//串行时钟
#define LCD_CD		PFout(8)		//H:数据寄存器;L:指令寄存器
#define LCD_RST		PFout(9)		//复位,低电平有效
//片选,低电平有效
#define LCD_CS_H()	
#define LCD_CS_L()							
//液晶背光,高电平有效
#define LCD_LED_H()		
#define LCD_LED_L()
//液晶硬件IO初始化函数
#define LCD256128_DeInit()	{\
								DeviceClockEnable(DEV_GPIOF, ENABLE);\
								GPIOx_Init(GPIOF ,BIT6 | BIT7 | BIT8 | BIT9, OUT_PP,SPEED_50M);\
								LCD_SDA=LCD_SCK=LCD_CD=LCD_RST=1;\
								LCD_CS_H();\
				}

//液晶硬件IO低功耗模式
#define LCD256128_DEFAULT()	{\
								GPIOx_Init(GPIOF ,BIT6 | BIT7 | BIT8 | BIT9, IN_IPT,IN_IN);\
							}
//旋转180度显示
#define 	LCD_ROTATE_180		0
//LCD型号
#define LCD256128_MODEL		JLX256128G_256					
							
#endif


//LCD 列坐标偏移,某些LCD旋转180度后X坐标需要偏移
#if((LCD256128_MODEL==JLX256128G_256)&&LCD_ROTATE_180)
#define LCD256128_X_OFFSET	4
#else
#define LCD256128_X_OFFSET	0							
#endif






#define LCD_ASCII_12X24_EN	0	//是否使能12x24大小字符显示
#define LCD_BUFF_ENABLE		1	//使能显存

//关背光
#define LCD_LED_OFF()		LCD_LED_L()
//开背光
#define LCD_LED_ON()		LCD_LED_H()

void LCD256128_PowerDown(void);	//掉电
void LCD256128_Init(u8 LCDCont);	//初始化12864
void LCD256128_ClearAll(void );
void LCD_PrintfChar(u8 x,u8 y,const char *p,u8 FontSize);	//字符串显示函数
void LCD256128_SetConAdj(u8 cont);
#if LCD_BUFF_ENABLE		//使能了显存


typedef enum
{
	FONT24_DEFAULT 	= (0x80+24),	//24号,叠加显示
	FONT16_DEFAULT 	= (0x80+16),	//16号,叠加显示
	FONT12_DEFAULT 	= (0x80+12),	//12号,叠加显示
	FONT24_COVER 	= 	(24),		//16号,覆盖显示
	FONT16_COVER 	= 	(16),		//16号,覆盖显示
	FONT12_COVER 	= 	(12),		//12号,覆盖显示
	FONT24_REVERSE 	= (0x40+24),	//24号,反显显示
	FONT16_REVERSE 	= (0x40+16),	//16号,反显显示
	FONT12_REVERSE 	= (0x40+12),	//12号,反显显示
}FONT_MODE;

void GRAM_DrawPoint(u8 x,u8 y);									//显存写点
void GRAM_ClearPoint(u8 x,u8 y); 								//显存擦点
void GRAM_ClearAll(void);										//清除显存
void GRAM_Up(u8 x1,u8 y1,u8 x2,u8 y2);							//更新显存
#define GRAM_UpAll()	GRAM_Up(0,0,255,127)						//更新全部显存
void GRAM_ShowChina(u8 x,u8 y,const u8 *p,FONT_MODE FontMode);	//汉子显示
void GRAM_ShowChar(u8 x,u8 y,u8 CHAR,FONT_MODE FontMode);		//ASCII显示
void GRAM_Fill(u16 xStart, u16 yStart,u16 xEnd,  u16 yEnd);
void GRAM_Clear(u16 xStart, u16 xEnd, u16 yStart, u16 yEnd);
void GRAM_DrawLine(u16 x1, u16 y1, u16 x2, u16 y2);
void GRAM_DrawRectangle(u16 x1, u16 y1, u16 x2, u16 y2);
void GRAM_ShowString(u16 x,u16 y,const char *pStr,FONT_MODE Font_MODE);
u8 *LCD256128_GetGramBuff(void);//获取显存地址
//获取上电状态						
bool LCD256128_GetPowerStatus(void);
void GRAM_ShowLattice(u8 x,u8 y,u16 width, u16 height, const u8 LatticeBuff[], bool isInvert);



#endif


#endif	//_LCD256128_H_

//ASCII编码

#ifndef _ASCII_8X16_H_
#define _ASCII_8X16_H_

//字模取模方式:阴码,列行式,逆向,低字节在前
// !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

#define ASCII_MAX	95
const unsigned char  ASCII_8X16[ASCII_MAX][16]	= {
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
{0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00},/*"!",1*/
{0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*""",2*/
{0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00},/*"#",3*/
{0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00},/*"$",4*/
{0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00},/*"%",5*/
{0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10},/*"&",6*/
{0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
{0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00},/*"(",8*/
{0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00},/*")",9*/
{0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00},/*"*",10*/
{0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00},/*"+",11*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00},/*",",12*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01},/*"-",13*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00},/*".",14*/
{0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00},/*"/",15*/
{0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00},/*"0",16*/
{0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},/*"1",17*/
{0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00},/*"2",18*/
{0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00},/*"3",19*/
{0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00},/*"4",20*/
{0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00},/*"5",21*/
{0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00},/*"6",22*/
{0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00},/*"7",23*/
{0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00},/*"8",24*/
{0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00},/*"9",25*/
{0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00},/*":",26*/
{0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00},/*";",27*/
{0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00},/*"<",28*/
{0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00},/*"=",29*/
{0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00},/*">",30*/
{0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00},/*"?",31*/
{0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00},/*"@",32*/
{0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20},/*"A",33*/
{0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00},/*"B",34*/
{0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00},/*"C",35*/
{0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00},/*"D",36*/
{0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00},/*"E",37*/
{0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00},/*"F",38*/
{0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00},/*"G",39*/
{0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20},/*"H",40*/
{0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},/*"I",41*/
{0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00},/*"J",42*/
{0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00},/*"K",43*/
{0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00},/*"L",44*/
{0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00},/*"M",45*/
{0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00},/*"N",46*/
{0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00},/*"O",47*/
{0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00},/*"P",48*/
{0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00},/*"Q",49*/
{0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20},/*"R",50*/
{0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00},/*"S",51*/
{0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00},/*"T",52*/
{0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00},/*"U",53*/
{0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00},/*"V",54*/
{0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00},/*"W",55*/
{0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20},/*"X",56*/
{0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00},/*"Y",57*/
{0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00},/*"Z",58*/
{0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00},/*"[",59*/
{0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00},/*"\",60*/
{0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00},/*"]",61*/
{0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"^",62*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80},/*"_",63*/
{0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"`",64*/
{0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20},/*"a",65*/
{0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00},/*"b",66*/
{0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00},/*"c",67*/
{0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20},/*"d",68*/
{0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00},/*"e",69*/
{0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},/*"f",70*/
{0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00},/*"g",71*/
{0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20},/*"h",72*/
{0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},/*"i",73*/
{0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00},/*"j",74*/
{0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00},/*"k",75*/
{0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},/*"l",76*/
{0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F},/*"m",77*/
{0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20},/*"n",78*/
{0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00},/*"o",79*/
{0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00},/*"p",80*/
{0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80},/*"q",81*/
{0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00},/*"r",82*/
{0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00},/*"s",83*/
{0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00},/*"t",84*/
{0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20},/*"u",85*/
{0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00},/*"v",86*/
{0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00},/*"w",87*/
{0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00},/*"x",88*/
{0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00},/*"y",89*/
{0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00},/*"z",90*/
{0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40},/*"{",91*/
{0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00},/*"|",92*/
{0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00},/*"}",93*/
{0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"~",94*/
};


const unsigned char  ASCII_8X12[ASCII_MAX][16]	= {

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
{0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x00,0x00,0x00},/*"!",1*/
{0x00,0x08,0x04,0x02,0x08,0x04,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*""",2*/
{0x90,0xF0,0x9C,0x90,0xF0,0x9C,0x90,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x00},/*"#",3*/
{0x00,0x18,0x24,0xFE,0x44,0x8C,0x00,0x00,0x00,0x03,0x02,0x07,0x02,0x01,0x00,0x00},/*"$",4*/
{0x3C,0x24,0xBC,0x60,0xD0,0x4C,0xC0,0x00,0x00,0x02,0x01,0x00,0x03,0x02,0x03,0x00},/*"%",5*/
{0xC0,0x38,0x64,0xA4,0x38,0xE0,0x20,0x00,0x01,0x02,0x02,0x02,0x01,0x02,0x02,0x02},/*"&",6*/
{0x00,0x0A,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
{0x00,0x00,0x00,0xF0,0x0C,0x04,0x02,0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00},/*"(",8*/
{0x00,0x02,0x04,0x08,0xF0,0x00,0x00,0x00,0x00,0x04,0x02,0x01,0x00,0x00,0x00,0x00},/*")",9*/
{0x90,0x60,0x60,0xF8,0x60,0x60,0x90,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00},/*"*",10*/
{0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00},/*"+",11*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x06,0x00,0x00,0x00,0x00,0x00},/*",",12*/
{0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"-",13*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x00,0x00,0x00,0x00,0x00},/*".",14*/
{0x00,0x00,0x00,0x80,0x60,0x18,0x0C,0x02,0x00,0x04,0x03,0x00,0x00,0x00,0x00,0x00},/*"/",15*/
{0x00,0xF0,0x0C,0x04,0x04,0x0C,0xF0,0x00,0x00,0x00,0x03,0x02,0x02,0x03,0x00,0x00},/*"0",16*/
{0x00,0x08,0x08,0xFC,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x03,0x02,0x02,0x00,0x00},/*"1",17*/
{0x00,0x18,0x04,0x84,0x44,0x24,0x18,0x00,0x00,0x03,0x03,0x02,0x02,0x02,0x03,0x00},/*"2",18*/
{0x00,0x08,0x04,0x24,0x24,0x24,0xD8,0x00,0x00,0x01,0x02,0x02,0x02,0x02,0x01,0x00},/*"3",19*/
{0x00,0x60,0x90,0x88,0x84,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x03,0x00,0x00},/*"4",20*/
{0x00,0x3C,0x24,0x24,0x24,0x24,0xC4,0x00,0x00,0x01,0x02,0x02,0x02,0x02,0x01,0x00},/*"5",21*/
{0x00,0xF0,0x48,0x24,0x24,0x2C,0xC0,0x00,0x00,0x01,0x03,0x02,0x02,0x02,0x01,0x00},/*"6",22*/
{0x00,0x0C,0x04,0xC4,0x34,0x0C,0x04,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00},/*"7",23*/
{0x00,0x98,0x64,0x24,0x44,0x64,0x98,0x00,0x00,0x01,0x02,0x02,0x02,0x02,0x01,0x00},/*"8",24*/
{0x00,0x38,0x48,0x44,0x44,0x28,0xF0,0x00,0x00,0x00,0x03,0x02,0x02,0x03,0x00,0x00},/*"9",25*/
{0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x00,0x00,0x00},/*":",26*/
{0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00},/*";",27*/
{0x00,0x20,0x50,0x88,0x08,0x04,0x02,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x00},/*"<",28*/
{0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"=",29*/
{0x00,0x02,0x04,0x08,0x88,0x50,0x20,0x00,0x00,0x02,0x01,0x01,0x00,0x00,0x00,0x00},/*">",30*/
{0x00,0x18,0x14,0x04,0xC4,0x44,0x38,0x00,0x00,0x00,0x00,0x02,0x02,0x00,0x00,0x00},/*"?",31*/
{0xF0,0x08,0xE4,0x94,0xF4,0x8C,0x78,0x00,0x00,0x01,0x02,0x02,0x02,0x02,0x02,0x00},/*"@",32*/
{0x00,0x80,0xF0,0x8C,0x98,0xE0,0x00,0x00,0x02,0x03,0x02,0x00,0x00,0x02,0x03,0x02},/*"A",33*/
{0x04,0xFC,0x24,0x24,0x24,0x58,0xC0,0x00,0x02,0x03,0x02,0x02,0x02,0x02,0x01,0x00},/*"B",34*/
{0xF0,0x08,0x04,0x04,0x04,0x04,0x0C,0x00,0x00,0x01,0x02,0x02,0x02,0x02,0x01,0x00},/*"C",35*/
{0x04,0xFC,0x04,0x04,0x04,0x08,0xF0,0x00,0x02,0x03,0x02,0x02,0x02,0x01,0x00,0x00},/*"D",36*/
{0x04,0xFC,0x24,0x24,0x74,0x04,0x08,0x00,0x02,0x03,0x02,0x02,0x02,0x02,0x01,0x00},/*"E",37*/
{0x04,0xFC,0x24,0x24,0x74,0x04,0x08,0x00,0x02,0x03,0x02,0x00,0x00,0x00,0x00,0x00},/*"F",38*/
{0xF0,0x08,0x04,0x04,0x44,0xCC,0x40,0x00,0x00,0x01,0x02,0x02,0x02,0x01,0x00,0x00},/*"G",39*/
{0x04,0xFC,0x24,0x20,0x20,0x24,0xFC,0x04,0x02,0x03,0x02,0x00,0x00,0x02,0x03,0x02},/*"H",40*/
{0x00,0x04,0x04,0xFC,0x04,0x04,0x00,0x00,0x00,0x02,0x02,0x03,0x02,0x02,0x00,0x00},/*"I",41*/
{0x00,0x00,0x04,0x04,0xFC,0x04,0x04,0x00,0x06,0x04,0x04,0x04,0x03,0x00,0x00,0x00},/*"J",42*/
{0x04,0xFC,0x24,0x60,0x94,0x0C,0x04,0x00,0x02,0x03,0x02,0x00,0x02,0x03,0x02,0x00},/*"K",43*/
{0x04,0xFC,0x04,0x00,0x00,0x00,0x00,0x00,0x02,0x03,0x02,0x02,0x02,0x02,0x03,0x00},/*"L",44*/
{0x04,0xFC,0x3C,0xC0,0x3C,0xFC,0x04,0x00,0x02,0x03,0x00,0x03,0x00,0x03,0x02,0x00},/*"M",45*/
{0x04,0xFC,0x08,0x30,0x40,0x84,0xFC,0x04,0x02,0x03,0x02,0x00,0x00,0x01,0x03,0x00},/*"N",46*/
{0xF0,0x08,0x04,0x04,0x04,0x0C,0xF0,0x00,0x00,0x01,0x02,0x02,0x02,0x01,0x00,0x00},/*"O",47*/
{0x04,0xFC,0x24,0x24,0x24,0x24,0x18,0x00,0x02,0x03,0x02,0x00,0x00,0x00,0x00,0x00},/*"P",48*/
{0xF0,0x08,0x84,0x84,0x04,0x08,0xF0,0x00,0x00,0x01,0x02,0x02,0x03,0x05,0x04,0x00},/*"Q",49*/
{0x04,0xFC,0x24,0x24,0x64,0xA4,0x18,0x00,0x02,0x03,0x02,0x00,0x00,0x01,0x03,0x02},/*"R",50*/
{0x00,0x18,0x24,0x24,0x24,0x44,0x8C,0x00,0x00,0x03,0x02,0x02,0x02,0x02,0x01,0x00},/*"S",51*/
{0x0C,0x04,0x04,0xFC,0x04,0x04,0x0C,0x00,0x00,0x00,0x02,0x03,0x02,0x00,0x00,0x00},/*"T",52*/
{0x04,0xFC,0x04,0x00,0x00,0x04,0xFC,0x04,0x00,0x01,0x02,0x02,0x02,0x02,0x01,0x00},/*"U",53*/
{0x04,0x1C,0xE4,0x00,0xC0,0x74,0x0C,0x04,0x00,0x00,0x00,0x03,0x01,0x00,0x00,0x00},/*"V",54*/
{0x7C,0x84,0x80,0x7C,0xC0,0x84,0x7C,0x00,0x00,0x03,0x01,0x00,0x00,0x03,0x00,0x00},/*"W",55*/
{0x04,0x0C,0x9C,0x60,0x60,0x9C,0x0C,0x04,0x02,0x03,0x03,0x00,0x00,0x03,0x03,0x02},/*"X",56*/
{0x04,0x0C,0x34,0xE0,0x34,0x0C,0x04,0x00,0x00,0x00,0x02,0x03,0x02,0x00,0x00,0x00},/*"Y",57*/
{0x08,0x04,0x84,0x64,0x14,0x0C,0x04,0x00,0x02,0x03,0x02,0x02,0x02,0x02,0x01,0x00},/*"Z",58*/
{0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x07,0x04,0x04,0x04,0x00},/*"[",59*/
{0x00,0x02,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x00},/*"\",60*/
{0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x07,0x00,0x00,0x00},/*"]",61*/
{0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"^",62*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08},/*"_",63*/
{0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"`",64*/
{0x00,0x40,0xA0,0xA0,0xA0,0xA0,0xC0,0x00,0x00,0x01,0x02,0x02,0x02,0x02,0x03,0x02},/*"a",65*/
{0x04,0xFC,0x40,0x20,0x20,0x20,0xC0,0x00,0x00,0x03,0x02,0x02,0x02,0x02,0x01,0x00},/*"b",66*/
{0x00,0xC0,0x60,0x20,0x20,0x20,0x40,0x00,0x00,0x01,0x02,0x02,0x02,0x02,0x01,0x00},/*"c",67*/
{0x00,0xC0,0x40,0x20,0x20,0x24,0xFC,0x00,0x00,0x01,0x02,0x02,0x02,0x02,0x03,0x02},/*"d",68*/
{0x00,0xC0,0xA0,0xA0,0xA0,0xA0,0xC0,0x00,0x00,0x01,0x02,0x02,0x02,0x02,0x02,0x00},/*"e",69*/
{0x00,0x20,0x20,0xF8,0x24,0x24,0x24,0x04,0x00,0x02,0x02,0x03,0x02,0x02,0x00,0x00},/*"f",70*/
{0x00,0x40,0xA0,0xA0,0xA0,0x60,0x20,0x00,0x00,0x07,0x0A,0x0A,0x0A,0x0A,0x04,0x00},/*"g",71*/
{0x04,0xFC,0x40,0x20,0x20,0x20,0xC0,0x00,0x02,0x03,0x02,0x00,0x00,0x02,0x03,0x02},/*"h",72*/
{0x00,0x20,0x24,0xE4,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x03,0x02,0x02,0x00,0x00},/*"i",73*/
{0x00,0x00,0x00,0x20,0x24,0xE4,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x07,0x00,0x00},/*"j",74*/
{0x04,0xFC,0x80,0xC0,0x60,0x20,0x20,0x00,0x02,0x03,0x02,0x00,0x03,0x02,0x02,0x00},/*"k",75*/
{0x00,0x04,0x04,0xFC,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x03,0x02,0x02,0x00,0x00},/*"l",76*/
{0x20,0xE0,0x20,0x20,0xE0,0x20,0x20,0xE0,0x02,0x03,0x02,0x00,0x03,0x02,0x00,0x03},/*"m",77*/
{0x20,0xE0,0x40,0x20,0x20,0x40,0xC0,0x00,0x02,0x03,0x02,0x00,0x00,0x02,0x03,0x02},/*"n",78*/
{0x00,0xC0,0x20,0x20,0x20,0x20,0xC0,0x00,0x00,0x01,0x02,0x02,0x02,0x02,0x01,0x00},/*"o",79*/
{0x20,0xE0,0x20,0x20,0x20,0x40,0xC0,0x00,0x08,0x0F,0x0A,0x02,0x02,0x02,0x01,0x00},/*"p",80*/
{0x00,0xC0,0x20,0x20,0x20,0x20,0xE0,0x00,0x00,0x01,0x02,0x02,0x02,0x0A,0x0F,0x08},/*"q",81*/
{0x20,0x20,0xE0,0x40,0x20,0x20,0x20,0x00,0x02,0x02,0x03,0x02,0x02,0x00,0x00,0x00},/*"r",82*/
{0x00,0x40,0xA0,0xA0,0xA0,0xA0,0x20,0x00,0x00,0x03,0x02,0x02,0x02,0x02,0x01,0x00},/*"s",83*/
{0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x02,0x00,0x00},/*"t",84*/
{0x20,0xE0,0x00,0x00,0x00,0x20,0xE0,0x00,0x00,0x01,0x02,0x02,0x02,0x02,0x03,0x02},/*"u",85*/
{0x20,0x60,0xA0,0x00,0x00,0xE0,0x60,0x20,0x00,0x00,0x01,0x02,0x01,0x00,0x00,0x00},/*"v",86*/
{0xE0,0x20,0x00,0xE0,0x80,0x20,0xE0,0x20,0x00,0x03,0x01,0x00,0x01,0x02,0x01,0x00},/*"w",87*/
{0x00,0x20,0x60,0xC0,0xE0,0x60,0x20,0x00,0x00,0x02,0x03,0x03,0x01,0x03,0x02,0x00},/*"x",88*/
{0x20,0x60,0xA0,0x00,0x00,0xE0,0x60,0x20,0x08,0x08,0x08,0x07,0x03,0x00,0x00,0x00},/*"y",89*/
{0x00,0x60,0x20,0xA0,0xA0,0x60,0x20,0x00,0x00,0x02,0x03,0x03,0x02,0x02,0x03,0x00},/*"z",90*/
{0x00,0x00,0x00,0x00,0x20,0xDE,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04},/*"{",91*/
{0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00},/*"|",92*/
{0x00,0x02,0x02,0xDE,0x20,0x00,0x00,0x00,0x00,0x04,0x04,0x03,0x00,0x00,0x00,0x00},/*"}",93*/
{0x00,0x02,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"~",94*/

};


#endif


//测试

GRAM_ShowString(2,2,"ABCDEF!",FONT16_DEFAULT);	//显示测试
		GRAM_UpAll(); //更新显存到屏幕


你可能感兴趣的:(CortexM3(STM32))