* Description : This file includes the LCD driver for AM-240320L8TNQW00H * (LCD_ILI9320) Liquid Crystal Display Module of STM3210E-EVAL * board. ////////////////////////////////////////////////////////////////////////////////////// /* Private typedef -----------------------------------------------------------*/ typedef struct { vu16 LCD_REG; vu16 LCD_RAM; } LCD_TypeDef; /* LCD is connected to the FSMC_Bank1_NOR/SRAM4 and NE4 is used as ship select signal */ #define LCD_BASE ((u32)(0x60000000 | 0x0C000000)) #define LCD ((LCD_TypeDef *) LCD_BASE) //////////////////////////////////////////////////////////////////////////////////////// void LCD_WriteReg(u8 LCD_Reg, u16 LCD_RegValue) { /* Write 16-bit Index, then Write Reg */ LCD->LCD_REG = LCD_Reg; /* Write 16-bit Reg */ LCD->LCD_RAM = LCD_RegValue; } ///////////////////////////////////////////////////////////////////////////////////////// u16 LCD_ReadReg(u8 LCD_Reg) { /* Write 16-bit Index (then Read Reg) */ LCD->LCD_REG = LCD_Reg; /* Read 16-bit Reg */ return (LCD->LCD_RAM); } ///////////////////////////////////////////////////////////////////////////////////////// void LCD_WriteRAM_Prepare(void) { LCD->LCD_REG = R34; } ///////////////////////////////////////////////////////////////////////////////////////// void LCD_WriteRAM(u16 RGB_Code) { /* Write 16-bit GRAM Reg */ LCD->LCD_RAM = RGB_Code; } 这是例程里lcd.c里的一下底层函数的实现。写LCD_ILI9320的寄存器用 LCD_WriteReg()函数, LCD->LCD_REG = LCD_Reg;是先发送reg的编号,为什么用 LCD->LCD_RAM = LCD_RegValue; 来实现发送 reg需要修改的数据啊? 在结构体里的定义:LCD_REG地址:0x6c000000,LCD_RAM地址:0x6c000001,STM32的FSMC的地址引脚A0接 LCD_ILI9320的RS(L:访问reg;H:访问ram) ,通过给LCD_REG或LCD_RAM写数据来实现访问reg和ram,是这样理解的吗? 那么为什么 LCD_WriteReg()函数里对reg写操作,是对LCD_RAM赋值啊?不懂。还有 LCD_ReadReg(u8 LCD_Reg)的读操作, 也不大明白,怎么实现的啊? 对LCD_ILI932里的reg,ram读写操作时,要给/WR(写入),/RD(读入) 信号的,在用FSMC模块时,程序里没涉及到这些读写信号啊? 高手指点下在下啊?FSMC控制LCD_ILI9320是个什么过程啊?小弟不胜感激! /* Write 16-bit Reg */ LCD->LCD_RAM = LCD_RegValue; } u16 LCD_ReadReg(u8 LCD_Reg) { /* Write 16-bit Index (then Read Reg) */ LCD->LCD_REG = LCD_Reg; /* Read 16-bit Reg */ return (LCD->LCD_RAM); } void LCD_WriteRAM_Prepare(void) { LCD->LCD_REG = R34; } void LCD_WriteRAM(u16 RGB_Code) { /* Write 16-bit GRAM Reg */ LCD->LCD_RAM = RGB_Code; } |
RE:STM32的关于LCD driver for AM-240320L8TNQW00H
回复:STM32的关于
在这个例程里,STM32的A0接LCD的RS脚信号,通过STM32地址线A0的0,1变换,来实现访问LCD_ILI9320里的reg和RAM。我想应该是这么实现的。但是,写reg的函数void LCD_WriteReg(u8 LCD_Reg, u16 LCD_RegValue)里,怎么是 LCD->LCD_RAM = LCD_RegValue;给RAM赋值呢?
RE:STM32的关于LCD driver for AM-240320L8TNQW00H例程的一些疑惑
因为该RAM地址是在片外的,即是TFT挂载的片外地址,所以直接赋值即可