This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] DSPI-3P-DSPVOIPCODECS:环境控制器

Guru**** 2331900 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/1426037/dspi-3p-dspvoipcodecs-ambient-controller

器件型号:DSPI-3P-DSPVOIPCODECS

工具与软件:

不支持使用 Code Composer Studio 浮点至字节转换。 此示例位于浮点支持的工程设置下面 fpu32。

示例1:

uint8_t msg[4]={0x00、0x40、0x1C、0x47};uint8_t msg[4]={0x00、0x40、0x1C、0x47};

联合体{
字符 c[4];
浮点 f;
} u;
U.c[3]= msg[3];
U.c[2]= msg[2];
U.c[1]= msg[1];
U.c[0]= msg[0];

printf ("Float Value:%f\n"、U.f);//预期的浮点值为40000。  但结果为"0"

示例2:

联合体{
浮点 f;
unsigned int i;
}数据;

//将字节复制到 union 的整数成员
data.i =(msg[3]<< 24)|(msg[2]<< 16)|(msg[1]<< 8)| msg[0];

printf ("Float Value:%f\n"、data.f);/预期的浮点值为40000。  但结果为"0"

在 Visual Studio 中使用相同的代码是完美的。 我的意思是、结果是预期的(40000)