当前位置:网站首页>1.8tft color screen test code (stm32f407ve)
1.8tft color screen test code (stm32f407ve)
2022-07-28 22:52:00 【leu_ mon】
About STM32f4 And f1 Code for (1.8 " SPI Communication color screen ) Different learning
front said
I bought a piece on a treasure a few days ago stm32f407ve And a piece of 1.8 Inch color screen , But the color screen driver is f103 The driver , The differences between different chips are summarized in the modification process , Welcome to point out the mistakes .
One 、GPIO Initialization of port
stay stm32f103 in GPIO The initialization code of the port is as follows
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB ,ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0| GPIO_Pin_10| GPIO_Pin_1;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);
stay stm32f407 in GPIO The initialization code of the port is as follows
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB ,ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0| GPIO_Pin_10| GPIO_Pin_1;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);
You can see
- The functions called when initializing the clock and the representatives io The variable name of the port has changed .
RCC_APB2PeriphClockCmd ——> RCC_AHB1PeriphClockCmd
RCC_APB2Periph_GPIOB ——> RCC_AHB1Periph_GPIOB - When setting the output mode ,f407 Of PP and OD No longer in GPIO_Mode Set in , And in the GPIO_OType Set in , Output mode Out Also became OUT.
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
——> GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
Two 、BSRR Register expression
stay stm32f103 in IO Port high and low level control code
// LCD pin position 1
#define LCD_LED_SET LCD_CTRLB->BSRR=LCD_LED
#define LCD_RS_SET LCD_CTRLB->BSRR=LCD_RS
#define LCD_RST_SET LCD_CTRLB->BSRR=LCD_RST
// LCD pin position 0
#define LCD_LED_CLR LCD_CTRLB->BRR=LCD_LED
#define LCD_RST_CLR LCD_CTRLB->BRR=LCD_RST
#define LCD_RS_CLR LCD_CTRLB->BRR=LCD_RS
stay stm32f407 in IO Port high and low level control code
// LCD pin position 1
#define LCD_LED_SET LCD_CTRLB->BSRRL=LCD_LED
#define LCD_RS_SET LCD_CTRLB->BSRRL=LCD_RS
#define LCD_RST_SET LCD_CTRLB->BSRRL=LCD_RST
// LCD pin position 0
#define LCD_LED_CLR LCD_CTRLB->BSRRH=LCD_LED
#define LCD_RST_CLR LCD_CTRLB->BSRRH=LCD_RST
#define LCD_RS_CLR LCD_CTRLB->BSRRH=LCD_RS
The contrast shows BSRR Turned into BSRRL,BRR Turned into BSRRH, The root cause is f407 Only by BSRR Registers can control the high and low levels of pins , Removed BRR register , stay BSRR Middle and high 16 Bit control low level , low 16 Bit control high .
total junction
Because it's the same stm32 series , It only needs to modify a little difference to run smoothly , Test code click the link
link :https://pan.baidu.com/s/1JX360H5ETkCBeDzesjyJng
Extraction code :uin6
边栏推荐
- es个人整理的相关面试题
- Improvement 16 of yolov5: replace backbone network C3 with lightweight network pp-lcnet
- 《Robust and Communication-Efficient Federated Learning From Non-i.i.d. Data》论文阅读
- 投资500亿元!中芯京城正式注册成立!
- 定了!哪吒S全系产品将于7月31日上市发售
- 无代码开发平台通讯录入门教程
- (重要)初识C语言 -- 函数
- Shell script foundation - shell operation principle + variable and array definitions
- GD32F303固件库开发(10)----双ADC轮询模式扫描多个通道
- STM32_ Hal library driven framework
猜你喜欢

Console.log() console display... Solution

定了!哪吒S全系产品将于7月31日上市发售

无代码开发平台通讯录导出入门教程

无代码开发平台管理后台入门教程

Lenovo r9000p installation matlab2018a+cuda10.0 compilation

WinForm jump to the second form case

Migration from IPv4 to IPv6

TypeError: can‘t convert cuda:0 device type tensor to numpy. Use Tensor. cpu() to copy the tensor to

Yolov5 improvement 7: loss function improvement

简单的es高亮实战
随机推荐
Bluetooth smart Bracelet system based on STM32 MCU
希捷发布全新RISC-V架构处理器:机械硬盘相关性能暴涨3倍
软件测试面试笔试题及答案(软件测试题库)
LeetCode练习3——回文数
hp proliant dl380从U盘启动按哪个键
Padim [anomaly detection: embedded based]
高等数学解题常用公式笔记总结
芯华章宣布完成超2亿A轮融资,全面布局EDA2.0研发
Es learning directory
TypeError: can‘t convert cuda:0 device type tensor to numpy. Use Tensor. cpu() to copy the tensor to
OSV_ q The size of tensor a (704) must match the size of tensor b (320) at non-singleton dime
Use PCL to batch convert point cloud.Bin files to.Pcd
Qt+ffmpeg environment construction
Record a question about the order of trigonometric function exchange integrals
Stm32+ four pin OLED screen + Chinese character mold taking
软件测试工具fiddler postman jmeter charlse核心功能总结
WinForm jump to the second form case
Mspba [anomaly detection: representation_based]
即将获售高通、联发科芯片,荣耀要超越华为做国内第一?
C language to realize string reverse order arrangement