当前位置:网站首页>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

边栏推荐
- EDCircles: A real-time circle detector with a false detection control 翻译
- Redis cache breakdown, cache penetration, cache avalanche
- Leetcode problem solving -- 108 Convert an ordered array into a binary search tree
- . Net 6 and Net core learning notes: Important issues of net core
- 真机无法访问虚拟机的靶场,真机无法ping通虚拟机
- 适合程序员学习的国外网站推荐
- Overview of super-resolution reconstruction of remote sensing images
- 深入刨析的指针(题解)
- Image super-resolution using deep convolutional networks(SRCNN)解读与实现
- Leetcode problem solving -- 98 Validate binary search tree
猜你喜欢

Princeton University, Peking University & UIUC | offline reinforcement learning with realizability and single strategy concentration

多项目编程极简用例

MPLS experiment

Edcircles: a real time circle detector with a false detection control translation

Redo file corruption repair

Performance analysis of user login TPS low and CPU full

BUAA计算器(表达式计算-表达式树实现)

Suggestions for new engineer team members

Map sorts according to the key value (ascending plus descending)

Explore pointers and pointer types in depth
随机推荐
C language judgment, ternary operation and switch statement usage
【RISC-V】外部中断
Explore pointers and pointer types in depth
Lua uses require to load the shared library successfully, but the return is Boolean (always true)
蓝色样式商城网站页脚代码
【概念】Web 基础概念认知
Analyze menu analysis
电机控制反Park变换和反Clarke变换公式推导
EDCircles: A real-time circle detector with a false detection control 翻译
Image super resolution using deep revolutionary networks (srcnn) interpretation and Implementation
Erreur de la carte SD "erreur - 110 whilst initialisation de la carte SD
2. GPIO related operations
resulttype和resultmap的区别和应用场景
3.2 rtthread 串口设备(V2)详解
1.16 - 校验码
深度解析指针与数组笔试题
How to write compile scripts compatible with arm and x86 (Makefile, cmakelists.txt, shell script)
Mysqldump data backup
3.1 rtthread 串口设备(V1)详解
RT-Thread--Lwip之FTP(2)