//下面是正点原子提供的开发板例程的源码:
=============================================================
//初始化lcdffice ffice" />
//该初始化函数可以初始化各种ILI93XX液晶,但是其他函数是基于ILI9320的!!!
//在其他型号的驱动芯片上没有测试!
void LCD_Init(void)
{
RCC->APB2ENR|=1<<3; //先使能外设PORTB时钟
RCC->APB2ENR|=1<<4; //先使能外设PORTC时钟
RCC->APB2ENR|=1<<0; //开启辅助时钟
……………………..
LCD_WriteReg(0x0000,0x0001);
delay_ms(50); // delay 50 ms
DeviceCode = LCD_ReadReg(0x0000);
printf(" LCD ID:%x\n",DeviceCode); //打印LCD ID
if(DeviceCode==0x9325||DeviceCode==0x9328)//ILI9325
{
LCD_WriteReg(0x00e7,0x0010);
LCD_WriteReg(0x0000,0x0001); //开启内部时钟
LCD_WriteReg(0x0001,0x0100);
LCD_WriteReg(0x0002,0x0700); //电源开启
LCD_WriteReg(0x0003,(1<<12)|(3<<4)|(0<<3) );//65K
LCD_WriteReg(0x0004,0x0000);
LCD_WriteReg(0x0008,0x0207);
LCD_WriteReg(0x0009,0x0000);
LCD_WriteReg(0x000a,0x0000); //display setting
LCD_WriteReg(0x000c,0x0001); //display setting
LCD_WriteReg(0x000d,0x0000); //0f3c
LCD_WriteReg(0x000f,0x0000);
……………………..
==============================================================
疑问:
1、LCD_WriteReg(0x00e7,0x0010);
//这一句是否是往0xE7寄存器写命令0x0010? 芯片手册上(因为printf(" LCD ID:%x\n",DeviceCode)这一行打印出的ID号为37672,即0x9328,固我参看的是ILI9328的芯片手册)并没有找到0xE7寄存器啊
2、LCD_WriteReg(0x0000,0x0001); //开启内部时钟
芯片手册上已说明0x0000寄存器是只读寄存器,读出芯片的ID号,这里为什么写0x0001就表示开启内部时钟?
-------------芯片手册上的说明------------
ffice:smarttags" />7.2.2. ID code (R00h)
R/W
|
RS
|
D15
|
D14
|
D13
|
D12
|
D11
|
D10
|
D9
|
D8
|
D7
|
D6
|
D5
|
D4
|
D3
|
D2
|
D1
|
D0
|
RO
|
1
|
1
|
0
|
0
|
1
|
0
|
0
|
1
|
1
|
0
|
0
|
1
|
0
|
1
|
0
|
0
|
0
|
The device code “9328”h is read out when read this register.
----------------------------------------- |