普中51-单核-A2 STC89C52 Windows 10 20H2 Proteus 8 Frofessional v8.9 SP2 Keil uVision V5.29.0.0 PK51 Prof.Developers Kit Version:9.60.0.0
???????移植自发布一个ST7920的LCD12864 Proteus仿真模型,支持串口和4bit模式通讯 —— cdhigh ???????参考资料:《LCD12864液晶显示模块数据手册(带字库)》
硬知识
LCD12864简介
???????LCD12864液晶屏,背面3个COB牛屎堆,一个主控芯片ST7920,另外两个是移位芯片ST7921.
主控芯片ST7920的功能是:
- 与我们的单片机并行通信。
- 字库ROM、CGROM,DDRAM等。
- 行扫描COM0 ~ COM31…
- 列扫描SEG0 ~ SEG63…
- 串行方式发送数据到两片ST7921驱动芯片。
驱动芯片ST7921的功能是:
- 接收来自ST7920的串行信号,转化成并口驱动电压。
- 根据信号要求,两片芯片分别驱动SEG64~ SEG159,SEG160~ SEG255
???????LCD12864它本质上是256x32点的矩阵屏,32行扫描是COM0-COM31,列字节是SEG0-SEG255总共32字节,每个字节8bit,总共256位。. ???????原本左右拼接的256x32点,变成了上下拼接的128x64点。如下图所示:
引脚功能
时序
并行通信
串行通信
指令
存储结构
操作
uint8_t code LCD12864_Write_CGRAM[]=
{
0x60,0x00,0x91,0xF4,0x96,0x0C,0x6C,0x04,
0x08,0x04,0x18,0x00,0x18,0x00,0x18,0x00,
0x18,0x00,0x18,0x00,0x18,0x00,0x08,0x00,
0x0C,0x04,0x06,0x08,0x01,0xF0,0x00,0x00
};
取模软件的配置
示例程序
VSS —— GND
VDD —— VCC(5V or 3.3V)
V0 亮度调节
CS(RS) —— 接VCC,持续高电平,一直选通。
MOSI(R/W)—— 接MOSI
SCLK(E) —— 接SCLK
PSB —— 接GND 串行模式
BLA —— VCC(5V or 3.3V)
BLK —— 接GND
剩余引脚不接,留空
???????stdint.h见【51单片机快速入门指南】1:基础知识和工程创建 ???????软件SPI程序见【51单片机快速入门指南】5:软件SPI ???????SPI选择模式3。 根据电路修改Software_SPI.h 模式选择在st7920.h内
st7920.c
#include "st7920.h"
#include "./Software_SPI/Software_SPI.h"
void delay_ms(int i);
void st7920_delay()
{
}
void LCD12864_CS_H()
{
LCD12864_CS = 1;
}
void LCD12864_CS_L()
{
LCD12864_CS = 0;
}
void LCD12864_PSB_L()
{
LCD12864_PSB = 0;
}
void LCD12864_RS_H()
{
RS_Pin = 1;
}
void LCD12864_RS_L()
{
RS_Pin = 0;
}
void LCD12864_WR_H()
{
WR_Pin = 1;
}
void LCD12864_WR_L()
{
WR_Pin = 0;
}
void LCD12864_EN_H()
{
EN_Pin = 1;
}
void LCD12864_EN_L()
{
EN_Pin = 0;
}
uint8_t LCD12864_Port_Read()
{
return LCD12864_Port;
}
void LCD12864_Port_Write_8B(uint8_t Data)
{
LCD12864_Port = Data;
}
void LCD12864_Port_Write_4B(uint8_t Data)
{
LCD12864_Port &= 0x0F;
LCD12864_Port |= Data;
}
void LCD_init(void)
{
#if LCD_INTERFACE == MODE_SPI
LCD12864_PSB_L();
#endif
delay_ms(50);
LCD_write_command(0x33);
delay_ms(1);
LCD_write_command(0x32);
delay_ms(1);
#if LCD_INTERFACE == MODE_4BIT
LCD_write_command(0x28);
delay_ms(1);
LCD_write_command(0x28);
delay_ms(1);
#endif
LCD_write_command(0x08);
delay_ms(1);
LCD_write_command(0x10);
delay_ms(1);
LCD_write_command(0x0C);
delay_ms(1);
LCD_write_command(0x01);
delay_ms(10);
LCD_write_command(0x06);
delay_ms(10);
}
void LCD_write_command(unsigned char command)
{
#if LCD_INTERFACE == MODE_SPI
LCD2_spi_write_byte(0xf8);
st7920_delay();
LCD2_spi_write_byte_standard(command);
#else
LCD12864_RS_L();
LCD_write_byte(command);
delay_ms(1);
#endif
}
void LCD_write_data(unsigned char Data)
{
#if LCD_INTERFACE == MODE_SPI
LCD2_spi_write_byte(0xfa);
st7920_delay();
LCD2_spi_write_byte_standard(Data);
#else
LCD12864_RS_H();
LCD_write_byte(Data);
#endif
}
void LCD_write_byte(unsigned char Data)
{
#if LCD_INTERFACE == MODE_4BIT
LCD_write_half_byte(Data);
Data <<= 4;
LCD_write_half_byte(Data);
#else
LCD12864_Port_Write_8B(Data);
LCD12864_WR_L();
LCD12864_EN_H();
st7920_delay();
LCD12864_EN_L();
st7920_delay();
LCD12864_WR_H();
#endif
}
void LCD_write_half_byte(unsigned char half_byte)
{
LCD12864_Port_Write_4B(half_byte);
LCD12864_WR_L();
LCD12864_EN_H();
st7920_delay();
LCD12864_EN_L();
st7920_delay();
LCD12864_WR_H();
}
void LCD2_spi_write_byte(unsigned char Data)
{
LCD12864_CS_H();
SOFT_SPI_RW_MODE3(Data);
LCD12864_CS_L();
}
void LCD2_spi_write_byte_standard(unsigned char Data)
{
LCD2_spi_write_byte(Data & 0xf0);
LCD2_spi_write_byte((Data << 4) & 0xf0);
}
unsigned char LCD_read_data(void)
{
unsigned char Data;
LCD12864_RS_H();
Data = LCD_read_byte();
#if LCD_INTERFACE == MODE_4BIT
Data = (Data & 0xf0) | ((LCD_read_byte() >> 4) & 0x0f);
#endif
return Data;
}
unsigned char LCD_read_status(void)
{
unsigned char Data;
LCD12864_RS_L();
Data = LCD_read_byte();
#if LCD_INTERFACE == MODE_4BIT
Data = (Data & 0xf0) | ((LCD_read_byte() >> 4) & 0x0f);
#endif
return Data;
}
unsigned char LCD_read_byte(void)
{
unsigned char Data;
LCD12864_WR_H();
LCD12864_EN_L();
st7920_delay();
LCD12864_EN_H();
st7920_delay();
Data = LCD12864_Port_Read();
LCD12864_EN_L();
return Data;
}
void LCD_set_text_address(unsigned int rowCol)
{
unsigned char start = 0x80;
unsigned char row = (rowCol >> 8) & 0xff;
unsigned char col = rowCol & 0xff;
if (row == 1) {
start = 0x90;
}
if (row == 2) {
start = 0x88;
}
if (row == 3) {
start = 0x98;
}
LCD_write_command(start + col);
}
unsigned int LCD_rowCol_to_inter_Xy(unsigned int rowCol)
{
unsigned char row = (rowCol >> 8) & 0x03;
unsigned char col = rowCol & 0x07;
unsigned char x = col + 8 * (unsigned char)(row / 2);
unsigned char y = (row * 16) & 0x1f;
return (x << 8) | y;
}
void LCD_set_graphic_address(unsigned char x, unsigned char y)
{
unsigned char xWord, downPage, yInter;
x &= 0x7f;
y &= 0x3f;
xWord = x / 16;
downPage = y / 32;
yInter = y & 0x1f;
LCD_write_command(0x80 + yInter);
LCD_write_command(0x80 + xWord + 8 * downPage);
}
void LCD_clear(void)
{
unsigned char x, y;
LCD_write_command(0x08);
st7920_delay();
LCD_write_command(0x01);
LCD_startGraphic();
for (y = 0; y < 32; y++)
{
LCD_write_command(0x80 + y);
LCD_write_command(0x80 + 0);
for (x = 0; x < 16; x++)
{
LCD_write_data(0x00);
LCD_write_data(0x00);
}
}
LCD_endGraphic();
LCD_write_command(0x0C);
delay_ms(10);
}
void LCD_startGraphic(void)
{
#if LCD_INTERFACE == MODE_4BIT
LCD_write_command(0x24);
LCD_write_command(0x26);
#else
LCD_write_command(0x34);
LCD_write_command(0x36);
#endif
}
void LCD_endGraphic(void)
{
#if LCD_INTERFACE == MODE_4BIT
LCD_write_command(0x26);
LCD_write_command(0x20);
#else
LCD_write_command(0x36);
LCD_write_command(0x30);
#endif
}
void LCD_Inverse_16X16(unsigned int rowCol, unsigned char charNum, unsigned char reverse)
{
unsigned char i, ch;
unsigned int xy = LCD_rowCol_to_inter_Xy(rowCol);
unsigned char x = (xy >> 8) & 0xff;
unsigned char y = xy & 0x3f;
LCD_startGraphic();
for (i = 0; i < 16; i++)
{
LCD_write_command(0x80 + y + i);
LCD_write_command(0x80 + x);
for (ch = 0; ch < charNum; ch++)
{
LCD_write_data(reverse ? 0xff : 0x00);
LCD_write_data(reverse ? 0xff : 0x00);
}
}
LCD_endGraphic();
}
void LCD_write_char(unsigned int rowCol, unsigned int Code)
{
unsigned char high = (Code >> 8) & 0xff;
unsigned char low = Code & 0xff;
LCD_set_text_address(rowCol);
if (Code > 0x80)
{
LCD_write_data(high);
}
LCD_write_data(low);
}
void LCD_write_string(unsigned int rowCol, const char * p)
{
LCD_set_text_address(rowCol);
while (*p != 0)
{
LCD_write_data(*p);
p++;
}
}
void LCD_Draw_Bmp(unsigned char *pImage, unsigned char col, unsigned char row, unsigned char x0, unsigned char y0)
{
unsigned char i, y;
LCD_startGraphic();
for (y = y0; y < row + y0; y++)
{
LCD_set_graphic_address(x0, y);
for (i = 0; i < col/8; i++)
{
LCD_write_data(*pImage);
pImage++;
}
}
LCD_endGraphic();
}
#if LCD_INTERFACE != MODE_SPI
void LCD_write_dot(unsigned char x, unsigned char y)
{
unsigned char xBit, high, low;
xBit = x & 0x0f;
LCD_startGraphic();
LCD_set_graphic_address(x, y);
LCD_read_data();
high = LCD_read_data();
low = LCD_read_data();
LCD_set_graphic_address(x, y);
if (xBit < 8)
{
LCD_write_data(high | (0x01 << (7 - xBit)));
LCD_write_data(low);
}
else
{
LCD_write_data(high);
LCD_write_data(low | (0x01 << (15 - xBit)));
}
LCD_endGraphic();
}
#endif
st7920.h
#ifndef __ST7290_H_
#define __ST7290_H_
#include <STC89C5xRC.H>
#define LCD12864_Port P0
sbit LCD12864_CS = P2^6;
sbit LCD12864_PSB = P3^2;
sbit RS_Pin = P2 ^ 6;
sbit WR_Pin = P2 ^ 5;
sbit EN_Pin = P2 ^ 7;
#define MODE_8BIT 8
#define MODE_4BIT 4
#define MODE_SPI 1
#define LCD_INTERFACE MODE_SPI
void LCD_clear(void);
void LCD_init(void);
void LCD_write_command(unsigned char command);
void LCD_write_data(unsigned char Data);
void LCD_write_byte(unsigned char byte);
void LCD_write_half_byte(unsigned char half_byte);
void LCD2_spi_write_byte(unsigned char Data);
void LCD2_spi_write_byte_standard(unsigned char Data);
unsigned char LCD_read_data(void);
unsigned char LCD_read_status(void);
unsigned char LCD_read_byte(void);
void LCD_startGraphic(void);
void LCD_endGraphic(void);
void LCD_Inverse_16X16(unsigned int rowCol, unsigned char charNum, unsigned char reverse);
unsigned int LCD_rowCol_to_inter_Xy(unsigned int rowCol);
void LCD_set_text_address(unsigned int rowCol);
void LCD_set_graphic_address(unsigned char x, unsigned char y);
void LCD_write_char(unsigned int rowCol, unsigned int Code);
void LCD_write_string(unsigned int rowCol, const char * p);
void LCD_Draw_Bmp(unsigned char *pImage, unsigned char col, unsigned char row, unsigned char x0, unsigned char y0);
#if LCD_INTERFACE != MODE_SPI
void LCD_write_dot(unsigned char x, unsigned char y);
#endif
#define BYTE_BIT(bitno) (1 << (bitno))
#define TEST_BIT(value, bitno) ((1 << (bitno)) & (value))
#define SET_BIT(value, bitno) ((value) |= (1 << (bitno)))
#define CLR_BIT(value, bitno) ((value) &= ~(1 << (bitno)))
#define ROW_COL(r, c) (((r) << 8) | (c & 0xff))
#endif
测试程序
显示图片
图片1
#include <STC89C5xRC.H>
#include "intrins.h"
#include "stdint.h"
#include "st7920.h"
void Delay1ms()
{
unsigned char i, j;
_nop_();
i = 2;
j = 199;
do
{
while (--j);
} while (--i);
}
void delay_ms(int i)
{
while(i--)
Delay1ms();
}
code uint8_t LCD12864_Pic[] =
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xF0,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x1F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x0D,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0xE0,0x00,0x04,0x78,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x03,0xB0,0x00,0x02,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x07,0x60,0x00,0x02,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x1E,0x40,0x00,0x01,0x07,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x3C,0x40,0x00,0x01,0x05,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x34,0x80,0x00,0x00,0x82,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x64,0x80,0x00,0x00,0x82,0x40,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x60,0x80,0x00,0x00,0x02,0x60,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x61,0x81,0x80,0x00,0x41,0x60,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x61,0x03,0xE0,0x00,0x01,0x20,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x61,0x07,0xF0,0x00,0x21,0x20,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x61,0x0C,0x3C,0x00,0x20,0xB0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x61,0x11,0xDE,0x00,0x10,0xB0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x21,0x12,0x1F,0x00,0x10,0x90,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x25,0x24,0xC3,0x80,0x08,0x10,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x35,0x29,0x01,0xC0,0x08,0x50,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x35,0x28,0x00,0xE0,0x04,0x58,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x15,0x3F,0xFF,0xF0,0x04,0x08,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x19,0xF8,0x00,0x3C,0x02,0x2C,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x1C,0x02,0x2C,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x0E,0x01,0x16,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x07,0x01,0x97,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x32,0x00,0x00,0x03,0x80,0x8B,0x82,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x32,0x00,0x00,0x01,0xC0,0x41,0xFE,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0xC0,0x32,0xFE,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x60,0x1D,0xFC,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x30,0x07,0xDC,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x10,0x00,0x38,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x08,0x00,0x70,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x60,0x80,0x00,0x00,0x0C,0x00,0xE0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x00,0x00,0x06,0x03,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x60,0x7C,0x00,0x00,0x7F,0xFF,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x61,0xE4,0x00,0x00,0xC8,0x7C,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x60,0xEC,0x00,0x00,0xCE,0x18,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x60,0xFC,0x00,0x00,0xFE,0x1C,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0xE0,0x7C,0x00,0x00,0xF8,0x1F,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x60,0x38,0x00,0x00,0x78,0x1B,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x06,0x60,0x58,0x00,0x00,0x48,0x19,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x06,0x60,0x00,0x00,0x00,0x00,0x19,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x06,0x60,0x00,0x00,0x00,0x00,0x19,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x06,0x20,0x1F,0xFF,0xFF,0xE0,0x19,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x06,0x20,0x10,0x41,0x04,0x20,0x13,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x30,0x1C,0x41,0x04,0x60,0x33,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0xF0,0x0C,0x41,0x02,0x40,0x3E,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0xF0,0x0C,0x01,0x02,0xC0,0x3C,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x30,0x06,0x81,0x03,0x80,0x60,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x18,0x03,0x81,0x03,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x1C,0x01,0xE1,0x0E,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x7F,0xF8,0x01,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x07,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
void main(void)
{
LCD_init();
LCD_clear();
LCD_Draw_Bmp(LCD12864_Pic, 128, 64, 0, 0);
while(1)
{
}
}
实验现象
???????图片打印较慢,请耐心等待。
图片2
code unsigned char bmpData[] =
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x01,0xE0,0x00,
0x00,0x00,0x00,0x01,0x20,0x00,0x00,0x00,0x00,0x03,0xE0,0x00,0x00,0x00,0x00,0x03,
0xF0,0x00,0x00,0x00,0x00,0x01,0xE0,0x00,0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x00,
0x00,0x01,0xE0,0x00,0x00,0x00,0x00,0x01,0xE1,0x80,0x00,0x00,0x00,0x01,0xF1,0x84,
0x00,0x00,0x00,0x01,0xF9,0x9C,0x00,0x00,0x00,0x00,0xFF,0xB8,0x00,0x00,0x00,0x00,
0xBF,0xFF,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0xDF,0xFC,0x00,0x00,
0x00,0x00,0xDF,0xFF,0x80,0x00,0x00,0x00,0xDC,0x7F,0x00,0x00,0x00,0x00,0xDE,0xFC,
0x00,0x00,0x00,0x00,0xDC,0xF0,0x00,0x00,0x00,0x01,0xFF,0x70,0x00,0x00,0x00,0x01,
0xE7,0xD8,0x00,0x00,0x00,0x01,0xB3,0xD8,0x00,0x00,0x00,0x00,0xE1,0xF0,0x00,0x00,
0x00,0x00,0xC1,0xF8,0x00,0x00,0x00,0x00,0x47,0xB8,0x00,0x00,0x00,0x00,0x4F,0xBC,
0x00,0x00,0x00,0x00,0x4B,0x1D,0xC0,0x00,0x00,0x00,0x7A,0x7F,0xE0,0x00,0x00,0x00,
0x36,0x6E,0x70,0x00,0x00,0x00,0x6C,0x6C,0xE0,0x00,0x00,0x00,0x6C,0x4C,0xE0,0x00,
0x00,0x00,0xD8,0xCC,0xC0,0x00,0x00,0x00,0xD8,0xC5,0xC0,0x00,0x00,0x00,0x70,0xC7,
0xC0,0x00,0x00,0x00,0x3C,0xC7,0x80,0x00,0x00,0x00,0x38,0xC7,0x80,0x00,0x00,0x00,
0x78,0xC7,0x00,0x00,0x00,0x00,0x70,0xC6,0x00,0x00,0x00,0x00,0x70,0xC6,0x00,0x00,
0x00,0x00,0x70,0xC6,0x00,0x00,0x00,0x00,0x30,0xC2,0x00,0x00,0x00,0x00,0x20,0xC2,
0x00,0x00,0x00,0x00,0x60,0xC2,0x00,0x00,0x00,0x00,0x60,0xC6,0x00,0x00,0x00,0x00,
0x60,0xFE,0x00,0x00,0x00,0x00,0x60,0xFE,0x00,0x00,0x00,0x00,0x60,0x7E,0x00,0x00,
0x00,0x00,0x60,0x7E,0x00,0x00,0x00,0x00,0x60,0xFE,0x00,0x00,0x00,0x00,0x63,0xFE,
0x00,0x00,0x00,0x00,0x67,0x7E,0x00,0x00,0x00,0x00,0x7F,0xFE,0x00,0x00,0x00,0x00,
0x7F,0xFE,0x00,0x00,0x00,0x00,0x7F,0xDF,0x00,0x00,0x00,0x00,0x5F,0xDF,0x00,0x00,
0x00,0x01,0xFF,0xFF,0x00,0x00,0x00,0x01,0x80,0x01,0x00,0x00,0x00,0x07,0xFF,0xFF,
0xC0,0x00,0x00,0x06,0xFF,0xFE,0xE0,0x00,0x00,0x04,0x00,0x00,0x60,0x00,0x00,0x07,
0xFF,0xFF,0xE0,0x00,0x00,0x07,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
void main(void)
{
LCD_init();
LCD_clear();
LCD_Draw_Bmp(bmpData, 48, 64, 32, 0);
while(1)
{
}
}
实验现象
显示字符
英文
void main(void)
{
LCD_init();
LCD_clear();
LCD_write_string(0x0000, "0123456789abcdef");
LCD_write_string(0x0100, "~`!@#$%^&*()_-+=");
LCD_write_string(0x0200, "ABCDEFGHIJKLMNOP");
LCD_write_string(0x0300, "QRSTUVWXYZ");
while(1)
{
}
}
实验现象
中文
void main(void)
{
LCD_init();
LCD_clear();
LCD_write_string(0x0000, "祥瑞不在凤凰麒麟");
LCD_write_string(0x0100, "太平须得边将忠臣");
LCD_write_string(0x0200, "仁得百僚师长肝胆");
LCD_write_string(0x0300, "不用三\xfd军罗绮金银");
while(1)
{
}
}
实验现象
Proteus的仿真
???????需添加LCD12864的模型:发布一个ST7920的LCD12864 Proteus仿真模型,支持串口和4bit模式通讯 —— cdhigh ???????下载后将LIBRARY、MODELS文件夹与Proteus安装目录下DATA文件夹内的同名文件夹合并
|