<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to calculate arctan(x)? in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-calculate-arctan-x/m-p/1221002#M17701</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hi Ladislav,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Very useful. Thank you.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Aaron&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Jan 2021 04:39:26 GMT</pubDate>
    <dc:creator>aaronlee</dc:creator>
    <dc:date>2021-01-26T04:39:26Z</dc:date>
    <item>
      <title>How to calculate arctan(x)?</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-calculate-arctan-x/m-p/1220342#M17697</link>
      <description>&lt;P&gt;How to calculate arctan(x), sin(x), cos(x) in S12ZVCA ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Aaron&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 08:14:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-calculate-arctan-x/m-p/1220342#M17697</guid>
      <dc:creator>aaronlee</dc:creator>
      <dc:date>2021-01-25T08:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate arctan(x)?</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-calculate-arctan-x/m-p/1220453#M17699</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;you can use standard CodeWarrior library functions. however they are relatively (depends on application) slow:&lt;/P&gt;
&lt;P&gt;&lt;SAMP class="codeph"&gt;#include &amp;lt;math.h&amp;gt; &lt;/SAMP&gt;&lt;/P&gt;
&lt;P&gt;&lt;SAMP class="codeph"&gt;&lt;SPAN&gt;double &lt;SPAN class="resultofText"&gt;atan&lt;/SPAN&gt;(double &lt;/SPAN&gt;&lt;/SAMP&gt;x&lt;SAMP class="codeph"&gt;); &lt;/SAMP&gt;&lt;/P&gt;
&lt;P&gt;&lt;SAMP class="codeph"&gt;&lt;SPAN&gt;float &lt;SPAN class="resultofText"&gt;atan&lt;/SPAN&gt;f(float &lt;/SPAN&gt;&lt;/SAMP&gt;x&lt;SAMP class="codeph"&gt;); &lt;/SAMP&gt;&lt;/P&gt;
&lt;P&gt;&lt;SAMP class="codeph"&gt;&lt;SPAN&gt;long double &lt;SPAN class="resultofText"&gt;atan&lt;/SPAN&gt;l(long double &lt;/SPAN&gt;&lt;/SAMP&gt;x&lt;SAMP class="codeph"&gt;);&lt;/SAMP&gt;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV class="p"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another possibility is to use math and control library which uses fractional arithmetics and polynomial substitution of the functions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Search for mc9s12zvm_ammclib at nxp.com to get more info or&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.nxp.com/design/automotive-software-and-tools/nxp-automotive-math-and-motor-control-library-ammclib-set:AMMCLIB?tab=Design_Tools_Tab" target="_blank"&gt;https://www.nxp.com/design/automotive-software-and-tools/nxp-automotive-math-and-motor-control-library-ammclib-set:AMMCLIB?tab=Design_Tools_Tab&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;to download. (you must press "more" to find library in collapsed list)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Ladislav&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The last possibility is to use own searching table...depends on required precisiion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 25 Jan 2021 10:32:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-calculate-arctan-x/m-p/1220453#M17699</guid>
      <dc:creator>lama</dc:creator>
      <dc:date>2021-01-25T10:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate arctan(x)?</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-calculate-arctan-x/m-p/1221002#M17701</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi Ladislav,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Very useful. Thank you.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Aaron&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 04:39:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-calculate-arctan-x/m-p/1221002#M17701</guid>
      <dc:creator>aaronlee</dc:creator>
      <dc:date>2021-01-26T04:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate arctan(x)?</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-calculate-arctan-x/m-p/1327205#M18083</link>
      <description>&lt;P&gt;Share my code "Clockwise Rotation"&lt;/P&gt;&lt;P&gt;&amp;nbsp;from (A, B) to (X,Y)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#include "math.h"

double atan(double);
float atanf(float);

int16_t iA, iB, iX, iY;
float fAngle, fDistance, fRotate;

fAngle = atan2f (iB, iA);
fDistance = sqrt(pow(iA,2) + pow(iB,2));
iX = fDistance * cos(fAngle - fRotate);
iY = fDistance * sin(fAngle - fRotate);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Aaron&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Reference:&lt;/P&gt;&lt;P&gt;&lt;A title="順時鐘, 逆時鐘" href="https://www.varsitytutors.com/hotmath/hotmath_help/topics/angle-of-rotation" target="_blank" rel="noopener"&gt;Determining clockwise vs counter clockwise rotations&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://youtu.be/6pH-7pciYU8" target="_blank" rel="noopener"&gt;Determining angle of rotation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Aug 2021 23:01:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-to-calculate-arctan-x/m-p/1327205#M18083</guid>
      <dc:creator>aaronlee</dc:creator>
      <dc:date>2021-08-21T23:01:32Z</dc:date>
    </item>
  </channel>
</rss>

