angle= atan2((double)y,(double)x) * (180 / 3.14159265) + 180; // angle in degrees
用TM4C做了上门的公式的运算,结果程序直接进入错误中断了,这个是什么问题呢?51都不会出错的,这个芯片应该没有这么水吧。。
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.
angle= atan2((double)y,(double)x) * (180 / 3.14159265) + 180; // angle in degrees
用TM4C做了上门的公式的运算,结果程序直接进入错误中断了,这个是什么问题呢?51都不会出错的,这个芯片应该没有这么水吧。。
楼主能把所有的代码贴上来看一下吗?
浮点单元本身没什么问题的。分享一个代码:
#include <stdint.h>
#include <stdbool.h>
#include <math.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/fpu.h"
#include "driverlib/sysctl.h"
#include "driverlib/rom.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#define SERIES_LENGTH 100
float gSeriesData[SERIES_LENGTH];
int32_t i32DataCount = 0;
int main(void)
{
float fRadians;
ROM_FPULazyStackingEnable();
ROM_FPUEnable();
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);
fRadians = ((2 * M_PI) / SERIES_LENGTH);
while(i32DataCount < SERIES_LENGTH)
{
gSeriesData[i32DataCount] = sinf(fRadians * i32DataCount);
i32DataCount++;
}
while(1)
{
}
}