Float point operations (trig too) don't work on K20D (FRDM K20D50M).

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

Float point operations (trig too) don't work on K20D (FRDM K20D50M).

1,056件の閲覧回数
fabio_vila
Contributor I

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.

0 件の賞賛
返信
1 返信

888件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

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

0 件の賞賛
返信