当前位置:网站首页>Cubemx transplantation punctual atom LCD display routine
Cubemx transplantation punctual atom LCD display routine
2022-07-06 03:32:00 【2020 robot experimental class】
No principle , Transplant only .
open cubemx, The process of selecting chips is not mentioned .
Choose the clock :

Download mode :

A serial port 1, Because there's... On the board ch340, It can be directly sent to the computer through the data line . No, ch340 You can choose to use the board TTL To serial port .

Click on FSMC Click on the first .

Choose as follows , You need to see the schematic diagram of the development board .

take extended mode Can make 
Open the official routine of punctual atom :
If this error is reported when jumping to the definition .

Click on the magic wand , take output Medium Browse Information Check and compile .

find LCD_Init
Compare the parameters in the structure , Get the following settings

Select the backlight pin to output mode .
Change the clock to 72M


Find these three files in the punctual atomic routine , Copy to the following Inc and Src in .


Compile it and we will see many errors

A lot of mistakes , Let's come one by one .

take include "delay.h" Delete , And then main.h Add the following
typedef uint32_t u32;
typedef uint16_t u16;
typedef uint8_t u8;
typedef __IO uint32_t vu32;
typedef __IO uint16_t vu16;
typedef __IO uint8_t vu8;then lcd.h Medium sys Change to main, take main Add the header file of

Then errors are significantly reduced

There is a microsecond delay , however HAL The library does not have this function , So let's replace it with One millisecond delay , Replace the millisecond delay Ze with HAL The millisecond delay of the library is ok .
HAL_Delay(1); 
After the modification is completed

because LCD_Init Function to use printf, So you need to add a header file
#include "stdio.h" 
take LCD_LED =1 Revise it into the following sentence
HAL_GPIO_WritePin(LCD_BL_GPIO_Port,LCD_BL_Pin,GPIO_PIN_SET);take LCD_Init Function HAL_Delay(50) All the previous codes are deleted .

take HAL_SRAM_MspInit Function delete

Add the following header file in the main function .
#include "lcd.h"
#include "stdio.h" 
And then usart.c Add serial port redirection at the bottom of .
#include<stdio.h>
#ifdef __GNUC__
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#endif
PUTCHAR_PROTOTYPE
{
HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF);
return ch;
}Punctual atom main Routine replication in You can see the experimental effect

边栏推荐
- Esbuild & SWC: a new generation of construction tools
- MADDPG的pythorch实现——(1)OpenAI MADDPG环境配置
- Arabellacpc 2019 (supplementary question)
- Safety science to | travel, you must read a guide
- Brush questions in summer -day3
- 【Rust 笔记】18-宏
- SD卡報錯“error -110 whilst initialising SD card
- NR modulation 1
- Schnuka: 3D vision detection application industry machine vision 3D detection
- Pytoch foundation - (1) initialization of tensors
猜你喜欢

JS Vanke banner rotation chart JS special effect

Research on cooperative control of industrial robots

SAP ALV cell level set color
![[slam] orb-slam3 parsing - track () (3)](/img/87/b580837778c2c9f6bac5ba49403d6b.png)
[slam] orb-slam3 parsing - track () (3)

Pointer written test questions ~ approaching Dachang

BUAA喜鹊筑巢

Svg drag point crop image JS effect

蓝色样式商城网站页脚代码

C language judgment, ternary operation and switch statement usage

【概念】Web 基础概念认知
随机推荐
How to do function test well
1.16 - check code
施努卡:视觉定位系统 视觉定位系统的工作原理
SAP ALV单元格级别设置颜色
Deno介绍
Cubemx 移植正点原子LCD显示例程
Inherit day01
ArabellaCPC 2019(补题)
Explore pointers and pointer types in depth
Quartz misfire missed and compensated execution
[concept] Web basic concept cognition
MPLS experiment
2.2 STM32 GPIO operation
遥感图像超分辨重建综述
Tidb ecological tools (backup, migration, import / export) collation
How to choose PLC and MCU?
简述C语言中的符号和链接库
Svg drag point crop image JS effect
Pytorch基础——(2)张量(tensor)的数学运算
BUAA计算器(表达式计算-表达式树实现)