Problem Debugging a sin function code

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Problem Debugging a sin function code

3,038件の閲覧回数
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,117件の閲覧回数
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 件の賞賛
返信