<?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 I need help setting up the PWM - HCs12C32 in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/I-need-help-setting-up-the-PWM-HCs12C32/m-p/182010#M6675</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm new with this kind of kind of microcontrollers. I have a HCs12C32 development board and I'm trying to get tha hang of it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to use the PWM to drive a small servo-motor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I coulnd't understand by myself is how to set the dutycicle for my PWM. What is the usual syntax?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to use it along with the ATD. I want to copy the value form the ATD register and by this modify the dutycicle.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is small part of my software:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;PWMPOL_PPOL1=1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;PWMCLK_PCLK1=1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;PWMPRCLK_PCKA0=1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;PWMPRCLK_PCKA1=1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;PWMPRCLK_PCKA2=1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;p=(uint)ATDDR0H;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PWMDTY1=p;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;First I get an warning message telling me: "Posible lose of data".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I tested it on a LED and it seems to work OK. The LED seemed to change it's brightness OK. However With the motor it doesn't work to fine. I'm having problems with dutycicles above(70%-It is a guess).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My basic question: How do i set the dutycicle corectly? Do I simply enter 1 for 1%, 23 for 23% 100 for 100%? (PWMDTY=23&lt;/SPAN&gt;&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif"&gt;&lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Stefan&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Added p/n to subject.&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Message Edited by NLFSJ on &lt;/SPAN&gt;&lt;SPAN class="date_text"&gt;2008-01-23&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;06:42 AM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Jan 2008 17:05:32 GMT</pubDate>
    <dc:creator>StefX2</dc:creator>
    <dc:date>2008-01-23T17:05:32Z</dc:date>
    <item>
      <title>I need help setting up the PWM - HCs12C32</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/I-need-help-setting-up-the-PWM-HCs12C32/m-p/182010#M6675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm new with this kind of kind of microcontrollers. I have a HCs12C32 development board and I'm trying to get tha hang of it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to use the PWM to drive a small servo-motor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I coulnd't understand by myself is how to set the dutycicle for my PWM. What is the usual syntax?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to use it along with the ATD. I want to copy the value form the ATD register and by this modify the dutycicle.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is small part of my software:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;PWMPOL_PPOL1=1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;PWMCLK_PCLK1=1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;PWMPRCLK_PCKA0=1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;PWMPRCLK_PCKA1=1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;PWMPRCLK_PCKA2=1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;p=(uint)ATDDR0H;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PWMDTY1=p;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;First I get an warning message telling me: "Posible lose of data".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I tested it on a LED and it seems to work OK. The LED seemed to change it's brightness OK. However With the motor it doesn't work to fine. I'm having problems with dutycicles above(70%-It is a guess).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My basic question: How do i set the dutycicle corectly? Do I simply enter 1 for 1%, 23 for 23% 100 for 100%? (PWMDTY=23&lt;/SPAN&gt;&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif"&gt;&lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Stefan&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Added p/n to subject.&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Message Edited by NLFSJ on &lt;/SPAN&gt;&lt;SPAN class="date_text"&gt;2008-01-23&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;06:42 AM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2008 17:05:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/I-need-help-setting-up-the-PWM-HCs12C32/m-p/182010#M6675</guid>
      <dc:creator>StefX2</dc:creator>
      <dc:date>2008-01-23T17:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: I need help setting up the PWM</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/I-need-help-setting-up-the-PWM-HCs12C32/m-p/182011#M6676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;In the posted code there is no mention of PWMPERx, however this register must also be configured.&lt;BR /&gt;&lt;BR /&gt;The PWM duty cycle is directly related to the ratio of PWMDTYx to PWMPERx&amp;nbsp; (where x denotes the channel number).&lt;BR /&gt;Thus for the case PPOLx=1 as in the given example then&lt;BR /&gt;Duty cycle = [PWMDTYx / PWMPERx] * 100%&lt;BR /&gt;&lt;BR /&gt;For&amp;nbsp; Polarity = 0 (PPOLx = 0) then&lt;BR /&gt;Duty cycle = [(PWMPERx - PWMDTYx)/PWMPERx] * 100%&lt;BR /&gt;This explained in more detail in section 12 of the S12C-Family reference manual...&lt;BR /&gt;&lt;A href="http://www.freescale.com/files/microcontrollers/doc/data_sheet/MC9S12C128V1.pdf?pspll=1" target="test_blank"&gt;http://www.freescale.com/files/microcontrollers/doc/data_sheet/MC9S12C128V1.pdf?pspll=1&lt;/A&gt;&lt;BR /&gt;See pages 368 and 375-379&lt;BR /&gt;&lt;BR /&gt;DPB&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2008 19:48:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/I-need-help-setting-up-the-PWM-HCs12C32/m-p/182011#M6676</guid>
      <dc:creator>DPB</dc:creator>
      <dc:date>2008-01-23T19:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: I need help setting up the PWM</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/I-need-help-setting-up-the-PWM-HCs12C32/m-p/182012#M6677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thank you a lot!&lt;BR /&gt;&lt;BR /&gt;Sometimes the answer is in front of you but you need somebody to open your eys.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 27 Jan 2008 18:32:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/I-need-help-setting-up-the-PWM-HCs12C32/m-p/182012#M6677</guid>
      <dc:creator>StefX2</dc:creator>
      <dc:date>2008-01-27T18:32:25Z</dc:date>
    </item>
  </channel>
</rss>

