STM32应用 TFT ILI9328液晶显示
#### 硬件
STM32F103C8T6 TFTILI9328 ST-LINKV2下载 杜帮线
### 代码
TFT.C
```c
/****************************************************************************************************
文件功能描述:320x240TFT驱动程序,控制TFT实现汉字,字符显示,画点功能。
****************************************************************************************************/
#include "stm32f10x.h" //STM32器件寄存器定义头文件,必须包含
#include "user_Config.h" //用户配置头文件,用于配置硬件连接资源,位于项目文件夹下
#include "Ascii_8x16.h" //8x16大小字符
#include "Chinese.h" //16x16像素大小的汉字
//**************声明外部函数和变量**************
extern unsigned int Device_code;
/****************************************************************************************************
// 实现功能: 延时
// 输入参数: count 设置延时时间
****************************************************************************************************/
void delayms(unsigned int count)
{
int i,j;
for(i=0;i<count;i++)
{
for(j=0;j<0x640;j++);
}
}
/****************************************************************************************************
// 实现功能: 写命令
// 输入参数: DH 需要输入16bits命令的高8位
// DL 需要输入16bits命令的低8位
****************************************************************************************************/
void Write_Cmd(unsigned char DH,unsigned char DL)
{
CS_CLR;
RS_CLR;
RD_SET;
RW_CLR;
//注意:当使用8位数据口驱动16位数据模式时,使用74HC573作为IO扩展,程序如下
GPIO_Write(DataPort,(u16)(DL | 0xff00)); //送低8位命令给573待锁存
LE_SET; //锁存位
LE_CLR; //断开锁存,位选573的Q7~Q0仍保持
GPIO_Write(DataPort,(u16)(DH | 0xff00)); //送高8位命令给TFT
/*
//如果使用16位数据口驱动16位数据模式,则无需IO扩展,直接将数据送到数据口即可
DataPort_L=DL;
DataPort_H=DH;
*/
RW_SET;
CS_SET;
}
/****************************************************************************************************
// 实现功能: 写数据(2*8bits)
// 输入参数: DH 需要输入16bits数据的高8位
// DL 需要输入16bits数据的低8位
****************************************************************************************************/
void Write_Data(unsigned char DH,unsigned char DL)
{
CS_CLR;
RS_SET;
//注意:当使用8位数据口驱动16位数据模式时,使用74HC573作为IO扩展,程序如下
GPIO_Write(DataPort,(u16)(DL | 0xff00)); //送低8位命令给573待锁存
LE_SET; //锁存位
LE_CLR; //断开锁存,位选573的Q7~Q0仍保持
GPIO_Write(DataPort,(u16)(DH | 0xff00)); //送高8位命令给TFT
/*
//如果使用16位数据口驱动16位数据模式,则无需IO扩展,直接将数据送到数据口即可
DataPort_L=DL;
DataPort_H=DH;
*/
RW_CLR;
RW_SET;
CS_SET;
}
/****************************************************************************************************
// 实现功能: 写数据(16位)
// 输入参数: y 需要输入16bits数据
****************************************************************************************************/
void Write_Data_U16(unsigned int y)
{
unsigned char m,n;
m=y>>8;
n=y;
Write_Data(m,n);
}
/****************************************************************************************************
// 实现功能: 向x寄存器写入y数据
// 输入参数: x 需要输入的命令 16位
// y 需要输入的数据 16位
****************************************************************************************************/
void Write_Cmd_Data (unsigned char x,unsigned int y)
{
unsigned char m,n;
m=y>>8;
n=y;
Write_Cmd(0x00,x);
Write_Data(m,n);
}
/****************************************************************************************************
// 实现功能: 设置坐标
// 输入参数: x0,y0 起始坐标
// x1,y1 结束坐标
****************************************************************************************************/
void LCD_SetPos(unsigned int x0,unsigned int x1,unsigned int y0,unsigned int y1)
{
Write_Cmd_Data(0x50,x0); // Horizontal GRAM Start Address
Write_Cmd_Data(0x51,x1); // Horizontal GRAM End Address
Write_Cmd_Data(0x52,y0); // Vertical GRAM Start Address
Write_Cmd_Data(0x53,y1); // Vertical GRAM Start Address
Write_Cmd_Data(0x20,x0); // GRAM horizontal Address
Write_Cmd_Data(0x21,y0); // GRAM Vertical Address
Write_Cmd (0x00,0x22); // 0x0022,Start to Write Data to GRAM
}
/****************************************************************************************************
// 实现功能: TFT清屏
// 输入参数: bColor 清屏所使用的背景色
****************************************************************************************************/
void CLR_Screen(unsigned int bColor)
{
unsigned int i,j;
LCD_SetPos(0,240,0,320); //320x240,坐标从0开始
for (i=0;i<320;i++)
{
for (j=0;j<240;j++)
Write_Data_U16(bColor);
}
}
/****************************************************************************************************
// 实现功能: 显示Ascii字符
// 输入参数: x 横坐标
// y 纵坐标
// c 需要显示的字符
// fColor 字符颜色
// bColor 字符背景颜色
****************************************************************************************************/
void LCD_PutChar(unsigned int x, unsigned int y, char c, unsigned int fColor, unsigned int bColor)
{
unsigned int i,j;
LCD_SetPos(x,x+8-1,y,y+16-1); //设置字符显示位置
for(i=0; i<16;i++)
{ //循环写入16字节,一个字符为16字节
unsigned char m=Font8x16[(c-0x20)*16+i]; //提取c字符的第i个字节以,c减去0x20是由于Ascii码库中的0~1f被去掉
for(j=0;j<8;j++)
{ //循环写入8位,一个字节为8位
if((m&0x80)==0x80)
{ //判断最高位是否为1
Write_Data_U16(fColor); //最高位为1,写入字符颜色
}
else
{
Write_Data_U16(bColor); //最高位为0,写入背景颜色
}
m<<=1; //左移1位,准备写下一位
}
}
}
/****************************************************************************************************
// 实现功能: 显示16x16汉字
// 输入参数: x 横坐标
// y 纵坐标
// g 需要显示的字符编码
// fColor 字符颜色
// bColor 字符背景颜色
****************************************************************************************************/
void Put16x16(unsigned short x, unsigned short y, unsigned char g[2], unsigned int fColor,unsigned int bColor)
{
unsigned int i,j,k;
LCD_SetPos(x, x+16-1,y, y+16-1); //设置汉字显示位置
for (k=0;k<64;k++) //循环64次,查询汉字字模位置
{
if ((ch16[k].GBK[0]==g[0])&&(ch16[k].GBK[1]==g[1])) //判断第k个汉字的编码是否与输入汉字g[2]相等
{
for(i=0;i<32;i++) //如果相等,既已找到待显示字模位置,循环写入32字节
{
unsigned short m=ch16[k].hz16[i]; //读取32字节中的第i字节
for(j=0;j<8;j++) //循环写入8位数据
{
if((m&0x80)==0x80) Write_Data_U16(fColor); //判断最高位是否为1,最高位为1,写入字符颜色
else Write_Data_U16(bColor); //最高位为0,写入背景颜色
m<<=1; //左移1位,准备写下一位
}
}
}
}
}
/****************************************************************************************************
// 实现功能: 显示中英文字符串
// 输入参数: x 横坐标
// y 纵坐标
// *s 待显示的字符串,例如LCD_PutString(24,16,"123Eee",White,Blue);即把"123Eee"的第一个字符地址赋给指针变量s.
// bColor 字符背景颜色
****************************************************************************************************/
void LCD_PutString(unsigned short x, unsigned short y, unsigned char *s, unsigned int fColor, unsigned int bColor)
{
unsigned char l=0; //显示屏位置增量
while(*s)
{
if( *s < 0x80) //判断s指向的字符串中的某字符的编码值是否小于128,如果小于,即为ASCII字符
{
LCD_PutChar(x+l*8,y,*s,fColor,bColor); //显示该字符
s++;l++; //指针加1,位置加1
}
else
{
Put16x16(x+l*8,y,(unsigned char*)s,fColor,bColor); //显示该汉字
s+=2;l+=2; //因为汉字为编码为2字节,指针加2,显示16x16所以位置加2
}
}
}
/****************************************************************************************************
// 实现功能: 指定位置显示RGB颜色
// 输入参数: x0,y0 起始坐标
// x1,y1 结束坐标
// Color 背景颜色
****************************************************************************************************/
void Show_RGB (unsigned short x0,unsigned short x1,unsigned short y0,unsigned short y1,unsigned int Color)
{
unsigned int i,j;
LCD_SetPos(x0,x1,y0,y1); //横屏这里要进行坐标变换,如果是竖屏,则直接是x0,x1,y0,y1做参数
for (i=y0;i<=y1;i++)
{
for (j=x0;j<=x1;j++)
Write_Data_U16(Color);
}
}
/****************************************************************************************************
// 实现功能: TFT初始化
****************************************************************************************************/
void TFT_Initial(void)
{
RST_SET;
delayms(1); // Delay 1ms
RST_CLR;
delayms(10); // Delay 10ms
RST_SET;
delayms(50); // Delay 50 ms
if(Device_code==0x9320)
{
//************* Start Initial Sequence **********//
Write_Cmd_Data(0x00,0x0001); //Set the OSC bit as ‘1’ to start the internal oscillator
Write_Cmd_Data(0x01,0x0100); // set SS and SM bit
Write_Cmd_Data(0x02,0x0700); // set 1 line inversion
Write_Cmd_Data(0x03,0x1030); //set GRAM Write direction and BGR=1
Write_Cmd_Data(0x04,0x0000); // Resize register
Write_Cmd_Data(0x08,0x0202); // set the back porch and front porch
Write_Cmd_Data(0x09,0x0000); // set non-display area refresh cycle ISC[3:0]
Write_Cmd_Data(0x0A,0x0000); // FMARK function
Write_Cmd_Data(0x0C,0x0000); // RGB interface setting
Write_Cmd_Data(0x0D,0x0000); // Frame marker Position
Write_Cmd_Data(0x0F,0x0000); // RGB interface polarity
delayms(30);
//*************Power On sequence ****************//
Write_Cmd_Data(0x10, 0x16b0); // SAP, BT[3:0], AP, DSTB, SLP, STB
delayms(30);
Write_Cmd_Data(0x11, 0x0007); //Write final user’s setting values to VC bit
Write_Cmd_Data(0x12, 0x013a); // set Internal reference voltage
Write_Cmd_Data(0x13, 0x1a00); // VDV[4:0] for VCOM amplitude
delayms(30);
Write_Cmd_Data(0x29, 0x000c); // Set VCM[5:0] for VCOMH
delayms(30); // Delay 50ms
// ----------- Adjust the Gamma Curve ----------//
Write_Cmd_Data(0x0030, 0x0000);
Write_Cmd_Data(0x0031, 0x0505);
Write_Cmd_Data(0x0032, 0x0304);
Write_Cmd_Data(0x0035, 0x0006);
Write_Cmd_Data(0x0036, 0x0707);
Write_Cmd_Data(0x0037, 0x0105);
Write_Cmd_Data(0x0038, 0x0002);
Write_Cmd_Data(0x0039, 0x0707);
Write_Cmd_Data(0x003C, 0x0704);
Write_Cmd_Data(0x003D, 0x0807);
//------------------ Set GRAM area ---------------//
Write_Cmd_Data(0x0050, 0x0000); // Horizontal GRAM Start Address
Write_Cmd_Data(0x0051, 0x00EF); // Horizontal GRAM End Address
Write_Cmd_Data(0x0052, 0x0000); // Vertical GRAM Start Address
Write_Cmd_Data(0x0053, 0x013F); // Vertical GRAM Start Address
Write_Cmd_Data(0x0060, 0x2700); // Gate Scan Line
Write_Cmd_Data(0x0061, 0x0001); // NDL,VLE, REV
Write_Cmd_Data(0x006A, 0x0000); // set scrolling line
Write_Cmd_Data(0x20, 0x0000); // GRAM horizontal Address
Write_Cmd_Data(0x21, 0x0000); // GRAM Vertical Address
//-------------- Partial Display Control ---------//
Write_Cmd_Data(0x0080, 0x0000);
Write_Cmd_Data(0x0081, 0x0000);
Write_Cmd_Data(0x0082, 0x0000);
Write_Cmd_Data(0x0083, 0x0000);
Write_Cmd_Data(0x0084, 0x0000);
Write_Cmd_Data(0x0085, 0x0000);
//-------------- Panel Control ---------//
Write_Cmd_Data(0x90,0x0010); //Frame Cycle Contral
Write_Cmd_Data(0x92,0x0000); //Panel Interface Contral
Write_Cmd_Data(0x93,0x0003); //Panel Interface Contral 3.
Write_Cmd_Data(0x95,0x0110); //Frame Cycle Contral
Write_Cmd_Data(0x97,0x0000); //
Write_Cmd_Data(0x98,0x0000); //Frame Cycle Contral.
//-------------- Display on ---------//
Write_Cmd_Data(0x07,0x0173);
}
else if(Device_code==0x1505 )
{
//************* Start Initial Sequence **********//
Write_Cmd_Data(0x00,0x0001); //Set the OSC bit as ‘1’ to start the internal oscillator
Write_Cmd_Data(0x01,0x0100); // set SS and SM bit
Write_Cmd_Data(0x02,0x0700); // set 1 line inversion
Write_Cmd_Data(0x03,0x1030); //set GRAM Write direction and BGR=1
Write_Cmd_Data(0x04,0x0000); // Resize register
Write_Cmd_Data(0x08,0x0202); // set the back porch and front porch
Write_Cmd_Data(0x09,0x0000); // set non-display area refresh cycle ISC[3:0]
Write_Cmd_Data(0x0A,0x0000); // FMARK function
Write_Cmd_Data(0x0C,0x0000); // RGB interface setting
Write_Cmd_Data(0x0D,0x0000); // Frame marker Position
Write_Cmd_Data(0x0F,0x0000); // RGB interface polarity
delayms(30);
//*************Power On sequence ****************//
Write_Cmd_Data(0x10, 0x16b0); // SAP, BT[3:0], AP, DSTB, SLP, STB
delayms(30);
Write_Cmd_Data(0x11, 0x0007); //Write final user’s setting values to VC bit
Write_Cmd_Data(0x12, 0x013a); // set Internal reference voltage
Write_Cmd_Data(0x13, 0x1a00); // VDV[4:0] for VCOM amplitude
delayms(30);
Write_Cmd_Data(0x29, 0x000c); // Set VCM[5:0] for VCOMH
delayms(30); // Delay 50ms
// ----------- Adjust the Gamma Curve ----------//
Write_Cmd_Data(0x0030, 0x0000);
Write_Cmd_Data(0x0031, 0x0505);
Write_Cmd_Data(0x0032, 0x0304);
Write_Cmd_Data(0x0035, 0x0006);
Write_Cmd_Data(0x0036, 0x0707);
Write_Cmd_Data(0x0037, 0x0105);
Write_Cmd_Data(0x0038, 0x0002);
Write_Cmd_Data(0x0039, 0x0707);
Write_Cmd_Data(0x003C, 0x0704);
Write_Cmd_Data(0x003D, 0x0807);
//------------------ Set GRAM area ---------------//
Write_Cmd_Data(0x0050, 0x0000); // Horizontal GRAM Start Address
Write_Cmd_Data(0x0051, 0x00EF); // Horizontal GRAM End Address
Write_Cmd_Data(0x0052, 0x0000); // Vertical GRAM Start Address
Write_Cmd_Data(0x0053, 0x013F); // Vertical GRAM Start Address
Write_Cmd_Data(0x0060, 0x2700); // Gate Scan Line
Write_Cmd_Data(0x0061, 0x0001); // NDL,VLE, REV
Write_Cmd_Data(0x006A, 0x2700); // set scrolling line
Write_Cmd_Data(0x20, 0x0000); // GRAM horizontal Address
Write_Cmd_Data(0x21, 0x0000); // GRAM Vertical Address
//-------------- Partial Display Control ---------//
Write_Cmd_Data(0x0080, 0x0000);
Write_Cmd_Data(0x0081, 0x0000);
Write_Cmd_Data(0x0082, 0x0000);
Write_Cmd_Data(0x0083, 0x0000);
Write_Cmd_Data(0x0084, 0x0000);
Write_Cmd_Data(0x0085, 0x0000);
//-------------- Panel Control ---------//
Write_Cmd_Data(0x90,0x0010); //Frame Cycle Contral
Write_Cmd_Data(0x92,0x0000); //Panel Interface Contral
Write_Cmd_Data(0x93,0x0003); //Panel Interface Contral 3.
Write_Cmd_Data(0x95,0x0110); //Frame Cycle Contral
Write_Cmd_Data(0x97,0x0000); //
Write_Cmd_Data(0x98,0x0000); //Frame Cycle Contral.
//-------------- Display on ---------//
Write_Cmd_Data(0x07,0x0173);
}
else if(Device_code==0x9328)
{
//************* Start Initial Sequence **********//
Write_Cmd_Data(0x0001,0x0100); //set SS and SM bit //设置扫描方向 100
Write_Cmd_Data(0x0002,0x0700); //EOR=1 and B/C=1 to set the line inversion //设置行反转
Write_Cmd_Data(0x0003,0x1030); //set Entry Mode //设置进入模式 1030
Write_Cmd_Data(0x0004,0x0000); //
Write_Cmd_Data(0x00A4,0x0001);
Write_Cmd_Data(0x0008,0x0202); // set the back porch and front porch
Write_Cmd_Data(0x0009,0x0000); // set non-display area refresh cycle ISC[3:0]
Write_Cmd_Data(0x000A,0x0000); // FMARK function
Write_Cmd_Data(0x000C,0x0000); // RGB interface setting
Write_Cmd_Data(0x000D, 0x0000); // Frame marker Position
Write_Cmd_Data(0x000F, 0x0000); // RGB interface polarity
//*************Power On sequence ****************//
Write_Cmd_Data(0x0010, 0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB
Write_Cmd_Data(0x0011, 0x0007); // DC1[2:0], DC0[2:0], VC[2:0]
Write_Cmd_Data(0x0012, 0x0000); // VREG1OUT voltage
Write_Cmd_Data(0x0013, 0x0000); // VDV[4:0] for VCOM amplitude
delayms(30);
Write_Cmd_Data(0x0010, 0x1690); // SAP, BT[3:0], AP, DSTB, SLP, STB
Write_Cmd_Data(0x0011, 0x0227); // R11h=0x0221 at VCI=3.3V, DC1[2:0], DC0[2:0], VC[2:0]
delayms(30);
Write_Cmd_Data(0x0012, 0x001C); // External reference voltage= Vci;
delayms(30);
Write_Cmd_Data(0x0013, 0x1800); // R13=1200 when R12=009D;VDV[4:0] for VCOM amplitude
Write_Cmd_Data(0x0029, 0x001C); // R29=000C when R12=009D;VCM[5:0] for VCOMH
Write_Cmd_Data(0x002B, 0x000D); // Frame Rate = 91Hz
delayms(30);
Write_Cmd_Data(0x0020, 0x0000); // GRAM horizontal Address
Write_Cmd_Data(0x0021, 0x0000); // GRAM Vertical Address
// ----------- Adjust the Gamma Curve ----------//
Write_Cmd_Data(0x0030, 0x0007);
Write_Cmd_Data(0x0031, 0x0302);
Write_Cmd_Data(0x0032, 0x0105);
Write_Cmd_Data(0x0035, 0x0206);
Write_Cmd_Data(0x0036, 0x0808);
Write_Cmd_Data(0x0037, 0x0206);
Write_Cmd_Data(0x0038, 0x0504);
Write_Cmd_Data(0x0039, 0x0007);
Write_Cmd_Data(0x003C, 0x0105);
Write_Cmd_Data(0x003D, 0x0808);
//------------------ Set GRAM area ---------------//
Write_Cmd_Data(0x0050, 0x0000); // Horizontal GRAM Start Address
Write_Cmd_Data(0x0051, 0x00EF); // Horizontal GRAM End Address
Write_Cmd_Data(0x0052, 0x0000); // Vertical GRAM Start Address
delayms(30);
Write_Cmd_Data(0x0053, 0x013F); // Vertical GRAM Start Address
delayms(30);
Write_Cmd_Data(0x0060, 0xA700); // Gate Scan Line
Write_Cmd_Data(0x0061, 0x0001); // NDL,VLE, REV
Write_Cmd_Data(0x006A, 0x0000); // set scrolling line
//-------------- Partial Display Control ---------//
Write_Cmd_Data(0x0080, 0x0000);
Write_Cmd_Data(0x0081, 0x0000);
Write_Cmd_Data(0x0082,0x0000);
Write_Cmd_Data(0x0083,0x0000);
Write_Cmd_Data(0x0084,0x0000);
Write_Cmd_Data(0x0085,0x0000);
//-------------- Panel Control -------------------//
Write_Cmd_Data(0x0090, 0x0010);
Write_Cmd_Data(0x0092, 0x0000);
Write_Cmd_Data(0x0093, 0x0003);
Write_Cmd_Data(0x0095, 0x0110);
Write_Cmd_Data(0x0097, 0x0000);
Write_Cmd_Data(0x0098, 0x0000);
Write_Cmd_Data(0x0007, 0x0133); // 262K color and display ON
}
}
/****************************************************************************************************
// 实现功能: 画点
// 输入参数: x,y 需要画点坐标
// color 点的颜色
****************************************************************************************************/
void Put_pixel(unsigned int x,unsigned int y,unsigned int color)
{
LCD_SetPos(x,x,y,y); //横屏这里要进行坐标变换,如果是竖屏,则直接是x0,x1,y0,y1做参数
Write_Data_U16(color); //在指定点写入颜色数据
}
```
TFT.H
```c
#ifndef uchar
#define uchar unsigned char
#endif
#ifndef uint
#define uint unsigned int
#endif
unsigned char pic[];
void TFT_Initial(void);
void show_colour_bar (void);
void Write_Cmd_Data(unsigned char x, unsigned int y);
void Write_Cmd(unsigned char DH,unsigned char DL);
void Write_Data(unsigned char DH,unsigned char DL);
void delayms(unsigned int tt);
void show_photo(void);
void Show_RGB (unsigned int x0,unsigned int x1,unsigned int y0,unsigned int y1,unsigned int Color);
void Write_Data_U16(unsigned int y);
void CLR_Screen(unsigned int bColor);
void PutGB3232(unsigned short x, unsigned short y, unsigned char c[2], unsigned int fColor,unsigned int bColor);
void LCD_PutChar(unsigned short x, unsigned short y, char c, unsigned int fColor, unsigned int bColor);
void LCD_PutString(unsigned short x, unsigned short y, unsigned char *s, unsigned int fColor, unsigned int bColor);
void LCD_PutString24(unsigned short x, unsigned short y, unsigned char *s, unsigned int fColor, unsigned int bColor);
void LCD_PutChar8x8(unsigned short x, unsigned short y, char c, unsigned int fColor, unsigned int bColor);
void Put16x16(unsigned short x, unsigned short y, unsigned char g[2], unsigned int fColor,unsigned int bColor);
void Put_pixel(unsigned int x,unsigned int y,unsigned int color);
void address_set(unsigned int x1,unsigned int y1,unsigned int x2,unsigned int y2);
void LCD_SetPos(unsigned short x0,unsigned short x1,unsigned short y0,unsigned short y1);
void line(int x1,int y1,int x2,int y2,int color);
void draw_circle(int x, int y, int r, int color);
void LCD_PutSingleChar(unsigned int x, unsigned int y, char c, unsigned int fColor, unsigned int bColor);
void Line( uchar X0,
uchar Y0,
uchar X1,
uchar Y1,
unsigned int color);
void Rectangle( uchar left,
uchar top,
uchar right,
uchar bottom,
unsigned int color);
void Bar( uchar left,
uchar top,
uchar right,
uchar bottom,
unsigned int color);
```
user_Config.h
```c
/*2.8寸TFT触摸屏接口定义*/
#define GPIO_TFT_DATA GPIOA //数据口PA0~PA7
#define RCC_GPIO_TFT RCC_APB2Periph_GPIOA
#define GPIO_CTRB GPIOB //控制口PB8~PB13
#define RCC_GPIO_CTRB RCC_APB2Periph_GPIOB
#define RS_CLR GPIO_ResetBits(GPIO_CTRB, GPIO_Pin_13) //RS置低
#define RS_SET GPIO_SetBits(GPIO_CTRB, GPIO_Pin_13) //RS置高
#define RW_CLR GPIO_ResetBits(GPIO_CTRB, GPIO_Pin_12) //RW置低
#define RW_SET GPIO_SetBits(GPIO_CTRB, GPIO_Pin_12) //RW置高
#define RD_CLR GPIO_ResetBits(GPIO_CTRB, GPIO_Pin_11) //E RD置低
#define RD_SET GPIO_SetBits(GPIO_CTRB, GPIO_Pin_11) //E ED置高
#define CS_CLR GPIO_ResetBits(GPIO_CTRB, GPIO_Pin_10) //CS置低
#define CS_SET GPIO_SetBits(GPIO_CTRB, GPIO_Pin_10) //CS置高
#define RST_CLR GPIO_ResetBits(GPIO_CTRB, GPIO_Pin_9) //RST置低
#define RST_SET GPIO_SetBits(GPIO_CTRB, GPIO_Pin_9) //RST置高
#define LE_CLR GPIO_ResetBits(GPIO_CTRB, GPIO_Pin_8) //LE置低
#define LE_SET GPIO_SetBits(GPIO_CTRB, GPIO_Pin_8) //LE置高
#define DataPort GPIOA //PA口为数据口
#define D0 GPIO_Pin_0 //D0使用的GPIO管脚
#define D1 GPIO_Pin_1 //D1使用的GPIO管脚
#define D2 GPIO_Pin_2 //D2使用的GPIO管脚
#define D3 GPIO_Pin_3 //D3使用的GPIO管脚
#define D4 GPIO_Pin_4 //D4使用的GPIO管脚
#define D5 GPIO_Pin_5 //D5使用的GPIO管脚
#define D6 GPIO_Pin_6 //D6使用的GPIO管脚
#define D7 GPIO_Pin_7 //D7使用的GPIO管脚
/*全局变量-颜色代码*/
#define White 0xFFFF //显示颜色代码
#define Black 0x0000
#define Blue 0x001F
#define Blue2 0x051F
#define Red 0xF800
#define Magenta 0xF81F
#define Green 0x07E0
#define Cyan 0x7FFF
#define Yellow 0xFFE0
/*函数声明区*/
void RCC_Configuration(void);
void NVIC_Configuration(void);
void Delay(vu32 nCount);
```
Ascii_8x16.h
```c
//ASCII码的0x20~0x7f,0x00~0x1f为控制命令,所以被去掉
const unsigned char Font8x16[] =
{
/*-- 文字: ASCII值0x20--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-- 文字: ! ASCII值0x21--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x18,0x18,0x00,0x00,
/*-- 文字: " ASCII值0x22--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x12,0x36,0x24,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-- 文字: # ASCII值0x23--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x24,0x24,0x24,0xFE,0x48,0x48,0x48,0xFE,0x48,0x48,0x48,0x00,0x00,
/*-- 文字: $ ASCII值0x24--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x10,0x38,0x54,0x54,0x50,0x30,0x18,0x14,0x14,0x54,0x54,0x38,0x10,0x10,
/*-- 文字: % ASCII值0x25--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x44,0xA4,0xA8,0xA8,0xA8,0x54,0x1A,0x2A,0x2A,0x2A,0x44,0x00,0x00,
/*-- 文字: & ASCII值0x26--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x30,0x48,0x48,0x48,0x50,0x6E,0xA4,0x94,0x88,0x89,0x76,0x00,0x00,
/*-- 文字: ' ASCII值0x27--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x60,0x60,0x20,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-- 文字: ( ASCII值0x28--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x02,0x04,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x08,0x04,0x02,0x00,
/*-- 文字: ) ASCII值0x29--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x40,0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40,0x00,
/*-- 文字: * ASCII值0x2a--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x10,0x10,0xD6,0x38,0x38,0xD6,0x10,0x10,0x00,0x00,0x00,0x00,
/*-- 文字: + ASCII值0x2b--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x00,0x00,0x00,
/*-- 文字: , ASCII值0x2c--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x20,0xC0,
/*-- 文字: - ASCII值0x2d--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-- 文字: . ASCII值0x2e--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,
/*-- 文字: / ASCII值0x2f--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x01,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,
/*-- 文字: 0 ASCII值0x30--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18,0x00,0x00,
/*-- 文字: 1 ASCII值0x31--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x10,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,
/*-- 文字: 2 ASCII值0x32--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x04,0x04,0x08,0x10,0x20,0x42,0x7E,0x00,0x00,
/*-- 文字: 3 ASCII值0x33--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x3C,0x42,0x42,0x04,0x18,0x04,0x02,0x02,0x42,0x44,0x38,0x00,0x00,
/*-- 文字: 4 ASCII值0x34--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x04,0x0C,0x14,0x24,0x24,0x44,0x44,0x7E,0x04,0x04,0x1E,0x00,0x00,
/*-- 文字: 5 ASCII值0x35--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x58,0x64,0x02,0x02,0x42,0x44,0x38,0x00,0x00,
/*-- 文字: 6 ASCII值0x36--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x1C,0x24,0x40,0x40,0x58,0x64,0x42,0x42,0x42,0x24,0x18,0x00,0x00,
/*-- 文字: 7 ASCII值0x37--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x7E,0x44,0x44,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,
/*-- 文字: 8 ASCII值0x38--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x24,0x18,0x24,0x42,0x42,0x42,0x3C,0x00,0x00,
/*-- 文字: 9 ASCII值0x39--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x26,0x1A,0x02,0x02,0x24,0x38,0x00,0x00,
/*-- 文字: : ASCII值0x3a--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,
/*-- 文字: ; ASCII值0x3b--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x20,
/*-- 文字: < ASCII值0x3c--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x02,0x00,0x00,
/*-- 文字: = ASCII值0x3d--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,
/*-- 文字: > ASCII值0x3e--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x20,0x40,0x00,0x00,
/*-- 文字: ? ASCII值0x3f--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x3C,0x42,0x42,0x62,0x02,0x04,0x08,0x08,0x00,0x18,0x18,0x00,0x00,
/*-- 文字: @ ASCII值0x40--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x38,0x44,0x5A,0xAA,0xAA,0xAA,0xAA,0xB4,0x42,0x44,0x38,0x00,0x00,
/*-- 文字: A ASCII值0x41--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x10,0x10,0x18,0x28,0x28,0x24,0x3C,0x44,0x42,0x42,0xE7,0x00,0x00,
/*-- 文字: B ASCII值0x42--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0xF8,0x44,0x44,0x44,0x78,0x44,0x42,0x42,0x42,0x44,0xF8,0x00,0x00,
/*-- 文字: C ASCII值0x43--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x3E,0x42,0x42,0x80,0x80,0x80,0x80,0x80,0x42,0x44,0x38,0x00,0x00,
/*-- 文字: D ASCII值0x44--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0xF8,0x44,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x44,0xF8,0x00,0x00,
/*-- 文字: E ASCII值0x45--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0xFC,0x42,0x48,0x48,0x78,0x48,0x48,0x40,0x42,0x42,0xFC,0x00,0x00,
/*-- 文字: F ASCII值0x46--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0xFC,0x42,0x48,0x48,0x78,0x48,0x48,0x40,0x40,0x40,0xE0,0x00,0x00,
/*-- 文字: G ASCII值0x47--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x3C,0x44,0x44,0x80,0x80,0x80,0x8E,0x84,0x44,0x44,0x38,0x00,0x00,
/*-- 文字: H ASCII值0x48--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0xE7,0x42,0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,
/*-- 文字: I ASCII值0x49--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,
/*-- 文字: J ASCII值0x4a--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x3E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x88,0xF0,
/*-- 文字: K ASCII值0x4b--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0xEE,0x44,0x48,0x50,0x70,0x50,0x48,0x48,0x44,0x44,0xEE,0x00,0x00,
/*-- 文字: L ASCII值0x4c--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0xE0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x42,0xFE,0x00,0x00,
/*-- 文字: M ASCII值0x4d--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0xEE,0x6C,0x6C,0x6C,0x6C,0x54,0x54,0x54,0x54,0x54,0xD6,0x00,0x00,
/*-- 文字: N ASCII值0x4e--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0xC7,0x62,0x62,0x52,0x52,0x4A,0x4A,0x4A,0x46,0x46,0xE2,0x00,0x00,
/*-- 文字: O ASCII值0x4f--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x44,0x38,0x00,0x00,
/*-- 文字: P ASCII值0x50--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0xFC,0x42,0x42,0x42,0x42,0x7C,0x40,0x40,0x40,0x40,0xE0,0x00,0x00,
/*-- 文字: Q ASCII值0x51--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x82,0xB2,0xCA,0x4C,0x38,0x06,0x00,
/*-- 文字: R ASCII值0x52--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0xFC,0x42,0x42,0x42,0x7C,0x48,0x48,0x44,0x44,0x42,0xE3,0x00,0x00,
/*-- 文字: S ASCII值0x53--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x3E,0x42,0x42,0x40,0x20,0x18,0x04,0x02,0x42,0x42,0x7C,0x00,0x00,
/*-- 文字: T ASCII值0x54--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0xFE,0x92,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,
/*-- 文字: U ASCII值0x55--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0xE7,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,
/*-- 文字: V ASCII值0x56--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0xE7,0x42,0x42,0x44,0x24,0x24,0x28,0x28,0x18,0x10,0x10,0x00,0x00,
/*-- 文字: W ASCII值0x57--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0xD6,0x92,0x92,0x92,0x92,0xAA,0xAA,0x6C,0x44,0x44,0x44,0x00,0x00,
/*-- 文字: X ASCII值0x58--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x18,0x18,0x18,0x24,0x24,0x42,0xE7,0x00,0x00,
/*-- 文字: Y ASCII值0x59--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0xEE,0x44,0x44,0x28,0x28,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,
/*-- 文字: Z ASCII值0x5a--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x7E,0x84,0x04,0x08,0x08,0x10,0x20,0x20,0x42,0x42,0xFC,0x00,0x00,
/*-- 文字: [ ASCII值0x5b--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x1E,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1E,0x00,
/*-- 文字: \ ASCII值0x5c--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x10,0x08,0x08,0x04,0x04,0x04,0x02,0x02,
/*-- 文字: ] ASCII值0x5d--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x78,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x78,0x00,
/*-- 文字: ^ ASCII值0x5e--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x1C,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-- 文字: _ ASCII值0x5f--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
/*-- 文字: ` ASCII值0x60--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-- 文字: a ASCII值0x61--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x1E,0x22,0x42,0x42,0x3F,0x00,0x00,
/*-- 文字: b ASCII值0x62--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0xC0,0x40,0x40,0x40,0x58,0x64,0x42,0x42,0x42,0x64,0x58,0x00,0x00,
/*-- 文字: c ASCII值0x63--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x40,0x40,0x40,0x22,0x1C,0x00,0x00,
/*-- 文字: d ASCII值0x64--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x06,0x02,0x02,0x02,0x1E,0x22,0x42,0x42,0x42,0x26,0x1B,0x00,0x00,
/*-- 文字: e ASCII值0x65--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x7E,0x40,0x40,0x42,0x3C,0x00,0x00,
/*-- 文字: f ASCII值0x66--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x0F,0x11,0x10,0x10,0x7E,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,
/*-- 文字: g ASCII值0x67--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x44,0x44,0x38,0x40,0x3C,0x42,0x42,0x3C,
/*-- 文字: h ASCII值0x68--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0xC0,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,
/*-- 文字: i ASCII值0x69--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,
/*-- 文字: j ASCII值0x6a--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x0C,0x0C,0x00,0x00,0x1C,0x04,0x04,0x04,0x04,0x04,0x04,0x44,0x78,
/*-- 文字: k ASCII值0x6b--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0xC0,0x40,0x40,0x40,0x4E,0x48,0x50,0x68,0x48,0x44,0xEE,0x00,0x00,
/*-- 文字: l ASCII值0x6c--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,
/*-- 文字: m ASCII值0x6d--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x49,0x49,0x49,0x49,0x49,0xED,0x00,0x00,
/*-- 文字: n ASCII值0x6e--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xDC,0x62,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,
/*-- 文字: o ASCII值0x6f--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,
/*-- 文字: p ASCII值0x70--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD8,0x64,0x42,0x42,0x42,0x44,0x78,0x40,0xE0,
/*-- 文字: q ASCII值0x71--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x22,0x42,0x42,0x42,0x22,0x1E,0x02,0x07,
/*-- 文字: r ASCII值0x72--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0x32,0x20,0x20,0x20,0x20,0xF8,0x00,0x00,
/*-- 文字: s ASCII值0x73--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x40,0x3C,0x02,0x42,0x7C,0x00,0x00,
/*-- 文字: t ASCII值0x74--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x10,0x10,0x10,0x0C,0x00,0x00,
/*-- 文字: u ASCII值0x75--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC6,0x42,0x42,0x42,0x42,0x46,0x3B,0x00,0x00,
/*-- 文字: v ASCII值0x76--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x28,0x10,0x10,0x00,0x00,
/*-- 文字: w ASCII值0x77--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD7,0x92,0x92,0xAA,0xAA,0x44,0x44,0x00,0x00,
/*-- 文字: x ASCII值0x78--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x24,0x18,0x18,0x18,0x24,0x76,0x00,0x00,
/*-- 文字: y ASCII值0x79--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x28,0x18,0x10,0x10,0xE0,
/*-- 文字: z ASCII值0x7a--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x44,0x08,0x10,0x10,0x22,0x7E,0x00,0x00,
/*-- 文字: { ASCII值0x7b--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x03,0x04,0x04,0x04,0x04,0x04,0x08,0x04,0x04,0x04,0x04,0x04,0x04,0x03,0x00,
/*-- 文字: | ASCII值0x7c--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
/*-- 文字: } ASCII值0x7d--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x60,0x10,0x10,0x10,0x10,0x10,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x60,0x00,
/*-- 文字: ~ ASCII值0x7e--*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
0x30,0x4C,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-- 文字: ASCII值0x7f--*/
/*-- Fixedsys11; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x00,0x7E,0x7E,0x7E,0x7E,0x7E,0x7E,0x7E,0x7E,0x7E,0x00,0x00,0x00,0x00
};
```
Chinese.h
```c
/////////////////////////////////////////////////////////////////////////
// 汉字取模步骤:1、在文字输入区输入汉字;2、在输入区鼠标右键选择字体,字体选Fixedsys,大小选12号,即16x16,后点确定
// 3、键盘输入CTRL+ENTER组合键,4、点击左边菜单"取模方式-》C51格式",即会在点阵生成区中显示结果。
//注意:软件默认为横向取模,如果需要修改取模方式,点击左边菜单"参数设置-》其他选项"即可修改.
/////////////////////////////////////////////////////////////////////////
// ------------------ 汉字字模数据结构体定义 ------------------------ //
const struct hz16_tab //结构体名hz16_tab
{
unsigned char GBK[2]; //编译器在编译汉字时会编译成GBK码,每个汉字为两字节,例如"北"字内码为0xb1b1.
unsigned char hz16[32]; //每个16x16汉字为16x16/8=32字节
} ch16[] = //数据表
{
"合",0x01,0x00,0x02,0x80,0x04,0x40,0x08,0x20,0x10,0x18,0x20,0x2E,0xDF,0xF4,0x00,0x00,
0x00,0x00,0x1F,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x1F,0xF0,0x10,0x10,0x00,0x00,
/*-- 文字: 肥 --*/
/*-- Fixedsys12; 此字体下对应的点阵为:宽x高=16x16 --*/
"肥",0x00,0x00,0x3D,0xFC,0x25,0x24,0x25,0x24,0x3D,0x24,0x25,0x24,0x25,0xFC,0x25,0x04,
0x3D,0x00,0x25,0x00,0x25,0x00,0x25,0x00,0x45,0x02,0x55,0x02,0x88,0xFE,0x00,0x00,
/*-- 文字: 炜 --*/
/*-- Fixedsys12; 此字体下对应的点阵为:宽x高=16x16 --*/
"炜",0x10,0x40,0x10,0x40,0x17,0xFE,0x14,0x40,0x54,0x40,0x5B,0xFC,0x50,0x40,0x90,0x40,
0x17,0xFE,0x10,0x42,0x28,0x42,0x24,0x42,0x44,0x54,0x40,0x48,0x80,0x40,0x00,0x40,
/*-- 文字: 煌 --*/
/*-- Fixedsys12; 此字体下对应的点阵为:宽x高=16x16 --*/
"煌",0x10,0x40,0x10,0x80,0x13,0xFC,0x16,0x04,0x1B,0xFC,0x52,0x04,0x53,0xFC,0x90,0x00,
0x13,0xFC,0x30,0x40,0x2B,0xFC,0x24,0x40,0x44,0x44,0x47,0xFE,0x80,0x00,0x00,0x00,
/*-- 文字: 电 --*/
/*-- Fixedsys12; 此字体下对应的点阵为:宽x高=16x16 --*/
"电",0x01,0x00,0x01,0x00,0x01,0x00,0x3F,0xF8,0x21,0x08,0x21,0x08,0x3F,0xF8,0x21,0x08,
0x21,0x08,0x21,0x08,0x3F,0xF8,0x21,0x08,0x01,0x02,0x01,0x02,0x00,0xFE,0x00,0x00,
/*-- 文字: 子 --*/
/*-- Fixedsys12; 此字体下对应的点阵为:宽x高=16x16 --*/
"子",0x00,0x00,0x3F,0xF0,0x00,0x20,0x00,0x40,0x00,0x80,0x01,0x00,0x01,0x00,0x01,0x04,
0xFF,0xFE,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x05,0x00,0x02,0x00,
/*-- 文字: 有 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
"有",0x01,0x00,0x01,0x00,0x7F,0xFE,0x02,0x00,0x04,0x00,0x0F,0xF0,0x18,0x10,0x28,0x10,
0x4F,0xF0,0x88,0x10,0x08,0x10,0x0F,0xF0,0x08,0x10,0x08,0x90,0x08,0x70,0x08,0x20,
/*-- 文字: 限 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
"限",0x00,0x00,0xFB,0xF8,0x92,0x08,0x93,0xF8,0xA2,0x08,0xA2,0x08,0x93,0xF8,0x8A,0x80,
0x8A,0x48,0xAA,0x50,0x92,0x20,0x82,0x20,0x82,0x10,0x82,0x8E,0x83,0x04,0x82,0x00,
/*-- 文字: 公 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
"公",0x00,0x00,0x04,0x40,0x06,0x40,0x04,0x40,0x08,0x20,0x08,0x10,0x10,0x18,0x22,0x0E,
0x43,0x04,0x02,0x00,0x04,0x20,0x08,0x10,0x11,0xF8,0x3F,0x18,0x10,0x10,0x00,0x00,
/*-- 文字: 司 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
"司",0x00,0x00,0x3F,0xFC,0x00,0x04,0x00,0x04,0x7F,0xE4,0x00,0x04,0x00,0x04,0x3F,0xC4,
0x20,0x44,0x20,0x44,0x3F,0xC4,0x20,0x44,0x20,0x04,0x00,0x14,0x00,0x08,0x00,0x00,
/*-- 文字: 面 --*/
/*-- Fixedsys12; 此字体下对应的点阵为:宽x高=16x16 --*/
"面",0x00,0x00,0x7F,0xFE,0x02,0x00,0x04,0x00,0x3F,0xFC,0x24,0x44,0x24,0x44,0x27,0xC4,
0x24,0x44,0x24,0x44,0x27,0xC4,0x24,0x44,0x24,0x44,0x3F,0xFC,0x20,0x04,0x00,0x00,
/*-- 文字: 向 --*/
/*-- Fixedsys12; 此字体下对应的点阵为:宽x高=16x16 --*/
"向",0x02,0x00,0x04,0x00,0x3F,0xFC,0x20,0x04,0x20,0x04,0x27,0xE4,0x24,0x24,0x24,0x24,
0x24,0x24,0x24,0x24,0x27,0xE4,0x24,0x24,0x20,0x04,0x20,0x14,0x20,0x08,0x00,0x00,
/*-- 文字: 教 --*/
/*-- Fixedsys12; 此字体下对应的点阵为:宽x高=16x16 --*/
"教",0x08,0x20,0x08,0x20,0x7F,0x20,0x0A,0x7E,0xFF,0xC4,0x08,0x44,0x10,0xC4,0x3E,0x48,
0xC4,0x28,0x08,0x28,0x0F,0x10,0xF8,0x10,0x08,0x28,0x08,0xC8,0x2B,0x06,0x10,0x04,
/*-- 文字: 学 --*/
/*-- Fixedsys12; 此字体下对应的点阵为:宽x高=16x16 --*/
"学",0x01,0x08,0x10,0x8C,0x0C,0xC8,0x08,0x90,0x7F,0xFE,0x40,0x04,0x8F,0xE8,0x00,0x40,
0x00,0x80,0x7F,0xFE,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x02,0x80,0x01,0x00,
/*-- 文字: 面 --*/
/*-- Fixedsys12; 此字体下对应的点阵为:宽x高=16x16 --*/
"面",0x00,0x00,0x7F,0xFE,0x02,0x00,0x04,0x00,0x3F,0xFC,0x24,0x44,0x24,0x44,0x27,0xC4,
0x24,0x44,0x24,0x44,0x27,0xC4,0x24,0x44,0x24,0x44,0x3F,0xFC,0x20,0x04,0x00,0x00,
/*-- 文字: 向 --*/
/*-- Fixedsys12; 此字体下对应的点阵为:宽x高=16x16 --*/
"向",0x02,0x00,0x04,0x00,0x3F,0xFC,0x20,0x04,0x20,0x04,0x27,0xE4,0x24,0x24,0x24,0x24,
0x24,0x24,0x24,0x24,0x27,0xE4,0x24,0x24,0x20,0x04,0x20,0x14,0x20,0x08,0x00,0x00,
/*-- 文字: 开 --*/
/*-- Fixedsys12; 此字体下对应的点阵为:宽x高=16x16 --*/
"开",0x00,0x00,0x7F,0xFE,0x04,0x20,0x04,0x20,0x04,0x20,0x04,0x20,0xFF,0xFE,0x04,0x20,
0x04,0x20,0x04,0x20,0x08,0x20,0x08,0x20,0x10,0x20,0x20,0x20,0x40,0x20,0x00,0x00,
/*-- 文字: 发 --*/
/*-- Fixedsys12; 此字体下对应的点阵为:宽x高=16x16 --*/
"发",0x02,0x00,0x22,0x40,0x22,0x30,0x22,0x10,0x7F,0xFE,0x24,0x00,0x04,0x00,0x07,0xE0,
0x0C,0x20,0x0A,0x20,0x0A,0x20,0x11,0x40,0x20,0x80,0x41,0x60,0x86,0x1C,0x18,0x08
};
```
|