当前位置:网站首页>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
边栏推荐
- 五大理由告诉你为什么开发人员选择代码质量静态分析工具Klocwork来实现软件安全
- Keras 模型多输出 loss weight metrics 设置
- 字节秋招二面把我干懵了,问我SYN报文什么情况下会被丢弃?
- 有多一只“手”的机器狗出没?就在昇腾AI开发者创享日·南京站
- Http-Sumggling缓存漏洞分析
- 动手学深度学习_GoogLeNet / Inceptionv1v2v3v4
- 2-2.基金的投资交易与结算
- power failure...Trouble trouble trouble!!!
- LeetCode brush questions (8)
- The principle and application scenario of mysql master-slave synchronization
猜你喜欢
随机推荐
Qt::qcustomplot 和 qchart数据填充相关
Apache APISIX Ingress v1.5-rc1 released
Byte Qiu Zhao confused me on both sides, and asked me under what circumstances would the SYN message be discarded?
IPMP、PMP、CPMP三个证书该如何选择,有什么区别,哪个对于工作上的
【硬件架构的艺术】学习笔记(2)同步和复位
163_Tricks_Power BI one-click batch creation of custom field parameters
【着色器实现Flicker“DJ”闪烁效果_Shader效果第十五篇】
365 days challenge LeetCode1000 questions - Day 050 add a row to the binary tree binary tree
问题征集丨ECCV 2022中国预讲会 · Panel专题研讨会
163_技巧_Power BI 一键批量建立自定义字段参数
Support Vector Machine SVM
花的含义
安全软件Avast与赛门铁克诺顿NortonLifeLock合并获英国批准
Can't get in to ask questions.I want to ask you a question about the return value (traversal of the graph), please give Xiaobai an answer.
No developers, received a job to develop an IoT system, do you want to do it?
623. 在二叉树中增加一行 : 简单二叉树遍历运用题
How about Ping An Mengwa Card Insurance?Let parents read a few ways to identify products
Linux:记一次CentOS7安装MySQL8(博客合集)
再获殊荣 | 赛宁网安入选2022年度“培育独角兽”企业榜单
LeetCode brush questions (8)