(一)C语言中的种类数据
整型:int short long
实型:float double
(二)STM32中的数据类型非常的多,常用的变量,文件中的定义如下:
/* exact-width signed integer types */
typedef signed char int8_t;
typedef signed short int int16_t;
typedef signed int int32_t;
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;
typedef int32_t s32;
typedef int16_t s16;
typedef int8_t s8;
typedef uint32_t u32;
typedef uint16_t u16;
typedef uint8_t u8;
因此在STM32编程中,常用的数据类型有:char(字符型),u8,u16 ,u32,但是在一些计算中,涉及到负数,小数,因此要用到:int float doulbe 型。
其中u8——1个字节,无符号型(不能表达负数,如果用来当作负数的话,就出错了);
u16 ——2个字节,无符号型(参看前边STM32f10x.h中的定义);
u32——4个字节,无符号型;
int——4个字节,有符号型,可以表达负整数;
float ——4个字节,有符号型,可以表达负数/小数;
double——8个字节,有符号弄,可以表达负数/小数;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)