<?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 PWM Sample code for KL46 in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Sample-code-for-KL46/m-p/344804#M16776</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i need specific sample code for controlling stepper motor using KL46 controller. so i would request you to provide me specific/close&amp;nbsp; sample c code to access PWM mode .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 Aug 2014 07:40:11 GMT</pubDate>
    <dc:creator>yusupkhan</dc:creator>
    <dc:date>2014-08-08T07:40:11Z</dc:date>
    <item>
      <title>PWM Sample code for KL46</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Sample-code-for-KL46/m-p/344804#M16776</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i need specific sample code for controlling stepper motor using KL46 controller. so i would request you to provide me specific/close&amp;nbsp; sample c code to access PWM mode .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Aug 2014 07:40:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Sample-code-for-KL46/m-p/344804#M16776</guid>
      <dc:creator>yusupkhan</dc:creator>
      <dc:date>2014-08-08T07:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: PWM Sample code for KL46</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Sample-code-for-KL46/m-p/344805#M16777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Yusup,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Take a look at MCU on Eclipse blog: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://mcuoneclipse.com/"&gt;http://mcuoneclipse.com/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You will find a lot of examples and tips. To be more specific, take a look on pwm | Search Results | MCU on Eclipse. You will find some applications for PWM use.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Aug 2014 10:52:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Sample-code-for-KL46/m-p/344805#M16777</guid>
      <dc:creator>wendersonolivei</dc:creator>
      <dc:date>2014-08-08T10:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: PWM Sample code for KL46</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Sample-code-for-KL46/m-p/344806#M16778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PWM on the KL46 is included in the code at &lt;A href="http://www.utasker.com/forum/index.php?topic=1721.0" rel="nofollow noopener noreferrer" title="http://www.utasker.com/forum/index.php?topic=1721.0" target="_blank"&gt;KINETIS Project Code&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The PWM (timer interface) is discussed in the HW timer document &lt;A href="http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF" rel="nofollow noopener noreferrer" title="http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF" target="_blank"&gt;http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and is compatible with all KE, Kl and K devices (K/KE use FlexTimer and KL uses the TPM but the interface is the same).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eg:&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_1407503482907532" jivemacro_uid="_1407503482907532"&gt;
&lt;P&gt;PWM_INTERRUPT_SETUP pwm_setup;&lt;/P&gt;
&lt;P&gt;pwm_setup.int_type = PWM_INTERRUPT;&lt;/P&gt;
&lt;P&gt;pwm_setup.pwm_mode = (PWM_SYS_CLK | PWM_PRESCALER_16); // clock PWM timer from the&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt; system clock with /16 prescaler &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;pwm_setup.pwm_reference = (_TIMER_0 | 3); // timer module 0, channel 3&lt;/P&gt;
&lt;P&gt;pwm_setup.pwm_frequency = PWM_TIMER_US_DELAY(TIMER_FREQUENCY_VALUE(1000), 16); &lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;// generate 1000Hz on PWM output &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;pwm_setup.pwm_value = _PWM_PERCENT(20, pwm_setup.pwm_frequency); // 20% PWM (high/low)&lt;/P&gt;
&lt;P&gt;fnConfigureInterrupt((void *)&amp;amp;pwm_setup); // enter configuration for first PWM output &lt;/P&gt;
&lt;P&gt;pwm_setup.pwm_reference = (_TIMER_0 | 2); // timer module 0, channel 2&lt;/P&gt;
&lt;P&gt;pwm_setup.pwm_mode |= PWM_POLARITY; // change polarity of second channel&lt;/P&gt;
&lt;P&gt;pwm_setup.pwm_value = _PWM_TENTH_PERCENT(706, pwm_setup.pwm_frequency); &lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;// 70.6% PWM (low/high) on different channel &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;fnConfigureInterrupt((void *)&amp;amp;pwm_setup); // enter configuration for second PWM output&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You just need to choose the timer modules and channels (as available on the device being used) - any number can be used and all are independent apart from the fact that all channels on a particular module share the same base frequency.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Aug 2014 13:10:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Sample-code-for-KL46/m-p/344806#M16778</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-08-08T13:10:55Z</dc:date>
    </item>
  </channel>
</rss>

