825 views|2 replies

445

Posts

0

Resources
The OP
 

【Fudan Microelectronics Automotive MCU FM33FT0A Series】--LCD screen display [Copy link]

This post was last edited by dirty on 2024-2-5 00:32

After a period of understanding and familiarity, this article implements the LCD display function.

1. Hardware Understanding

The development board has an onboard LCD display with a resolution of 172(H)RGB x320(V), a driver IC ST7789V3, and MCU driving control via the SPI interface. The hardware principle of the development board is as follows

Figure 1: LCD schematic connection

LCD screen pin MCU PIN Function

LCD_CS PE1 Chip select signal, low level is effective

LCD_DC PE2 Display data/command pin. Write command when low level, write data when high level

LCD_SDA PB14 data pin, ==MOSI

LCD_SCL PE0 clock pin, == SCK

LCD_RES PB15 Reset pin, low level reset

BLK PB9 Backlight pin, high level turns on the backlight

2. Code Preparation

1. Define the screen resolution and choose the horizontal or vertical screen mode. Here we use the horizontal screen mode.

#define USE_HORIZONTAL 3//2  //设置横屏或者竖屏显示 0或1为竖屏 2或3为横屏

#if USE_HORIZONTAL==0||USE_HORIZONTAL==1
#define LCD_W 172	
#define LCD_H 320

#else
#define LCD_W 320
#define LCD_H 172
#endif

2. SPI driver writing, can be IO simulation or hardware SPI, the former display refresh is slower, or the latter using DMA will be faster. Here we share ST7789V3 driver RGB screen initialization, the configuration is valid.

void LCD_Init(void)
{
	LCD_GPIO_Init();//初始化GPIO
	
	LCD_RES_Clr();//复位
	FL_DelayMs(30);
	LCD_RES_Set();
	FL_DelayMs(100);
	LCD_BLK_Set();//打开背光
	FL_DelayMs(100);
	
	LCD_WR_REG(0x11); 
//	FL_DelayMs(120); 
	LCD_WR_REG(0x36); 
	if(USE_HORIZONTAL==0)LCD_WR_DATA8(0x00);
	else if(USE_HORIZONTAL==1)LCD_WR_DATA8(0xC0);
	else if(USE_HORIZONTAL==2)LCD_WR_DATA8(0x70);
	else LCD_WR_DATA8(0xA0);

	LCD_WR_REG(0x3A);
	LCD_WR_DATA8(0x05);

	LCD_WR_REG(0xB2);
	LCD_WR_DATA8(0x0C);
	LCD_WR_DATA8(0x0C);
	LCD_WR_DATA8(0x00);
	LCD_WR_DATA8(0x33);
	LCD_WR_DATA8(0x33); 

	LCD_WR_REG(0xB7); 
	LCD_WR_DATA8(0x35);  

	LCD_WR_REG(0xBB);
	LCD_WR_DATA8(0x35);

	LCD_WR_REG(0xC0);
	LCD_WR_DATA8(0x2C);

	LCD_WR_REG(0xC2);
	LCD_WR_DATA8(0x01);

	LCD_WR_REG(0xC3);
	LCD_WR_DATA8(0x13);   

	LCD_WR_REG(0xC4);
	LCD_WR_DATA8(0x20);  

	LCD_WR_REG(0xC6); 
	LCD_WR_DATA8(0x0F);    

	LCD_WR_REG(0xD0); 
	LCD_WR_DATA8(0xA4);
	LCD_WR_DATA8(0xA1);

	LCD_WR_REG(0xD6); 
	LCD_WR_DATA8(0xA1);

	LCD_WR_REG(0xE0);
	LCD_WR_DATA8(0xF0);
	LCD_WR_DATA8(0x00);
	LCD_WR_DATA8(0x04);
	LCD_WR_DATA8(0x04);
	LCD_WR_DATA8(0x04);
	LCD_WR_DATA8(0x05);
	LCD_WR_DATA8(0x29);
	LCD_WR_DATA8(0x33);
	LCD_WR_DATA8(0x3E);
	LCD_WR_DATA8(0x38);
	LCD_WR_DATA8(0x12);
	LCD_WR_DATA8(0x12);
	LCD_WR_DATA8(0x28);
	LCD_WR_DATA8(0x30);

	LCD_WR_REG(0xE1);
	LCD_WR_DATA8(0xF0);
	LCD_WR_DATA8(0x07);
	LCD_WR_DATA8(0x0A);
	LCD_WR_DATA8(0x0D);
	LCD_WR_DATA8(0x0B);
	LCD_WR_DATA8(0x07);
	LCD_WR_DATA8(0x28);
	LCD_WR_DATA8(0x33);
	LCD_WR_DATA8(0x3E);
	LCD_WR_DATA8(0x36);
	LCD_WR_DATA8(0x14);
	LCD_WR_DATA8(0x14);
	LCD_WR_DATA8(0x29);
	LCD_WR_DATA8(0x32);
	
  
	LCD_WR_REG(0x11);
	FL_DelayMs(120);	
	LCD_WR_REG(0x29); 
}

3. UI interface design

Using the font extraction tool and image extraction tool, I designed the Fudan micro-official website logo, QQ avatar, Chinese characters, etc., supplemented by color matching, layout, etc.

void lcd_show(void)
{
    
    LCD_Fill(0,0,LCD_W,LCD_H,WHITE);
//    LCD_Fill(0,0,LCD_W,LCD_H,RED);
//    LCD_Fill(0,0,LCD_W,LCD_H,GREEN);
//    LCD_Fill(0,0,LCD_W,LCD_H,BLUE);
//    LCD_Fill(0,0,LCD_W,LCD_H,WHITE);
    LCD_ShowPicture(50,10,120,50,gImage_image_fdw);
    LCD_ShowChinese(180,19,"复旦微",BLUE,WHITE,32,0);
    
    LCD_ShowChinese(80,60,"车规系列",BLUE,WHITE,32,0);
    LCD_ShowString(220,60,"MCU",RED,WHITE,32,0);
    
    LCD_ShowString(80,100,"FM33FT056A",RED,WHITE,32,0);

	LCD_ShowPicture(140,130,40,40,gImage_1);
}

3. Test results

The display effect after compiling and burning is as follows

The overall display effect is good, and the function of driving the LCD screen is realized. If you want to make some rich interface displays later, you can use LVGL, which also lays a good foundation.

This post is from Automotive Electronics

Latest reply

Is the Fudan Micro-Website Logo displayed clearly?   Details Published on 2024-2-6 08:29

6579

Posts

0

Resources
2
 

Is the Fudan Micro-Website Logo displayed clearly?

This post is from Automotive Electronics

Comments

I took a screenshot from the webpage, it can be considered as a promotion, haha  Details Published on 2024-2-6 11:19
 
 

445

Posts

0

Resources
3
 
Jacktang posted on 2024-2-6 08:29 Is the Fudan micro-website logo displayed clearly?

I took a screenshot from the webpage, it can be considered as a promotion, haha

This post is from Automotive Electronics
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Featured Posts
Introduction to the series of books on "Easy Learning from Scratch"

Introduction to the series of books on "Easy Learning from Scratch" Preface to the Series 1. The significance of ...

What are the difficulties in designing DC power modules?

author: Happy Jianghu: I think: 1. Heat treatment. This should be the biggest limitation of power module desi ...

【McQueen Trial】McQueen's new ultrasonic drive

This is the simplest and most accurate HCSR04 driver currently available. (I will give a comparison of the accuracy of s ...

Could you please tell me what this operation of 1602 LCD means and what is its function?

492433492434

Technology to effectively prevent FPGA designs from being cloned

Technology to effectively prevent FPGA designs from being cloned

【i.MX6ULL】Driver Development——by DDZZ669

@DDZZ669 【i.MX6ULL】Driver Development 1——Character Device Development Template 【i.MX6ULL】Driver Development 2——N ...

How to use common mode inductors?

How to use common mode inductors? I don't have any application, but I've always been curious about this component. Let’ ...

【Mil STM32MP135】CANFD communication test

The Mir STM32MP135 development board integrates CAN FD peripherals. This test is CAN FD test. ST has built-in CAN FD Lin ...

[Digi-Key Follow me Issue 3] + Task 3: Play music using a buzzer

Seeed Studio XIAO ESP32C3 expansion board comes with a passive buzzer, which can be used for prompt tone and simple musi ...

[Industrial-grade intelligent control MCU D133CBS] + PWM output test

850298 A PWM-controlled passive buzzer is reserved in the IO of the development board. To drive it, an external oscill ...

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list