Other Parts Discussed in Thread: C2000WARE
float x,y;
float arcsin(float a) // 返回弧度百分比
{
if (a >= 0.9999999f) a = 0.9999999f; //防止后面的除0错误
if (a <= -0.9999999f) a = -0.9999999f;
x = __sqrt(1 - (a*a));
y = __divf32(a, x);
y = __atanpuf32(0.5773f); //返回0.0833273306,*360=29.99度,*2PI=0.52356弧度,和windows计算器一致
y = __atanpuf32(0.6f);
y = __atanpuf32(0.65f);
y = __atanpuf32(0.7f);
y = __atanpuf32(0.75f);
y = __atanpuf32(0.99f);
y = __atanpuf32(1); //返回0.125,*360=45,tan(45)=1 正确, 但是还有46度,~89.999度没法求出来
y = __atanpuf32(2); //大于1后就不正确了, 始终返回0.125
y = __atanpuf32(2000); //用windows计算器,反正切2000,角度制得到89.97度,弧度制得到1.57 为什么TI这个函数只要输入大于1就不正常了
return x;
}
编译配置如下:-v28 -ml -mt --float_support=fpu32 --idiv_support=idiv0 --tmu_support=tmu0 -Ooff --fp_mode=strict --fp_reassoc=off --include_path="D:/2023/1p_inverter/1P_280025" --include_path="C:/ti/c2000/C2000Ware_4_01_00_00/device_support/f28002x/common/include" --include_path="C:/ti/c2000/C2000Ware_4_01_00_00/device_support/f28002x/headers/include" --include_path="C:/ti/c2000/C2000Ware_4_01_00_00/libraries/calibration/hrpwm/f28002x/include" --include_path="C:/ti/ccs1120/ccs/tools/compiler/ti-cgt-c2000_21.6.0.LTS/include" --include_path="D:/2023/1p_inverter/1P_280025/Source" --advice:performance=all --define=C2000_DSP --diag_suppress=10063 --diag_warning=225 --diag_wrap=off --display_error_number --gen_func_subsections=on --abi=eabi