STM32以小端模式存储:
整形 4个字节: 0x11223344 低位在前(小端模式) __packed typedef union { int i_type; int8_t u8[4]; }INT_TYPE; a.i_type=0x11223344; 浮点形 4个字节: -234.563 __packed typedef union { float f_type; int8_t u8[4]; }FL_TYPE; b.f_type=-234.563; 双精度浮点形 8个字节: -234.563 __packed typedef union { double d_type; int8_t u8[8]; }DB_TYPE; c.d_type=-123.456; |
|