You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

STM32示例代码中变量名开头的“uw”代表什么含义?

What does the uw prefix mean in STM32 variable names?

Great question! Those uw prefixes you're spotting follow STMicroelectronics' internal variable naming convention—a modified take on Hungarian notation tailored to their microcontroller architectures.

Breaking down the two letters:

  • u: Stands for unsigned—this tells you the variable holds an unsigned integer value, no negative numbers allowed.
  • w: Stands for word—in STM32 terminology, a "word" refers to a 32-bit data type. This aligns perfectly with the uint32_t type used in your examples (like static __IO uint32_t uwLsiFreq = 0;), since uint32_t is a 32-bit unsigned integer.

Putting it all together, a name like uwLsiFreq translates to "unsigned 32-bit word representing LSI frequency"—it's a quick way to grasp both the variable's data type and purpose just by looking at its name.

You might run into other similar prefixes in STM32 code too, such as:

  • ui for unsigned 16-bit integers (matching uint16_t)
  • uc for unsigned 8-bit integers (matching uint8_t)
  • sw for signed 32-bit integers (matching int32_t)

示例来源:STM32Cube_FW_F2_V1.7.0/Projects/STM32F207ZG-Nucleo/Examples/IWDG/IWDG_Example/Src/main.c

内容的提问来源于stack exchange,提问作者Gabriel Staples

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 09:12:57