分享

STM32 中整形,浮点型在内存的存储格式

 卤煮小鱼 2018-08-09
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;​

 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多