When I have tried make an Sin Table on K20D using sin of "math.h" the execution program don't flow over it.
Ok. I decided not use the "math.h", then I used const table of sin values. However when the program tries escale down the values of this table with float division and convert float to int again execution of program don't flow over casting int to float.
Piece of code:
Motor.IncTabela = (float) 1000.0f / Motor.MaxSamples; Motor.Div = (((long) MAXTABELA / Motor.VMod)); for (i=0, a=0; i < Motor.MaxSamples; i++, a += Motor.IncTabela ) { r = SinT[(int)(a + 0.5f)]; r = r / Motor.Div; r = Motor.DutyZero + r; TabelaGerada[i] = (uint16_t) r; }
I yet tried increase stack pointer size from 1024 to 2048 but don't worked (i had some problem before on S08 PA).
Edit:
Have anybody here?
Disabling the FTM0 overflow interrupt the code runs perfectly.
Hello fabio:
We are sorry that your question did not receive an answer when posted. From your edit it seems you found a solution, but if you have doubts or need assistance please let us know.
Regards!
Jorge Gonzalez