How to use FSMC to connect LCD with 100-pin stm32f103v

Publisher:RainbowPromiseLatest update time:2015-09-21 Source: eefocusKeywords:stm32f103v  FSMC  LCD Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Regarding the use of FSMC to connect stm32 and LCD, most of the information on the Internet is about the STM32F103Z series, which has 144 pins and FSMC_A is relatively complete. But for the stm32f103v series with only 100 pins, some address lines do not exist, so how can we use the 8080 interface to connect LCD using the FSMC bus? To put it simply, how should the RS, CS, RD, and WR lines be connected?

Integrating network data, it is summarized as follows

After checking the data sheet

click to see the work

 

 

RS can be selected as any one of PD11 PD12 PD13.

1.jpg

The picture above is the ze color screen interface of Beite Technology.

 

2.jpg

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;     
}

Keywords:stm32f103v  FSMC  LCD Reference address:How to use FSMC to connect LCD with 100-pin stm32f103v

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

PIC microcontroller drives LCD1602 to display two lines of strings in a loop
#include pic.h __CONFIG(0x1832); //Chip configuration word, watchdog off, power-on delay on, power-off detection off, low voltage programming off, encryption, 4M crystal HS oscillation //LCD control line macro definition #define rs RA0   #define rw RA1 #define e RA2 char web = {"www.51hei.com"}; char tel = {"QQ
[Microcontroller]
my country's first 8.5-generation TFT-LCD glass substrate production line was ignited, the first localization
On June 18, the 8.5-generation TFT-LCD glass substrate production line independently developed and built by Bengbu Zhongguang Optoelectronics Technology Co., Ltd. based on the float glass process was ignited.        According to China National Radio, this is the first 8.5-generation TFT-LCD glass substrate productio
[Mobile phone portable]
Analysis of LCD driver of S3C2440 built-in Linux kernel
Let's first look at how applications operate the screen: Linux works in protected mode, so user-mode processes cannot use the interrupt calls provided in the graphics card BIOS to directly write to the screen like DOS does. Linux abstracts the FrameBuffer device for user-mode processes to write to the screen directl
[Microcontroller]
STM32 FSMC Study Notes
1. FSMC mechanism FSMC (Flexihie Static Memory Controller) is a unique storage control mechanism for high-storage density microcontrollers in the STM32 series that have internally integrated Flash of more than 256 KB and suffixes of xC, xD and xE. It is called "variable" because by setting special function registers,
[Microcontroller]
STM32 FSMC Study Notes
The world's first Dimensity 8000+ LCD screen flagship! Renderings of the suspected OPPO K10 are exposed
       According to currently known information, OPPO will hold a new product launch conference next week to officially launch the OPPO K10 series of mobile phones, which will be equipped with flagship chips across the board.   Today, the overseas website 91mobiles exposed the renderings of what is suspected to be the
[Mobile phone portable]
The world's first Dimensity 8000+ LCD screen flagship! Renderings of the suspected OPPO K10 are exposed
Implementation of 51 single-chip microcomputer and graphic LCD interface technology
In recent years, LCD has been increasingly used in instruments controlled by single-chip microcomputers. A good human-machine interface for instrument display has always been people's pursuit. Recently, a single-chip microcomputer was used to successfully display pictures on the EDM240128 graphic LCD. 1. Features o
[Microcontroller]
Implementation of 51 single-chip microcomputer and graphic LCD interface technology
Design and implementation of electronic price-computing scale based on AT89C51 single-chip microcomputer
1. Introduction With the development of electronic technology, weighing technology is also constantly improving. From the world level, weighing technology has gone through four stages, from the traditional mechanical scale composed of all mechanical components to the electromechanical combination scale that use
[Microcontroller]
Design and implementation of electronic price-computing scale based on AT89C51 single-chip microcomputer
Mitsubishi Electric decides to withdraw from LCD panel business; competition from Chinese manufacturers exceeds expectations
Following Samsung, Panasonic and other manufacturers, Mitsubishi Electric has also decided to withdraw from LCD panel production.   According to an announcement from Mitsubishi Electric, due to intensified competition and lack of profitability, its subsidiary Melco Display Technology Inc. (MDTI) will end TFT-LCD modul
[Embedded]
Mitsubishi Electric decides to withdraw from LCD panel business; competition from Chinese manufacturers exceeds expectations
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号