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.

TMS320F280049: 请问要使用反正弦,反余弦函数需要包含哪个头文件,我试了fpu_math.h中没有asin(),acos()

Part Number: TMS320F280049
Other Parts Discussed in Thread: C2000WARE

请问F280049要使用反正弦,反余弦函数需要包含哪个头文件,我试了fpu_math.h中没有asin(),acos()。TMU中也只有sin没有artcsin。

  • 你好,你是要在C28核中执行asin(),acos()吗?C28核是不支持这两个指令的,只支持sim. cos, atan. 但是F280049可以在CLA中执行这两个指令,需要包含CLAmath库(可以参考:C2000Ware \libraries\math\CLAmath\c28\examples)

    另外,如果要在C28核中执行asin(),acos()的话可以做的是利用两个逆向触发函数和TMU对arctan的支持来实现这些函数

    // arcsin
    phi = fabsf(theta);
    asin_v = phi / sqrtf(1 - (phi*phi));
    if (asin_v > 1.0f)
    {
    asin_b = 1.5708f - __atan(1.0f / asin_v);
    }
    else
    {
    asin_b = __atan(asin_v);
    }
    if (signbit(theta))
    {
    asin_b = -asin_b;
    }
    
    // arccos
    acos_v = sqrtf(1 - (phi*phi)) / phi;
    if (acos_v > 1.0f)
    {
    acos_b = 1.5708f - __atan(1.0f / acos_v);
    }
    else
    {
    acos_b = __atan(acos_v);
    }
    if (signbit(theta))
    {
    acos_b = 3.142159f - acos_b;
    }

    参考链接 https://e2e.ti.com/support/microcontrollers/c2000/f/171/p/878444/3251848?tisearch=e2e-sitesearch&keymatch=TMU%2520asin%2520acos#3251848