当前位置:网站首页>STM32H743IIT6学习笔记02——USART
STM32H743IIT6学习笔记02——USART
2022-08-05 11:45:00 【火红色祥云】
STM32H743IIT6学习笔记——USART
- 配置LED为推挽输出

- 配置USART

- 修改USART引脚,在PA9和PA10引脚选择USART1即可自动替换USART引脚


- 配置时钟树后生成代码

- 编译代码
- usart.c中加入重定义printf的函数,并加入头文件
#include <stdio.h>
int fputc(int ch,FILE *f)
{
while((USART1->ISR&0x40)==0);
USART1->TDR = (int8_t)ch;
return ch;
}
- 在主函数中加入代码
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART1_UART_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_GPIO_TogglePin(GPIOB,LED0_Pin);
HAL_GPIO_TogglePin(GPIOB,LED1_Pin);
HAL_Delay(100);
printf("Hello world!\r\n");
}
/* USER CODE END 3 */
}
- 工程配置中使能MicroLib

- 编译、烧录、验证,串口默认波特率115200

边栏推荐
猜你喜欢

普通二本毕业八年,京东就职两年、百度三年,分享大厂心得

No developers, received a job to develop an IoT system, do you want to do it?

Machine Learning - Ensemble Learning

手把手教你定位线上MySQL慢查询问题,包教包会

力扣330 按要求补齐数组(贪心)

冬日里,28℃的爱情

Letter from Silicon Valley: Act fast, Facebook, Quora and other successful "artifacts"!

朴素贝叶斯

灰度值与热成像理解

163_技巧_Power BI 一键批量建立自定义字段参数
随机推荐
Learning Deep Compact Image Representations for Visual Tracking
I'm going crazy.Again A few days can not be A problem
Android development with Kotlin programming language - basic data types
Version Control | Longzhi invites you to go to the GOPS Global Operation and Maintenance Conference to explore the road of large-scale, agile, high-quality and open software development and operation
支持向量机SVM
【名词】什么是PV和UV?
没开发人员,接到开发物联网系统的活儿,干不干?
Web3 中的安全问题和防范
IPMP、PMP、CPMP三个证书该如何选择,有什么区别,哪个对于工作上的
2-2.基金的投资交易与结算
问题征集丨ECCV 2022中国预讲会 · Panel专题研讨会
shell编程流程控制练习
如何用Golang来手写一个Blog - Milu.blog 开发总结
学习用于视觉跟踪的深度紧凑图像表示
knife4j
Apache APISIX Ingress v1.5-rc1 发布
Android development with Kotlin programming language three loop control
Android 开发用 Kotlin 编程语言三 循环控制
机器学习——集成学习
nyoj757 期末考试 (优先队列)