AnsweredAssumed Answered

Implement a Polynomial equation in my application

Question asked by sijeo.philip@aydintech.com on Apr 30, 2014
Latest reply on May 14, 2014 by VineethaThomas

Hi ,

I am using BF504F device in my application, I am trying t o implement a 5th order polynomial equation which represents my sensor output.

This polynomial will be run inside a ISR routine and the variables x and y are float type datas.. which will be called 4 times for each of my ADC channel datas thus prefer to be written as a function... the equation is as below

y = 9E-11x5 - 7E-08x4 + 2E-05x3 - 0.0021x2 + 0.1006x - 0.9639

 

IFor instance the function for the below equation could be

 

float Polynomial_equation (float x) and will be returning Y

 

If the code for this function is written in assembly , I assume x will be stored in R0 register.. I would like to understand how can I do a MAC operation with a float variable in R0  and at the same time round off in case of an overflow…  As I couldn’t find any examples which can help me do some assembly coding using float variable…

The reason encouraging me to use .asm is that I would like to use the Hardware Loop Counter in the function.. which will not be used by the compiler if written in C.. As i remember reading in the compiler manual that float operations in a loop will not use the hardware loop counter.

 

I would like to get a basic understanding on how float variables will be stored in the hardware registers in this scenario.

 

Thanks

 

Outcomes