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.

[参考译文] CCS/TMS320F28335:前四个数据不符合预期

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

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/921517/ccs-tms320f28335-the-first-four-data-is-not-as-expected

器件型号:TMS320F28335

工具/软件:Code Composer Studio

尊敬的所有人:

我是 CCS 编程的初学者。

我编写了这个简单的代码、但输出不是预期的那样。

#include "math.h"
双 t;
int sig[62];
内部指示;
void main (void)
{
对于(t=0;t<6.2;t=t+0.1)
{
IND=t*10;
sig[ind]=sin (t);
}
}

第一个数据是-31505、第二个数据是51、依此类推。

问题可能出在哪?

提前感谢

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

    我无法重现此结果。  对于包含此代码  的源文件、请按照文章如何提交编译器测试用例中的说明进行操作。

    请注意,此分配...

    [引用 user="Masoud Mehrabi"] sig[ind]=sin (t);

    (笑声) 从类型 double 表达式到类型整数数组成员。  将浮点值转换为整数时、该值将被截断、而不是四舍五入。

    谢谢、此致、

    乔治