STM32F10X系列LCD屏的配置及子函数
来源:互联网 发布:知乎live 百度网盘 编辑:程序博客网 时间:2024/06/03 20:44
首先是LCD的RAM写子函数:
void LCD_WriteRAM(u16 RGB_Code){ GPIO_SetBits(LCD_RS_PORT,LCD_RS_PIN); GPIO_Write(LCD_PORT_PORT,RGB_Code>>8); //Delay(5); GPIO_ResetBits(LCD_WR_PORT,LCD_WR_PIN); //Delay(10); GPIO_SetBits(LCD_WR_PORT,LCD_WR_PIN); GPIO_Write(LCD_PORT_PORT,RGB_Code); // Delay(10); GPIO_ResetBits(LCD_WR_PORT,LCD_WR_PIN); //Delay(10); GPIO_SetBits(LCD_WR_PORT,LCD_WR_PIN);}
LCD从RAM读取字符并进行显示的子函数:
void LCD_DrawChar(u8 Xpos, u16 Ypos, const u16 *c){ u32 index = 0, i = 0; u8 Xaddress = 0; Xaddress = Xpos; LCD_SetCursor(Xaddress, 319-Ypos); for(index = 0; index < 24; index++) { LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ for(i = 0; i < 16; i++) { if((c[index] & (1 << i)) == 0x00) { LCD_WriteRAM(BackColor); } else { LCD_WriteRAM(TextColor); } } LCD_CtrlLinesWrite(LCD_NCS_GPIO_PORT, LCD_NCS_PIN, Bit_SET); Xaddress++; LCD_SetCursor(Xaddress, 319-Ypos); }}
void LCD_DisplayChar(u8 Line, u16 Column, u8 Ascii){ Ascii -= 32; LCD_DrawChar(Line, Column, &ASCII_Table[Ascii * 24]);}
void LCD_ShowNum(uint8_t x,uint16_t y,uint16_t data){LCD_DisplayChar(x,y,data/10000+48); LCD_DisplayChar(x,(y+25),data%10000/1000+48); // %10000LCD_DisplayChar(x,(y+50),data%1000/100+48); LCD_DisplayChar(x,(y+75),data%100/10+48); LCD_DisplayChar(x,(y+100),data%10+48);}
可以用于主函数的字符显示函数:
void LCD_DisplayStringLine(u8 Line, u8 *ptr){ u32 i = 0; u16 refcolumn =0; /* Send the string character by character on lCD */ while ((*ptr != 0) & (i < 20)) { /* Display one character on LCD */ LCD_DisplayChar(Line*FONT_HEIGHT, refcolumn, *ptr); /* Decrement the column position by 16 */ refcolumn += FONT_WIDTH; /* Point on the next character */ ptr++; /* Increment the character counter */ i++; }}
阅读全文
0 0
- STM32F10X系列LCD屏的配置及子函数
- STM32F10x的LCD(ILI9320)显示
- STM32F10x的LCD(ILI9320)显示
- 子函数配置
- STM32F10x系列的MCU配置PB3和PB4为普通IO口
- STM32F10X系列的MCU配置PB3和PB4为普通IO口
- STM32F10X的时钟树及时钟初始化
- stm32f10x在keil环境下的配置
- AM335x关于LCD屏幕的配置--TI--Sitara AM335x系列
- STM32F10X系列工程模板
- LCD的配置
- 指针在子函数中动态分配空间的问题及解决方法
- 【聚沙成塔】CooCox已更新STM32F10x及LPC12xx的组件&例程
- STM32F10x烧些出错的问题及解决方案
- 函数调用子函数,注意子函数的位置
- STM32F10X系列GPIO外部中断
- STM32f10x系列工程建立演示
- 栈的子函数
- Spark核心源码分析与开发实战(1)-----------SSH hadoop spark集群部署
- IIS配置问题
- oracle数据库表空间 追加数据库文件
- 第2周项目--程序的多文件组织
- mysql 死锁问题
- STM32F10X系列LCD屏的配置及子函数
- java继承之(隐式或显式)调用父类的构造函数
- xor
- Dubbo的使用方法
- LeetCode.338 Counting Bits
- springmvc 绑定枚举类型数据
- CodeForces
- MobileNets
- Eclipse解决Ctrl+C、Ctrl+V卡顿反应慢的方法