📄 lcd5110.h
字号:
0x2A,0x13,0x12,0x0A,0x0A,0x06,0x02,0x00,
0x08,0x08,0x07,0x24,0x24,0x10,0x0C,0x23,
0x20,0x20,0x1F,0x00,0x00,0x3F,0x0A,0x2A,
0x3F,0x00,0x3E,0x24,0x24,0x22,0x38,0x00,
0x25,0x2C,0x16,0x15,0x1C,0x25,0x20,0x13,
0x0C,0x13,0x20,0x00,0x02,0x02,0x02,0x22,
0x22,0x3F,0x02,0x02,0x02,0x02,0x02,0x00,
0x1F,0x09,0x09,0x1F,0x00,0x00,0x23,0x20,
0x3F,0x00,0x00,0x00,0x02,0x02,0x3F,0x12,
0x0A,0x03,0x02,0x02,0x3F,0x02,0x03,0x00
};
const unsigned char anidog1[]=
{
0x0, 0x0, 0x0,0x80,0x80,0x44,0x98,0x18,0xf4,0x10,0xe8,0x10,0xc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x10, 0x0,0x60,0x61, 0x5,0xf2,0xfe,0xf2,0xff,0xff,0xff,0xff,0xfc,0xf3,0x4c,0x20,0xa0, 0x0, 0x0, 0x0, 0x0, 0x0,0x98,0xe3,0xfe,0x81, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x1,0x10, 0xe,0x10, 0xf, 0xf, 0xf, 0xf, 0x7, 0x3,0x23,0x71,0xf9,0xfc,0xfe,0xff,0xff,0xff,0xfe,0x7e,0xfe,0xff,0xff,0xff,0x7c,0x86, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0,0x80,0x80,0x98,0x78,0x70,0x88,0x78,0x77,0x76,0x79,0x7f,0x7f,0x80,0x71,0x71,0x8d,0x74,0x75,0x73,0x7f,0x7e,0x7a,0x84,0x80,0x80, 0x0, 0x0, 0x0
};
const unsigned char anidog2[]=
{
0x0, 0x0, 0x0, 0x0,0x50,0x80,0x80,0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5e,0x1d,0x2a,0x1c,
0x1, 0x2, 0x5,0x83,0x80,0x82,0x85,0xc7,0xc8,0xc5,0xc2,0xc1,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc1,0xc2,0xc1,0xc1,0xc1,0xc3,0xc1,0x80,0x80, 0x0, 0x0, 0x0, 0x0, 0x0
};
const unsigned char anidog4[]=
{
0x0, 0x0, 0x0, 0x0,0xa0, 0x0, 0x0,0x80,0xe0,0x90,0xe0,0x98,0x68,0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x88, 0x0,0x30,0x30,0x82,0xf9,0xff,0xf9,0xff,0xff,0xff,0xff,0xfe,0x79,0x36,0x88, 0x0,0x20, 0x0, 0x0,0x20,0xb0,0xf4,0xfc,0x3e,0x4c,0x16,0x84, 0x4, 0x8, 0x0, 0x0,
0x0,0x42,0xa1, 0x6,0xd1,0xa3,0x63,0xf3,0xd7,0xb3,0xc1,0xe8,0xfc,0x7e,0x7f,0xff,0xff,0xff,0xfe,0x7e,0x3f,0x7f,0xff,0xff,0x7e,0xbf,0xff,0xbe,0xbd,0x3a,0x54,0x38,
0x0, 0x6, 0xb,0x97,0xad,0xbb,0x97,0xed,0xcb,0xd7,0xcb,0xc5,0xc2,0xc1,0xc1,0xc0,0xc0,0xc0,0xc2,0xc4,0xc3,0xc2,0xc2,0xc6,0xc3,0x81,0x81, 0x1, 0x0, 0x0, 0x0, 0x0
};
char str_temp[10];
/*--------------------------------------------
LCD_write_byte: 使用SPI接口写数据到LCD
输入参数:dt:写入的数据;
command :1写数据/0命令选择;
----------------------------------------------*/
void LCD_write_byte(unsigned char dt, unsigned char command)
{
bit_clr(LCD5110_GPIO, LCD5110_SCE); //sce=0;
if(command) bit_set(LCD5110_GPIO, LCD5110_DC);//dc=command;
else bit_clr(LCD5110_GPIO, LCD5110_DC);
SPI_I2S_SendData(SPI2, dt); // SPI2 发送一个字节
while(SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_TXE) == RESET); // 等待 SPI2 发送完毕
bit_set(LCD5110_GPIO, LCD5110_SCE);//dc=1;
}
/*---------------------------------------
LCD_init: 3310LCD初始化
----------------------------------------- */
void Init_LCD5110(void)
{
Init_SPI();
bit_clr(LCD5110_GPIO, LCD5110_RES);//res=0;
delay_ms(1);
bit_set(LCD5110_GPIO, LCD5110_RES);//res=1;
LCD_write_byte(0x21,0);//初始化Lcd,功能设定使用扩充指令
LCD_write_byte(0xc8,0);//Vlcd=3.06+(VOP)*0.06,本例VOP为0B0101 0000为十进制的80,Vlcd=7.86V
LCD_write_byte(0x20,0);//使用基本指令
LCD_write_byte(0x0C,0);//设定显示模式,正常显示
}
/*-------------------------------------------
LCD_set_XY: 设置LCD坐标函数
输入参数:X:0-83 Y:0-5
---------------------------------------------*/
void LCD_set_XY(unsigned char X, unsigned char Y)
{
LCD_write_byte(0x40 | Y, 0);// column
LCD_write_byte(0x80 | X, 0);// row
}
/*------------------------------------------
LCD_clear: LCD清屏函数
--------------------------------------------*/
void LCD_clear(void)
{
unsigned char t;
unsigned char k;
LCD_set_XY(0, 0);
for(t=0; t<6; t++)
{
for(k=0; k<84; k++)
LCD_write_byte(0x00, 1);
}
}
/***************************************************
// 输出英文字符(底层)
****************************************************/
void LcdPutEnChar(unsigned char x, unsigned char y, unsigned char c)
{
unsigned char line;
c -= 32;
LCD_set_XY(x, y);
for (line=0; line<6; line++)
LCD_write_byte(font6x8[c][line], 1);
}
/***************************************************
// 输出中文字符(底层)
****************************************************/
void LcdPutCnChar(unsigned char x, unsigned char y, unsigned short int c)
{
unsigned char k=0;
unsigned char j=0;
unsigned char i=0;
unsigned short int m=0;
for(k=0; k<sizeof(CnPix)/34; k++)
{
m = (CnPix[k*34+1]<<8) | CnPix[k*34];
if(m == c)
break;
}
if(k == sizeof(CnPix)/34) return;
for(i=0; i<2; i++)
{
LCD_set_XY(x, y++);
for(j=0; j<16; j++)
LCD_write_byte(CnPix[k*34+2+16*i+j], 1);
}
}
/***************************************************
// 输出字符串(应用层)
****************************************************/
void LcdPutString(unsigned char x, unsigned char y, const char *s)
{
while(*s != 0)
{
if(*s < 128)
{
LcdPutEnChar(x, y, *s);
s += 1;
x += 6;
if(x >= 84) {x = 0; y += 1; if(y >= 6) y = 0;}
}
else
{
LcdPutCnChar(x, y, *(unsigned short int *)s);
s += 2;
x += 16;
}
}
}
/***************************************************
//整数输出函数
****************************************************/
void LcdPutInt(unsigned char x, unsigned char y, int n)
{
sprintf(str_temp,"%d",n);
LcdPutString(x,y,str_temp);
}
/***************************************************
//浮点数输出函数
****************************************************/
void LcdPutFloat(unsigned char x, unsigned char y,float f)
{
//sprintf(str_temp,"%d.%3d",(int)f,(int)((fabs(f)-fabs((int)f))*1000)%1000);
//sprintf(str_temp,"%d.%3d",(int)f,(int)((fabs(f)-(int)fabs(f))*1000)%1000);
int i=(int)f;//整数
int j=(int)fabs((f-i)*1000);//小数
int k3=(int)(j/100);
int k2=(int)(j%100/10);
int k1=(int)(j%100%10);
sprintf(str_temp,"%d.%d%d%d",i,k3,k2,k1);
LcdPutString(x,y,str_temp);
}
/***************************************************
// 绘画位图
// x : x位置
// y : y位置
// pBmp : 位图
// row : 位图行数
// col : 位图列数
****************************************************/
void LcdDrawBitmap(unsigned char x, unsigned char y, unsigned char col, unsigned char row, unsigned char *pBmp)
{
unsigned char i=0;
unsigned char j=0;
if((col > 84) || (row > 6))
return;
for(i=0; i<row; i++)
{
LCD_set_XY(x, y);
for(j=0; j<col; j++)
LCD_write_byte(pBmp[i*col+j], 1);
y++;
}
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -