cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC Creator & Designer Software

Anonymous
Not applicable

I am not sure if this is the place to post this question so let me know if I need to post it somewhere else.  I am interfacing an accelerometer with an 8k PSoC1 via i2c.  I need to cacluate a specific angle from the accelerometer data without using the <math.h> library.  I know the value of two sides and could use arctan to get that angle but when i include <math.h> I run out fo code space.  Is this a possibility?  If so how can I do this?

   


Thanks...

0 Likes
Reply
3 Replies
JoMe_264151
Expert II

There are some approximations using pure integer arithmetic. have a look here, you can extract the sources from the pdf

   

   

http://www.freescale.com/files/sensors/doc/app_note/AN4248.pdf

   

 

Happy coding

Bob

0 Likes
Reply
ETRO_SSN583
Esteemed Contributor

Some other possibilties -

   

 

   

    

   

          http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&ved=0CDkQFjAC&url=http%3A%2F%2Fwww.ga...

   

 

   

    

   

          http://www.dsprelated.com/showmessage/21872/1.php

   

 

   

Cordic and Chebychev also popular.

   

 

   

    

   

          http://www.mathworks.com/products/demos/fixedpt/arctangent/fixpt_atan2_demo.html

   

 

   

    

   

          http://emesystems.com/BS2mathC.htm

   

 

   

    

   

          http://www.numericana.com/answer/functions.htm#cheb

   

 

   

Regards, Dana.

0 Likes
Reply
Anonymous
Not applicable

 this may help as well

   

http://www.ganssle.com/approx/approx.pdf

0 Likes
Reply