一、LCD12864简介
- 带中文字库的128X64 是一种具有4 位/8 位并行、2 线或3 线串行多种接口方式
- 显示分辨率为128×64, 内置8192 个1616 点汉字,和128 个168 点ASCII 字符集
二、引脚介绍
1、LCD12864引脚
LCD12864有16脚和20脚两种,但引脚功能都差不多,重要的也就那几个引脚,下图是20引脚的LCD12864的引脚描述: 模块有串行和并行两种方式,由于我用的是串行方式,所以下面的介绍都是串行方式的。
2、串行控制引脚
- 引脚
- 1 VSS 电源负极
- 2 VDD 电源正极
- 4 CS 片选引脚 高电位可接受数据,低电位锁存
- 5 SID 串行数据输入端
- 6 CLK 串行同步时钟
- 可选引脚
- 3 V0 调节屏幕亮度
- 15 PSB 低电平有效 其中低电平为串口方式 ,如果只用串口通信模式 可以将PSB引脚飞线与地线相连 即固定低电平
-17 RESET 复位引脚 低电平可使LCD复位 - 19 A LCD背光源的电源
- 20 K LCD背光源的地,如果需要背光,可以将19引脚与LCD2引脚电源正极相连,20引脚与LCD1引脚电源地相连
通过时序图即可知道串口模式下控制LCD12864的步骤。
三、CubeIDE配置
使用的是STM32F407ZET6芯片,通过CubeIDE对其进行配置,配置过程如下:
1、新建工程选择对应的芯片,CubeIDE新建工程和系统配置的教程网上太多了,我就不再介绍。
2、引脚配置
只需要配置这几个I/O口就可以了,其他时钟配置就不在这里介绍。
四、程序
1、LCD12864.h
#ifndef INC_LCD12864_H_
#define INC_LCD12864_H_
#include "gpio.h"
#define CS_0 HAL_GPIO_WritePin(GPIOA, LCD_CS_Pin, GPIO_PIN_RESET)
#define CS_1 HAL_GPIO_WritePin(GPIOA, LCD_CS_Pin, GPIO_PIN_SET)
#define RS_0 HAL_GPIO_WritePin(GPIOA, LCD_RS_Pin, GPIO_PIN_RESET)
#define RS_1 HAL_GPIO_WritePin(GPIOA, LCD_RS_Pin, GPIO_PIN_SET)
#define RESET_0 HAL_GPIO_WritePin(GPIOA, LCD_RESET_Pin, GPIO_PIN_RESET)
#define RESET_1 HAL_GPIO_WritePin(GPIOA, LCD_RESET_Pin, GPIO_PIN_SET)
#define SCLK_0 HAL_GPIO_WritePin(GPIOB, LCD_SCLK_Pin, GPIO_PIN_RESET)
#define SCLK_1 HAL_GPIO_WritePin(GPIOB, LCD_SCLK_Pin, GPIO_PIN_SET)
#define SDA_0 HAL_GPIO_WritePin(GPIOB, LCD_SDA_Pin, GPIO_PIN_RESET)
#define SDA_1 HAL_GPIO_WritePin(GPIOB, LCD_SDA_Pin, GPIO_PIN_SET)
void Delay(unsigned short tick);
void InitLCD(void);
void WriteToLCD(unsigned char data, unsigned char flg);
void ClearScreen(void);
void LCDAddr(unsigned char page,unsigned char column);
void DisplayStr(unsigned short page,unsigned short column,char *text);
void DisplayChinese(unsigned char page,unsigned char column,unsigned char no);
#endif
2、LCD12864.c
#include "lcd12864.h"
#include "codelib.h"
void Delay(unsigned short tick)
{
uint8_t j,k;
for(j=0;j<tick;j++)
for(k=0;k<110;k++);
}
void InitLCD(void)
{
Delay(20);
RESET_0;
Delay(5);
RESET_1;
WriteToLCD(0xE2, 1);
Delay(5);
WriteToLCD(0x2c, 1);
Delay(5);
WriteToLCD(0x2e, 1);
Delay(5);
WriteToLCD(0x2f, 1);
Delay(5);
WriteToLCD(0x25, 1);
WriteToLCD(0x81, 1);
WriteToLCD(0x1a, 1);
WriteToLCD(0xa2, 1);
WriteToLCD(0xc8, 1);
WriteToLCD(0xa0, 1);
WriteToLCD(0x40, 1);
ClearScreen();
WriteToLCD(0xaf, 1);
}
void WriteToLCD(unsigned char data, unsigned char flg)
{
unsigned char i;
CS_0;
if(flg)
{RS_0;}
else{RS_1;}
for(i=0;i<8;i++)
{
SCLK_0;
if(flg)Delay(2);
if(data&0x80)
{SDA_1;}
else
{SDA_0;}
SCLK_1;
data <<= 1;
}
}
void ClearScreen(void)
{
unsigned char i,j;
for(i=0;i<9;i++)
{
CS_0;
WriteToLCD(0xb0+i,1);
WriteToLCD(0x10,1);
WriteToLCD(0x00,1);
for(j=0;j<132;j++)
{
WriteToLCD(0x00,0);
}
}
}
void LCDAddr(unsigned char page,unsigned char column)
{
CS_0;
column--;
page--;
WriteToLCD(0xb0+page,1);
WriteToLCD(((column>>4)&0x0f)+0x10,1);
WriteToLCD(column&0x0f,1);
}
void DisplayStr(unsigned short page,unsigned short column,char *text)
{
unsigned short i=0,j,k,n;
CS_0;
while(text[i]>0x00)
{
if((text[i]>=0x20)&&(text[i]<=0x7e))
{
j=text[i]-0x20;
for(n=0;n<2;n++)
{
LCDAddr(page+n,column);
for(k=0;k<8;k++)
{
WriteToLCD(ascii_table_8x16[j][k+8*n],0);
}
}
i++;
column+=8;
}
else
{
i++;
}
}
CS_1;
}
void DisplayChinese(unsigned char page,unsigned char column,unsigned char no)
{
unsigned char i,j;
CS_0;
for(j=0;j<2;j++)
{
LCDAddr(page+j,column);
for (i=0;i<16;i++)
{
WriteToLCD(Hzk[2*no+j][i],0);
}
}
CS_1;
}
3、codelib.h(字库)
#ifndef INC_CODELIB_H_
#define INC_CODELIB_H_
unsigned char static ascii_table_8x16[95][16]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00,
0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00,
0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00,
0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00,
0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10,
0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00,
0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,
0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00,
0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,
0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,
0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,
0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,
0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,
0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,
0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,
0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,
0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,
0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00,
0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,
0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,
0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00,
0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00,
0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,
0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,
0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,
0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00,
0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,
0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,
0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00,
0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00,
0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00,
0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00,
0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00,
0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00,
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00,
0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20,
0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,
0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,
0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00,
0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00,
0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20,
0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,
0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00,
0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,
0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00,
0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,
0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,
0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,
0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,
0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20,
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,
0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00,
0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,
0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,
0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,
0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,
0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,
0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,
0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00,
0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80,
0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,
0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00,
0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00,
0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00,
0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00,
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00,
0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00,
0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40,
0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,
0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00,
0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
#### 3、
const unsigned char Hzk[][32]=
{
{0x14,0x24,0x44,0x84,0x64,0x1C,0x20,0x18,0x0F,0xE8,0x08,0x08,0x28,0x18,0x08,0x00},
{0x20,0x10,0x4C,0x43,0x43,0x2C,0x20,0x10,0x0C,0x03,0x06,0x18,0x30,0x60,0x20,0x00},
{0x40,0x41,0xCE,0x04,0x00,0xFC,0x04,0x02,0x02,0xFC,0x04,0x04,0x04,0xFC,0x00,0x00},
{0x40,0x20,0x1F,0x20,0x40,0x47,0x42,0x41,0x40,0x5F,0x40,0x42,0x44,0x43,0x40,0x00},
{0x40,0x20,0xF0,0x1C,0x07,0xF2,0x94,0x94,0x94,0xFF,0x94,0x94,0x94,0xF4,0x04,0x00},
{0x00,0x00,0x7F,0x00,0x40,0x41,0x22,0x14,0x0C,0x13,0x10,0x30,0x20,0x61,0x20,0x00},
{0x00,0x00,0x00,0xFE,0x22,0x22,0x22,0x22,0xFE,0x22,0x22,0x22,0x22,0xFE,0x00,0x00},
{0x80,0x40,0x30,0x0F,0x02,0x02,0x02,0x02,0xFF,0x02,0x02,0x42,0x82,0x7F,0x00,0x00},
{0x08,0x08,0x08,0x08,0x08,0xC8,0x38,0xFF,0x18,0x68,0x88,0x08,0x08,0x08,0x08,0x00},
{0x08,0x08,0x04,0x02,0x05,0x04,0x04,0x7F,0x04,0x04,0x04,0x03,0x06,0x0C,0x04,0x00},
{0x00,0x04,0xE4,0x44,0x4C,0x74,0x54,0x45,0x46,0x64,0x54,0x4C,0x44,0x64,0x44,0x00},
{0x40,0x30,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x7E,0x22,0x22,0x22,0x22,0x22,0x22,0x7E,0x00,0x00,0x00,0x00},
{0x00,0x7F,0x21,0x21,0x21,0x21,0x7F,0x00,0x7F,0x21,0x21,0x21,0x21,0x7F,0x00,0x00},
{0x00,0x08,0x88,0xC9,0x2E,0x98,0x48,0x00,0x08,0x08,0xF8,0x08,0x08,0xFC,0x08,0x00},
{0x02,0x01,0x00,0x7F,0x01,0x02,0x44,0x20,0x10,0x0C,0x03,0x20,0x40,0x3F,0x00,0x00},
{0x10,0x90,0x70,0x1F,0x12,0xF0,0x00,0x20,0x70,0x28,0x27,0x22,0x28,0x70,0x20,0x00},
{0x40,0x21,0x12,0x0C,0x06,0x09,0x30,0x00,0x7F,0x21,0x21,0x21,0x21,0x7F,0x00,0x00},
{0x80,0x40,0x20,0xF8,0x07,0x02,0x00,0x00,0xFF,0xC0,0x60,0x30,0x1C,0x08,0x00,0x00},
{0x00,0x00,0x00,0x7F,0x00,0x04,0x02,0x01,0x3F,0x40,0x40,0x40,0x40,0x78,0x00,0x00},
{0x00,0x90,0x8C,0xA4,0xA4,0xA4,0xA5,0xA6,0xA4,0xA4,0xA4,0xA4,0x94,0x8C,0x04,0x00},
{0x00,0x80,0x40,0x20,0x18,0x07,0x00,0x00,0x00,0x3F,0x40,0x40,0x40,0x70,0x00,0x00},
{0x00,0x00,0xF8,0x48,0x48,0x48,0xC8,0x08,0xFF,0x08,0x09,0x0A,0xC8,0x88,0x08,0x00},
{0x40,0x30,0x0F,0x00,0x08,0x50,0x4F,0x20,0x10,0x0B,0x0C,0x12,0x21,0x40,0xF0,0x00},
{0x40,0x42,0x4C,0xC4,0x00,0x22,0xAA,0xAA,0xAA,0xBF,0xAA,0xAA,0xAA,0x22,0x20,0x00},
{0x00,0x00,0x00,0x7F,0x20,0x10,0xFF,0x0A,0x0A,0x0A,0x4A,0x8A,0x7F,0x00,0x00,0x00},
{0x10,0x10,0x10,0xFF,0x90,0x50,0x98,0x88,0x88,0xE9,0x8E,0x88,0x88,0x98,0x88,0x00},
{0x02,0x42,0x81,0x7F,0x00,0x40,0x40,0x26,0x25,0x18,0x08,0x16,0x31,0x60,0x20,0x00},
{0x00,0x00,0x00,0xF8,0x48,0x48,0x48,0x49,0x4E,0x4A,0x48,0x48,0x48,0x78,0x00,0x00},
{0x40,0x20,0x18,0x07,0x00,0x7E,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x7E,0x00,0x00},
{0x20,0x24,0x24,0xE4,0x24,0x24,0x24,0x20,0x10,0x10,0xFF,0x10,0x10,0xF0,0x00,0x00},
{0x08,0x1C,0x0B,0x08,0x0C,0x05,0x4E,0x24,0x10,0x0C,0x03,0x20,0x40,0x3F,0x00,0x00},
{0x40,0x30,0xEF,0x28,0x28,0x44,0x64,0xDC,0x10,0x54,0xFF,0x54,0x54,0x7C,0x10,0x00},
{0x01,0x01,0x7F,0x21,0x51,0x22,0x14,0x0F,0x14,0x25,0x3F,0x45,0x45,0x45,0x44,0x00},
{0x40,0x40,0x48,0x48,0x48,0x48,0xC8,0xFF,0x48,0x48,0x48,0x48,0x48,0x40,0x40,0x00},
{0x20,0x20,0x10,0x10,0x08,0x06,0x01,0xFF,0x01,0x02,0x04,0x08,0x18,0x30,0x10,0x00},
{0x40,0x30,0xEF,0x24,0x24,0x00,0x44,0xD8,0x04,0x74,0x4F,0xF4,0x44,0x44,0x00,0x00},
{0x01,0x01,0x7F,0x21,0x11,0x48,0x20,0x1F,0x22,0x42,0x42,0x5F,0x42,0x42,0x42,0x00},
{0x08,0x08,0x08,0xFF,0x88,0x68,0x24,0x2C,0xB4,0x25,0x26,0x34,0x2C,0x24,0x20,0x00},
{0x02,0x42,0x81,0x7F,0x02,0x82,0x8A,0x4E,0x53,0x32,0x12,0x2E,0x42,0xC2,0x02,0x00},
{0x00,0x04,0x04,0x04,0xFC,0x04,0x14,0x14,0x10,0x90,0x7F,0x10,0x10,0xF0,0x00,0x00},
{0x04,0x0C,0x04,0x04,0x03,0x42,0x22,0x11,0x0C,0x23,0x20,0x60,0x20,0x1F,0x00,0x00},
{0x90,0x88,0xA7,0xA2,0xA6,0xBA,0xA2,0xF8,0xA7,0xA2,0xA6,0xBA,0xA2,0x82,0x80,0x00},
{0x00,0x04,0x04,0x04,0x04,0x0C,0x34,0x04,0x44,0x84,0x7F,0x04,0x04,0x04,0x00,0x00},
{0x20,0x10,0x08,0xC7,0x3A,0x50,0x44,0x44,0x44,0x7F,0x44,0xC4,0x44,0x44,0x40,0x00},
{0x00,0x02,0x01,0xFF,0x00,0x02,0x02,0x1A,0x02,0x42,0x82,0x7F,0x02,0x02,0x02,0x00},
{0x10,0x92,0x54,0x38,0xFF,0x38,0x54,0x52,0x80,0xF0,0x1F,0x12,0x10,0xF0,0x10,0x00},
{0x42,0x42,0x2A,0x2E,0x13,0x1A,0x26,0x02,0x40,0x20,0x13,0x0C,0x33,0x60,0x20,0x00},
{0x08,0x08,0x08,0xFF,0x88,0x40,0xFE,0x92,0x92,0x92,0xF2,0x92,0x92,0x9E,0x80,0x00},
{0x02,0x42,0x81,0x7F,0x40,0x30,0x0F,0xFC,0x44,0x44,0x47,0x44,0x44,0xFC,0x00,0x00},
{0x40,0x20,0xF8,0x07,0x42,0x44,0x44,0x44,0xF4,0x4F,0x44,0x44,0x46,0x64,0x40,0x00},
{0x00,0x00,0x7F,0x00,0x00,0x00,0x02,0x0B,0x12,0x22,0x52,0x0A,0x07,0x02,0x00,0x00},
{0x44,0xF4,0x4F,0xE4,0x44,0x64,0x90,0x98,0x94,0x93,0x14,0x98,0x08,0xD0,0x10,0x00},
{0x04,0x04,0x04,0xFF,0x02,0x02,0xFF,0x4A,0x8A,0x7F,0x00,0x3F,0x80,0xFF,0x00,0x00},
{0x00,0x00,0xFC,0x08,0x08,0x08,0x08,0xFF,0x08,0x08,0x08,0x08,0xFC,0x08,0x00,0x00},
{0x00,0x00,0x07,0x02,0x02,0x02,0x02,0xFF,0x02,0x02,0x02,0x02,0x07,0x00,0x00,0x00},
{0x40,0x41,0xCE,0x04,0x00,0x80,0x40,0xBE,0x82,0x82,0x82,0xBE,0xC0,0x40,0x40,0x00},
{0x00,0x00,0x7F,0x20,0x90,0x80,0x40,0x43,0x2C,0x10,0x10,0x2C,0x43,0xC0,0x40,0x00},
{0x00,0x20,0x10,0x08,0x87,0x8A,0x52,0x22,0x22,0x52,0x8E,0x82,0x00,0x00,0x00,0x00},
{0x02,0x02,0x01,0xFF,0x4A,0x4A,0x4A,0x7E,0x4A,0x4A,0x4A,0xFF,0x01,0x03,0x01,0x00},
{0x00,0x10,0x10,0x10,0x11,0x1E,0x14,0xF0,0x10,0x18,0x17,0x12,0x18,0x10,0x00,0x00},
{0x01,0x81,0x41,0x21,0x11,0x09,0x05,0x03,0x05,0x09,0x31,0x61,0xC1,0x41,0x01,0x00},
{0x00,0x00,0xF9,0x02,0x46,0x40,0x42,0x42,0xFA,0x42,0x42,0x42,0x02,0xFE,0x00,0x00},
{0x00,0x00,0xFF,0x00,0x04,0x04,0x12,0x21,0x1F,0x00,0x00,0x40,0x80,0x7F,0x00,0x00},
{0x00,0x00,0xFC,0x08,0x08,0x08,0x08,0xFF,0x08,0x08,0x08,0x08,0xFC,0x08,0x00,0x00},
{0x00,0x00,0x07,0x02,0x02,0x02,0x02,0xFF,0x02,0x02,0x02,0x02,0x07,0x00,0x00,0x00},
{0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0xFF,0x48,0x48,0x48,0x48,0xF8,0x00,0x00,0x00},
{0x00,0x00,0x0F,0x04,0x04,0x04,0x04,0x3F,0x44,0x44,0x44,0x44,0x4F,0x40,0x70,0x00},
{0x40,0x40,0x40,0xDF,0x55,0x55,0x55,0xD5,0x55,0x55,0x55,0xDF,0x40,0x40,0x40,0x00},
{0x40,0x40,0x40,0x57,0x55,0x55,0x55,0x7F,0x55,0x55,0x55,0x57,0x50,0x40,0x40,0x00},
{0x00,0x02,0x02,0x02,0x02,0x82,0x42,0xFE,0x06,0x42,0xC2,0x82,0x02,0x03,0x02,0x00},
{0x00,0x08,0x04,0x02,0x01,0x00,0x00,0x7F,0x00,0x00,0x00,0x01,0x07,0x02,0x00,0x00},
{0x00,0x00,0x00,0x7E,0x22,0x22,0x22,0xE2,0x22,0x22,0x22,0x7E,0x00,0x00,0x00,0x00},
{0x80,0x40,0x20,0x10,0x0F,0x10,0x20,0x3F,0x42,0x42,0x42,0x42,0x42,0x40,0x40,0x00},
};
#endif
4、main.c
int main(void)
{
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
InitLCD();
ClearScreen();
while (1)
{
DisplayStr(1,40,"welcome");
DisplayChinese(3,50,0);
DisplayChinese(3,66,1);
HAL_Delay(1000);
ClearScreen();
HAL_Delay(1000);
}
}
|