小编Nih*_*had的帖子

二进制int加倍没有类型转换

我做一些微控制器的编程中C.我来自各种传感器的4个字节,代表任一读取float,intunsigned int.目前,我将它们以unsigned int格式存储在微控制器中,即使数据可能是float微控制器,它们只是字节.然后将该数据传输到PC.我希望PC将二进制数据解释为a float或an int或者unsigned int我希望的时候.有没有办法做到这一点?

防爆.

unsigned int value = 0x40040000; // This is 2.0625 in double
double result = convert_binary_to_double(value); // result = 2.0625
Run Code Online (Sandbox Code Playgroud)

谢谢.

PS:我尝试了类型转换,但这不起作用.

c binary microcontroller casting

2
推荐指数
1
解决办法
1373
查看次数

标签 统计

binary ×1

c ×1

casting ×1

microcontroller ×1