Integrating network data, it is summarized as follows
After checking the data sheet
RS can be selected as any one of PD11 PD12 PD13.
The picture above is the ze color screen interface of Beite Technology.
WR selects PD5, RD selects PD4, cs selects PD7.
About its use
//Write 16-bit data function
#define Bank1_LCD_D ((uint32_t)0x60020000) //disp Data ADDR
void LCD_WR_Data(unsigned int val)
{
*(__IO uint16_t *) (Bank1_LCD_D)= val;
}
Write the data to the memory at 0x60020000. The data will be sent to the LCD controller by STM32 through the FSMC hardware without intervention. It can be understood that the data entry of the LCD controller is mapped to the memory at 0x60020000. The command will be ((uint32_t)0x60000000). It is
easy to use. How to configure it? Originally, I thought it was troublesome and gave up..................
Okay, here is a method to fix FSMC as the complete configuration of 8080 communication.
/*-- FSMC Configuration ---------------------------------------------------------*/
void FSMC_LCD_Init(void)
{
FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure;
FSMC_NORSRAMTimingInitTypeDef p;
/* FSMC_Bank1_NORSRAM1 timing configuration */
p.FSMC_AddressSetupTime = 0x01;/*Address setup time limit*/
p.FSMC_AddressHoldTime = 0x00;/*Address hold time*/
p.FSMC_DataSetupTime = 0x05;/*Set data time limit*/
p.FSMC_BusTurnAroundDuration = 0x00;/*Bus turnaround time*/
p.FSMC_CLKDivision = 0x00;/*The number of HCLK cycles of the CLK clock output signal represents the time???*/
p.FSMC_DataLatency = 0x00;/*Specify the clock cycle before getting the first data*/
p.FSMC_AccessMode = FSMC_AccessMode_B;
FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM1;/*Specified FSMC bank*/
FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable; /*Data bus with non-multiplexed address and data values*/
FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_NOR;/*Type of external memory*/
FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;/*Data width*/
FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;/* Disable burst access mode*/
FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;/*Specify the polarity of the wait signal*/
FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;/*Enables or disables the Wrapped burst access mode for Flash*/
FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;/*Enable the write operation of the specified FSMC block*/
FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;/*Extended mode*/
FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;/*Disable write burst operation*/
FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;
FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;
FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
/* Enable FSMC Bank1_SRAM Bank */
FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM1, ENABLE);
}
Why should it be written like this? ? Can it be written in another way? ? ?
FSMC has several blocks and the memory mapped by each block is different. Of course, it is not the only way to write it like this. If you want to understand the meaning of each function parameter in detail, you have to look up the data sheet yourself. It is not enough to write it here. Just understand that the timing configuration in front is about the trial time limit, and the one behind is about the timing. Changing the parameters in the timing configuration can make the timing complete faster and the communication speed faster.
FSMC配置还后 液晶屏怎么连到单片机上?
/* GPIO Configuration */
void GPIO_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/* Enable the FSMC AND GPIO Clock */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC |
RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE , ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13; //LED1
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOE, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; //LCD 背光控制
GPIO_Init(GPIOE, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 ; //LCD-RST
GPIO_Init(GPIOE, &GPIO_InitStructure);
/* Set PD.00(D2), PD.01(D3), PD.04(NOE/RD), PD.05(NWE/WR), PD.08(D13), PD.09(D14),
PD.10(D15), PD.14(D0), PD.15(D1) as alternate function push pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_5 |
GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_14 |
GPIO_Pin_15;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOD, &GPIO_InitStructure);
/* Set PE.07(D4), PE.08(D5), PE.09(D6), PE.10(D7), PE.11(D8), PE.12(D9), PE.13(D10),
PE.14(D11), PE.15(D12) as alternate function push pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 |
GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 |
GPIO_Pin_15;
GPIO_Init(GPIOE, &GPIO_InitStructure);
/* CS 为FSMC_NE1(PD7) */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7;
GPIO_Init(GPIOD, &GPIO_InitStructure);
/* RS 为FSMC_A16(PD11)*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 ;
GPIO_Init(GPIOD, &GPIO_InitStructure);
GPIO_SetBits(GPIOD, GPIO_Pin_7); //CS=1
GPIO_SetBits(GPIOD, GPIO_Pin_11); //RS=1
GPIO_SetBits(GPIOD, GPIO_Pin_14| GPIO_Pin_15 |GPIO_Pin_0 | GPIO_Pin_1);
GPIO_SetBits(GPIOE, GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10);
GPIO_SetBits(GPIOE, GPIO_Pin_0); //LIGHT关
GPIO_SetBits(GPIOE, GPIO_Pin_1); //RESET=1
GPIO_SetBits(GPIOD, GPIO_Pin_4); //RD=1
GPIO_SetBits(GPIOD, GPIO_Pin_5); //WR=1
}
FSMC is hardware WR RD RS CS. These are all designated pins.
RD PD.04
WR PD.05
CS PD.07
RS PD.11.
The data port uses PE and PD
. This connection is only suitable for the previous FSMC configuration. Other configuration pins will change. You can check the manual. They are all in Chinese.
In this way, the reading and writing of commands and data can be completed at the following addresses.
#define Bank1_LCD_D ((uint32_t)0x60020000) //disp Data ADDR
#define Bank1_LCD_C ((uint32_t)0x60000000) //disp Reg ADDR
//Write register address function
void LCD_WR_REG(unsigned int index)
{
*(__IO uint16_t *) (Bank1_LCD_C)= index;
}
//Write register data function
void LCD_WR_CMD(unsigned int index,unsigned int val)
{
*(__IO uint16_t *) (Bank1_LCD_C)= index;
*(__IO uint16_t *) (Bank1_LCD_D)= val;
}
//Write 16-bit data function
void LCD_WR_Data(unsigned int val)
{
*(__IO uint16_t *) (Bank1_LCD_D)= val;
}
Previous article:FSMC only uses the data port address line and has no problem debugging
Next article:Problems with playing MP3 cards on vs1003
Recommended ReadingLatest update time:2024-11-16 13:42
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Will Too Many Vias in the RF PCB Power Layer Affect Power Integrity?
- "Recommend Chinese Chip" + Qinheng CH579
- Radar technology is changing the three trends in the cockpit sensing market
- Safety Y1 & Y2 capacitors
- Protel 99 SE and AD have copper holes and copper grooves
- It was such an accident that I bought a NUCLEO-G474
- Are the saturation of light and the brightness of light the same concept? If they are different, what property of light does saturation refer to?
- Finally, TMS320F28379D is dead
- Implementing HDMI with FPGA
- Help, how to find LVDS7:1 IP in Gaoyun Cloud Source Software