obsidian-notes/MCU/STM32/uint64_t打印.md

23 lines
482 B
Markdown
Raw Normal View History

2024-04-15 03:19:57 +00:00
---
title: uint64_t打印
updated: 2022-01-08 14:11:56Z
created: 2022-01-08 13:18:08Z
tags:
- mcu
- printf
- 代码块
- 浮点运算
---
stm32cubeIDE默认无法直接用`printf("Freq is %llu.\r\n",tmp)`打印输出
在开启standard C 后可以正常输出但是占用资源猛增,变通的方法是拼接输出
```c
uint8_t tt = (uint8_t)(tmp/1e9)%10; //取最高位
printf("Freq is %1d%09u.\r\n",tt,(uint32_t)(tmp-tt*1e9));
```
#printf
#mcu
#代码块
#浮点运算