Problem Debugging a sin function code

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Problem Debugging a sin function code

3,002 次查看
krude
Contributor I
Hi, I am currently trying to run a program with the follow code but my watchdog always reset. I tried to turn off the COP by changing SOPT_COPE to 1 at main.cpp but I still don't get it to stop at the breakpoints I set. But anyway, can somone take a look at my code and tell me what's wrong, can? Thank you. I tried to isolate the problem and apparantly, it's got to do with the sin function I used. Thank you.

int iNsample,in;
float fsine,fsinCoM,fFreq,fdT,fsinCo;

iNsample = 32;

fFreq = 440.0;

////----Maths function----\\\\\

fdT = 1/(fFreq * iNsample);

fsinCo = 2.0 * _M_PI * fFreq * fdT;


for(in=0; in
{
fsinCoM = fsinCo * in;
fsine = (sin(fsinCoM) + 1) * 100;
sinearray[in] = (int) fsine;

};//end for
标签 (1)
0 项奖励
回复
1 回复

1,081 次查看
krude
Contributor I
I solved the problem. Thanks for reading!haha... The problem is actually caused by the watchdog timeout. The watchdog timed out before my sin function can complete its computation. Just set the watchdog timeout to a longer period. :smileyhappy: Maybe someone have a better solution can share.
0 项奖励
回复