STM32 variable type definition and extension

Publisher:EnchantedBreezeLatest update time:2019-01-14 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Note: Data operations may exceed the type of variable definition, so be careful when defining variables!


Variable type definition in STM32F4: in stdint


    /* exact-width signed integer types */

typedef signed char int8_t;

typedef signed short int int16_t;

typedef signed int int32_t; //In a 32-bit environment, int represents 4 bytes 32 bits

typedef signed __INT64 int64_t;

 

    /* exact-width unsigned integer types */

typedef unsigned char uint8_t;

typedef unsigned short int uint16_t;

typedef unsigned int uint32_t;

typedef unsigned __INT64 uint64_t;

 

    /* 7.18.1.2 */

 

    /* smallest type of at least n bits */

    /* minimum-width signed integer types */

typedef signed char int_least8_t;

typedef signed short int int_least16_t;

typedef signed int int_least32_t;

typedef signed __INT64 int_least64_t;

 

    /* minimum-width unsigned integer types */

typedef unsigned char uint_least8_t;

typedef unsigned short int uint_least16_t;

typedef unsigned int uint_least32_t;

typedef unsigned __INT64 uint_least64_t;

 

    /* 7.18.1.3 */

 

    /* fastest minimum-width signed integer types */

typedef signed int int_fast8_t;

typedef signed int int_fast16_t;

typedef signed int int_fast32_t;

typedef signed __INT64 int_fast64_t;

 

    /* fastest minimum-width unsigned integer types */

typedef unsigned int uint_fast8_t;

typedef unsigned int uint_fast16_t;

typedef unsigned int uint_fast32_t;

typedef unsigned __INT64 uint_fast64_t;

 

    /* 7.18.1.4 integer types capable of holding object pointers */

#if __sizeof_ptr == 8

typedef signed __INT64 intptr_t;

typedef unsigned __INT64 uintptr_t;

#else

typedef signed int intptr_t;

typedef unsigned int uintptr_t;

#endif

 

    /* 7.18.1.5 greatest-width integer types */

typedef signed __LONGLONG intmax_t;

typedef unsigned __LONGLONG uintmax_t;

 

 

#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)

 

    /* 7.18.2.1 */

 

    /* minimum values ​​of exact-width signed integer types */

#define INT8_MIN -128

#define INT16_MIN -32768

#define INT32_MIN (~0x7fffffff) /* -2147483648 is unsigned */

#define INT64_MIN __INT64_C(~0x7fffffffffffffff) /* -9223372036854775808 is unsigned */

 

    /* maximum values ​​of exact-width signed integer types */

#define INT8_MAX 127

#define INT16_MAX 32767

#define INT32_MAX 2147483647

#define INT64_MAX __INT64_C(9223372036854775807)

 

    /* maximum values ​​of exact-width unsigned integer types */

#define UINT8_MAX 255

#define UINT16_MAX 65535

#define UINT32_MAX 4294967295u

#define UINT64_MAX __UINT64_C(18446744073709551615)

 Reference: https://blog.csdn.net/f1engmin11/article/details/70946471 and the same as the above library file


Keywords:STM32 Reference address:STM32 variable type definition and extension

Previous article:STM32F4XX independent watchdog HAL library
Next article:STM32 stack size and location

Recommended ReadingLatest update time:2024-11-23 15:24

ADC sampling clock calculation of STM32
Background: Capture a key press and perform corresponding operations. By searching online, I found that the fastest speed a person can click a mouse is 14 times per second, so 14HZ is used as the frequency for operating physical keys. step: 1. Calculate the sampling interval:   1/14HZ = 71.4ms, 6000 points are sampled
[Microcontroller]
STM32 general timer timing function study notes
This section mainly talks about the timing function of the STM32 general timer. 1. TIMx clock source problem: STM32 has 8 registers, including two advanced timers TIM1 and TIM8, two basic timers TIM6 and TIM7, and four general timers TIM2-TIM5. The timers are completely independent and do not share any resources w
[Microcontroller]
STM32 debugging can bus frame loss problem
Background of the problem I need to write a new motor driver, using CAN communication. The driver is relatively simple and was written quickly. When I tested a motor by myself, there was no problem, and the forward and reverse rotation tests were all normal. I thought things would go smoothly, but when I tested two mo
[Microcontroller]
STM32 debugging can bus frame loss problem
STM32 serial port principle
Serial communication definition   Serial port is a very common device communication protocol on computers. Most computers contain two serial ports based on RS232. Serial port is also a common communication protocol for instrumentation equipment; many GPIB compatible devices also have RS-232 ports. At the same time, se
[Microcontroller]
STM32 HSE LSE crystal oscillator official recommendation
I plan to choose HSE: HC-49S-8 MHz chip            LSE : DMX-26S 32768HZ patch    
[Microcontroller]
STM32 HSE LSE crystal oscillator official recommendation
What is the difference between mode 1 and mode 2 when the stm32 general timer generates pwm
110: PWM mode 1 - When counting up, once TIMx_CNT Valid is 1, invalid is 0.
[Microcontroller]
STM32 Application Notes GPIO Initialization
//Initialize IO mode: pull-up/pull-down input. Call function:  void KEY_Init(void) //IO initialization {       GPIO_InitTypeDef GPIO_InitStructure;        RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOE,ENABLE); //Enable PORTA, PORTE clock        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2|GPIO_Pin_3|G
[Microcontroller]
STM32--CAN bus application
CAN bus is widely used in the control field. Nowadays, most CPU chips have extended CAN interface. This article focuses on the use of CAN bus based on STM32F103E series chips. 1. Hardware Basics           CAN bus requires two data lines, RX and TX, which are input bus and output bus. Generally, CPU needs to conne
[Microcontroller]
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号