stm32驱动12832液晶屏程序(ST7565R控制器)
Posted tianqiang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了stm32驱动12832液晶屏程序(ST7565R控制器)相关的知识,希望对你有一定的参考价值。
LCD12832.c文件: #include"stm32f10x_lib.h" #include "OCM12232.h" void Lcd12232delay(unsigned int Time)//延时函数 { unsigned int i,j; for ( i=0;i<Time;i++) for (j=0;j<100;j++); } void Delay(unsigned int us)//延时微秒 { unsigned int i; for ( i=0;i<us;i++); } void LCD_WriteLByte(u8 Byte)//写PC口的低8位,高8位不变 { u16 Data_PAL; Data_PAL = GPIO_ReadOutputData(GPIOC); Data_PAL = Data_PAL&0xFF00;//保留高8位数据 Data_PAL = Data_PAL | Byte;//写入低8位数据 GPIO_Write(GPIOC,Data_PAL ); } void w_com(unsigned char Byte)//向LCD写指令 { A0_0; CS_0; RD_1; WR_0; Delay(2); LCD_WriteLByte(Byte); Delay(2); WR_1; } void w_data(unsigned char data)//向LCD写数据 { A0_1; CS_0; RD_1; WR_0; Delay(2); LCD_WriteLByte(data); Delay(2); WR_1; } void SetStartPage(u8 StartPageAddress)//设置起始页面地址 { w_com(0xB0|StartPageAddress); } void SetStartColumn(u8 StartColumnAddress)//设置起始列地址 { w_com(0x10|StartColumnAddress); } void SetStartLine(u8 StartLineAddress)//设置起始行地址 { w_com(0x40|StartLineAddress); } void clrscr(void)//清屏 { u8 i,page; for(page=0xb0;page<0xb4;page++) { w_com(page); w_com(0x10);//列地址,高低字节两次写入,从第0列开始 w_com(0x40);//行地址,从第0行开始 for(i=0;i<128;i++) {w_data(0);} } } void ClrOnePage(unsigned StartPage)//清除一页 { u8 i; w_com(0xb0+StartPage);//页地址 w_com(0x10);//列地址,从第0列开始 w_com(0x40);//行地址,从第0行开始 for(i=0;i<128;i++) {w_data(0);} } void ClrNumColumn(unsigned char StartPage,unsigned char StartColumn,unsigned Num)//清除StartPage页从StartColumn个汉字位置开始的Num列 { u8 i; w_com(0xb0+StartPage); w_com(0x10+StartColumn); w_com(0x40);//行地址,从第0行开始 for(i=0;i<Num;i++) {w_data(0);} } void Displayhz(unsigned char num,const unsigned char *p)//从(0,0)开始显示num个16*16的汉字(包括标点符号) { u8 i,j; if(num<=8) { w_com(0xb0); w_com(0x10);//列地址,从第0列开始 w_com(0x40);//行地址,从第0行开始 for(i=0;i<8;i++) { for(j=0;j<16;j++) { if(16*2*i+j<32*num) {w_data(p[16*2*i+j]);} } } w_com(0xb1); w_com(0x10);//列地址,从第0列开始 w_com(0x40);//行地址,从第0行开始 for(i=0;i<8;i++) { for(j=0;j<16;j++) { if(16*(2*i+1)+j<32*num) {w_data(p[16*(2*i+1)+j]);} } } } else if(num>8) { w_com(0xb0); w_com(0x10);//列地址,从第0列开始 w_com(0x40);//行地址,从第0行开始 for(i=0;i<8;i++) { for(j=0;j<16;j++) { if(16*2*i+j<32*num) {w_data(p[16*2*i+j]);} } } w_com(0xb1); w_com(0x10);//列地址,从第0列开始 w_com(0x40);//行地址,从第0行开始 for(i=0;i<8;i++) { for(j=0;j<16;j++) { if(16*(2*i+1)+j<32*num) {w_data(p[16*(2*i+1)+j]);} } } w_com(0xb2); w_com(0x10);//列地址,从第0列开始 w_com(0x40);//行地址,从第0行开始 for(i=8;i<16;i++) { for(j=0;j<16;j++) { if(16*2*i+j<32*num) {w_data(p[16*2*i+j]);} } } w_com(0xb3); w_com(0x10);//列地址,从第0列开始 w_com(0x40);//行地址,从第0行开始 for(i=8;i<16;i++) { for(j=0;j<16;j++) { if(16*(2*i+1)+j<32*num) {w_data(p[16*(2*i+1)+j]);} } } } } void DisplayHz(unsigned char StartPage,unsigned char column,unsigned char Num,const unsigned char *p)//从StartPage页的第Column个汉字位置开始显示Num个汉字 { u8 i,j; w_com(0xb0+StartPage); w_com(0x10+column);//列地址,从第0列开始 w_com(0x40);//行地址,从第0行开始 for(i=0;i<Num;i++) { for(j=0;j<16;j++) {w_data(p[16*2*i+j]);} } w_com(0xb1+StartPage); w_com(0x10+column);//列地址,从第column个汉字列开始 w_com(0x40);//行地址,从第0行开始 for(i=0;i<Num;i++) { for(j=0;j<16;j++) {w_data(p[16*(2*i+1)+j]);} } } void DisplayZf(unsigned char StartPage,unsigned char column,unsigned char Num,const unsigned char *p)//从StartPage页的第Column个字符位置开始显示Num个8*16的字符 { u8 i,j; w_com(0xb0+StartPage); w_com(0x10+column);//列地址,从第0列开始 w_com(0x40);//行地址,从第0行开始 for(i=0;i<Num;i++) { for(j=0;j<8;j++) {w_data(p[8*2*i+j]);} } w_com(0xb1+StartPage); w_com(0x10+column);//列地址,从第0列开始 w_com(0x40);//行地址,从第0行开始 for(i=0;i<Num;i++) { for(j=0;j<8;j++) {w_data(p[8*(2*i+1)+j]);} } } void DisplayZF(unsigned char num,const unsigned char *p)//从(0,0)开始显示num个8*16的汉字(包括标点符号) { u8 i,j; if(num<=16) { w_com(0xb0); w_com(0x10);//列地址,从第0列开始 w_com(0x40);//行地址,从第0行开始 for(i=0;i<16;i++) { for(j=0;j<8;j++) { if(8*2*i+j<16*num) {w_data(p[8*2*i+j]);} } } w_com(0xb1); w_com(0x10);//列地址,从第0列开始 w_com(0x40);//行地址,从第0行开始 for(i=0;i<16;i++) { for(j=0;j<8;j++) { if(8*(2*i+1)+j<16*num) {w_data(p[8*(2*i+1)+j]);} } } } else if(num>16) { w_com(0xb0); w_com(0x10);//列地址,从第0列开始 w_com(0x40);//行地址,从第0行开始 for(i=0;i<16;i++) { for(j=0;j<8;j++) { if(8*2*i+j<16*num) {w_data(p[8*2*i+j]);} } } w_com(0xb1); w_com(0x10);//列地址,从第0列开始 w_com(0x40);//行地址,从第0行开始 for(i=0;i<16;i++) { for(j=0;j<8;j++) { if(8*(2*i+1)+j<16*num) {w_data(p[8*(2*i+1)+j]);} } } w_com(0xb2); w_com(0x10);//列地址,从第0列开始 w_com(0x40);//行地址,从第0行开始 for(i=16;i<32;i++) { for(j=0;j<8;j++) { if(8*2*i+j<16*num) {w_data(p[8*2*i+j]);} } } w_com(0xb3); w_com(0x10);//列地址,从第0列开始 w_com(0x40);//行地址,从第0行开始 for(i=16;i<32;i++) { for(j=0;j<8;j++) { if(8*(2*i+1)+j<16*num) {w_data(p[8*(2*i+1)+j]);} } } } } void display_map(const unsigned char *p)//显示128*32的图片,p是图片数据首地址 { unsigned char seg; unsigned char page; for(page=0xb0;page<0xb4;page++)//写页地址共4页0xb0--0xb3 { w_com(page); w_com(0x10);//列地址,高低字节两次写入,从第0列开始 w_com(0x40);//行地址,从第0行开始 for(seg=0;seg<128;seg++)//写128列 {w_data(*p++);} } } void LCD_Init()//LCD初始化 { RES_0; Lcd12232delay(10); RES_1; w_com(0xaf);//ON DSIPLAY w_com(0x40);//START Line DISPLAY w_com(0xa0);//ADC正常 //w_com(0xa1);//ADC反向 w_com(0xa6);//正常显示 //w_com(0xa7);//反白显示 w_com(0xa4);//CLEAR--Normal Modle //w_com(0xa5);//全屏显示 w_com(0xa2);//1/9BIAS--1/9偏置设置 //w_com(0xa3);//1/7BIAS--1/7偏置设置 w_com(0xc8);//COMMON OUTPUT DIRECTION //w_com(0xc0); w_com(0x2f);//POWER CONTROL w_com(0x20);//RESISTER RATIO--粗调 w_com(0x81);//VOLUM MODE SET w_com(0x20);//RESISTER RATIO--细调 } LCD12832.h文件: #ifndef _OCM12232_h_ #define _OCM12232_h_ #define CS_1 GPIO_SetBits(GPIOC, GPIO_Pin_8) //取消LCD片选 #define CS_0 GPIO_ResetBits(GPIOC, GPIO_Pin_8) //LCD片选有效 #define RES_1 GPIO_SetBits(GPIOC, GPIO_Pin_9) //LCD低电平复位,复位之后保持高电平 #define RES_0 GPIO_ResetBits(GPIOC, GPIO_Pin_9) //LCD复位 #define A0_1 GPIO_SetBits(GPIOC, GPIO_Pin_10) //Ao=1,向LCD输入数据 #define A0_0 GPIO_ResetBits(GPIOC, GPIO_Pin_10) //Ao=0,向LCD写入指令 #define WR_1 GPIO_SetBits(GPIOC, GPIO_Pin_11) //LCD写禁止 #define WR_0 GPIO_ResetBits(GPIOC, GPIO_Pin_11) //LCD写允许 #define RD_1 GPIO_SetBits(GPIOC, GPIO_Pin_12) //LCD读禁止 #define RD_0 GPIO_ResetBits(GPIOC, GPIO_Pin_12) //LCD读允许 void Lcd12232delay(unsigned int Time);//延时函数 void LCD_WriteLByte(u8 Byte);//写PC口的低8位,高8位不变 void w_com(unsigned char Byte);//向LCD写指令 void w_data(unsigned char data);//向LCD写数据 void SetStartPage(u8 StartPageAddress);//设置起始页面地址 void SetStartColumn(u8 StartColumnAddress);//设置起始列地址 void SetStartLine(u8 StartLineAddress);//设置起始行地址 void clrscr(void);//清屏 void ClrOnePage(unsigned StartPage);//清除一页 void ClrNumColumn(unsigned char StartPage,unsigned char StartColumn,unsigned Num);//清除StartPage页从StartColumn个汉字位置开始的Num列 void Displayhz(unsigned char num,const unsigned char *p);//从(0,0)开始显示num个16*16的汉字(包括标点符号) void DisplayHz(unsigned char StartPage,unsigned char column,unsigned char Num,const unsigned char *p);//从StartPage页的第Column个汉字位置开始显示Num个汉字 void DisplayZf(unsigned char StartPage,unsigned char column,unsigned char Num,const unsigned char *p);//从StartPage页的第Column个字符位置开始显示Num个8*16的字符 void DisplayZF(unsigned char num,const unsigned char *p);//从(0,0)开始显示num个8*16的汉字(包括标点符号) void display_map(const unsigned char *p);//显示128*32的图片,p是图片数据首地址 void LCD_Init();//LCD初始化 #endif hw_conf.C文件: #include"stm32f10x_lib.h" #include "hw_conf.h" #include "OCM12232.h" ErrorStatus HSEStartUpStatus; void RCC_Configuration(void) { RCC_DeInit(); RCC_HSEConfig(RCC_HSE_ON); HSEStartUpStatus = RCC_WaitForHSEStartUp(); if(HSEStartUpStatus == SUCCESS) { FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable); FLASH_SetLatency(FLASH_Latency_2); RCC_HCLKConfig(RCC_SYSCLK_Div1); RCC_PCLK2Config(RCC_HCLK_Div1); RCC_PCLK1Config(RCC_HCLK_Div2); RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9); RCC_PLLCmd(ENABLE); while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET) { } RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK); while(RCC_GetSYSCLKSource() != 0x08) { } } RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE); } void GPIO_Configuration(void) { GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(GPIOC, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(GPIOC, &GPIO_InitStructure); } void NVIC_Configuration(void) { #ifdef VECT_TAB_RAM NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0); #else NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0); #endif } void Setup_System(void) { RCC_Configuration(); GPIO_Configuration(); NVIC_Configuration(); } hw_conf.h文件: #ifndef _hw_conf_H_ #define _hw_conf_H_ extern void Setup_System(void); #endif main.c文件: #include"stm32f10x_lib.h" #include "hw_conf.h" #include"OCM12232.h" const unsigned char tab4[]={ /*-- 文字: 武 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x10,0x10,0x14,0x14,0x14,0xD4,0x14,0x14,0x10,0x7F,0x90,0x12,0x14,0x10,0x10,0x00, 0x40,0x40,0x7F,0x20,0x20,0x1F,0x11,0x11,0x01,0x00,0x07,0x18,0x20,0x40,0xF0,0x00, /*-- 文字: 汉 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x10,0x60,0x01,0x86,0x60,0x04,0x1C,0xE4,0x04,0x04,0x04,0xE4,0x1C,0x04,0x00,0x00, 0x04,0x04,0x7E,0x01,0x40,0x20,0x20,0x10,0x0B,0x04,0x0B,0x10,0x30,0x60,0x20,0x00, /*-- 文字: 普 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x40,0x44,0x54,0x64,0x45,0x7E,0x44,0x44,0x44,0x7E,0x45,0x64,0x54,0x44,0x40,0x00, 0x00,0x00,0x00,0xFF,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0xFF,0x00,0x00,0x00,0x00, /*-- 文字: 仕 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x80,0x40,0xF0,0x1C,0x27,0x22,0x20,0x20,0x20,0xFF,0x20,0x20,0x20,0x30,0x20,0x00, 0x00,0x00,0x7F,0x00,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x30,0x20,0x00, /*-- 文字: 数 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 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, /*-- 文字: 控 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x08,0x08,0x08,0xFF,0x88,0x48,0x00,0x98,0x48,0x28,0x0A,0x2C,0x48,0xD8,0x08,0x00, 0x02,0x42,0x81,0x7F,0x00,0x00,0x40,0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x40,0x00, /*-- 文字: 科 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x10,0x12,0x92,0x72,0xFE,0x51,0x91,0x00,0x22,0xCC,0x00,0x00,0xFF,0x00,0x00,0x00, 0x04,0x02,0x01,0x00,0xFF,0x00,0x04,0x04,0x04,0x02,0x02,0x02,0xFF,0x01,0x01,0x00, /*-- 文字: 技 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x08,0x08,0x88,0xFF,0x48,0x28,0x00,0xC8,0x48,0x48,0x7F,0x48,0xC8,0x48,0x08,0x00, 0x01,0x41,0x80,0x7F,0x00,0x40,0x40,0x20,0x13,0x0C,0x0C,0x12,0x21,0x60,0x20,0x00, /*-- 文字: 有 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x00,0x04,0x84,0x44,0xE4,0x34,0x2C,0x27,0x24,0x24,0x24,0xE4,0x04,0x04,0x04,0x00, 0x02,0x01,0x00,0x00,0xFF,0x09,0x09,0x09,0x29,0x49,0xC9,0x7F,0x00,0x00,0x00,0x00, /*-- 文字: 限 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0xFE,0x02,0x32,0x4E,0x82,0x00,0xFE,0x4A,0xCA,0x4A,0x4A,0x4A,0x7E,0x00,0x00,0x00, 0xFF,0x00,0x02,0x04,0x03,0x00,0xFF,0x40,0x20,0x03,0x0C,0x12,0x21,0x60,0x20,0x00, /*-- 文字: 公 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x00,0x00,0x80,0x40,0x30,0x0E,0x84,0x00,0x00,0x0E,0x10,0x60,0xC0,0x80,0x80,0x00, 0x00,0x01,0x20,0x70,0x28,0x24,0x23,0x31,0x10,0x10,0x14,0x78,0x30,0x01,0x00,0x00, /*-- 文字: 司 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x00,0x10,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x12,0x02,0x02,0xFE,0x00,0x00, 0x00,0x00,0x1F,0x04,0x04,0x04,0x04,0x04,0x04,0x0F,0x00,0x20,0x40,0x3F,0x00,0x00, /*-- 文字: 欢 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 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, /*-- 文字: 迎 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 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, /*-- 文字: 你 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x80,0x40,0xF0,0x2C,0x43,0x20,0x98,0x0F,0x0A,0xE8,0x08,0x88,0x28,0x1C,0x08,0x00, 0x00,0x00,0x7F,0x00,0x10,0x0C,0x03,0x21,0x40,0x3F,0x00,0x00,0x03,0x1C,0x08,0x00, /*-- 文字: ! --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x5F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; const unsigned char tab3[]={ /*-- 文字: 北 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x00,0x20,0x20,0x20,0x20,0xFF,0x00,0x00,0x00,0xFF,0x40,0x20,0x30,0x18,0x10,0x00, 0x10,0x30,0x18,0x08,0x04,0x7F,0x00,0x00,0x00,0x3F,0x40,0x40,0x40,0x40,0x78,0x00, /*-- 文字: 京 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x00,0x04,0x04,0xE4,0x24,0x24,0x25,0x26,0x24,0x24,0x24,0xE4,0x06,0x04,0x00,0x00, 0x00,0x20,0x10,0x19,0x0D,0x41,0x81,0x7F,0x01,0x01,0x05,0x0D,0x38,0x10,0x00,0x00, /*-- 文字: 欢 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 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, /*-- 文字: 迎 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 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, /*-- 文字: 你 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x80,0x40,0xF0,0x2C,0x43,0x20,0x98,0x0F,0x0A,0xE8,0x08,0x88,0x28,0x1C,0x08,0x00, 0x00,0x00,0x7F,0x00,0x10,0x0C,0x03,0x21,0x40,0x3F,0x00,0x00,0x03,0x1C,0x08,0x00, /*-- 文字: ! --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x5F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; const unsigned char tab2[]={ /*-- 文字: A --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20, /*-- 文字: B --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00, /*-- 文字: C --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00, /*-- 文字: D --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00, /*-- 文字: E --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00, /*-- 文字: F --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00, /*-- 文字: G --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00, /*-- 文字: H --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20, /*-- 文字: I --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00, /*-- 文字: J --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00, /*-- 文字: K --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00, /*-- 文字: L --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00, /*-- 文字: M --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00, /*-- 文字: N --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00, /*-- 文字: 8 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00, /*-- 文字: 8 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00, /*-- 文字: 6 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00, /*-- 文字: 2 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00, /*-- 文字: 9 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00, /*-- 文字: 8 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00, /*-- 文字: 8 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00, /*-- 文字: J --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00, /*-- 文字: M --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00, /*-- 文字: A --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20, /*-- 文字: S --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00, /*-- 文字: D --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00, /*-- 文字: F --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00, /*-- 文字: G --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00, /*-- 文字: H --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20, }; const unsigned char tab5[]={ /*-- 调入了一幅图像:D:\My Documents\My Pictures\我爱你.bmp --*/ /*-- 宽度x高度=128x32 --*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x80,0x80,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xC0,0xC0,0xC0,0x80,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0xCE,0x00,0x00,0x84,0x00,0x00,0x00,0x04,0x80,0x48, 0x00,0x02,0x02,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE8,0xFF,0xB6,0x6F,0xFF,0xFB,0xFF,0xD0,0xE0, 0x40,0xE0,0xC0,0xE0,0xC0,0xE0,0xE0,0x60,0xA0,0xEE,0xFF,0xFB,0xDE,0x7F,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0xC0,0xC0,0xC0,0xC0,0xC4,0x9F, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x9C,0x9C,0x9E,0xFF,0xF3,0xF3,0xF3,0xFF,0xFF,0xFF, 0x7C,0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x22,0x50,0x10,0x0C,0x00,0x04,0x04,0x00, 0x0C,0x02,0x08,0x21,0x90,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0B,0x3F,0xDD,0xCF,0x8F,0x8E,0xCF,0xFE,0x37, 0x07,0x07,0x06,0x07,0x07,0x05,0x07,0x07,0x1F,0x3D,0xFE,0xEF,0xFF,0xF5,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x08,0x7E,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x06,0x00,0x0C,0x10,0x08,0x00,0x08, 0x00,0x08,0x00,0x06,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,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,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; void main(void) { Setup_System(); LCD_Init(); clrscr();//清屏 while(1) { //display_map(tab3);//显示图片,p是图片数据首地址 //Display_hz(16,tab4); //Disp_ZF(2,2,10,tab2);//从page页的第Column个字符位置开始显示Num个字符 display_map(tab5);//显示图片,p是图片数据首地址 //Display_ZF(22,tab2); //Disp_Hz(0,1,6,tab4); //Lcd12232delay(20000); //Disp_Hz(2,1,6,tab3); //ClrOnePage(1); //ClrNumColumn(1,2,64);//清除page页从16*StartColumn开始的Num列 //Lcd12232delay(200); } } 字模提取软件:zimo221,纵向取模,字节倒序。
以上是关于stm32驱动12832液晶屏程序(ST7565R控制器)的主要内容,如果未能解决你的问题,请参考以下文章