<?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>CodeWarrior for MCUのトピックHaving trouble with the PWM setup</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Having-trouble-with-the-PWM-setup/m-p/123839#M18</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;HI,&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;Using Code warrior special edition&lt;BR /&gt;version 5.7.0&lt;BR /&gt;Build 1932&lt;BR /&gt;Full chip simulation but i intend to use a HC12 (S12DP512)&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;Im currently trying to configure PWM channels to work with 16 bits&lt;BR /&gt;&lt;BR /&gt;&lt;P align="left"&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;From the .pdf file i found:&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;"The PWMCTL register contains four control bits, each of which is used to concatenate a pair of PWM channels into one 16-bit channel."&lt;BR /&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;Here is my code&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;void setupPWM(void){&amp;nbsp; PWMPOL = 170; /* outputs are high at the beginning of the period, then go low when the duty count is reached. */&amp;nbsp; PWMCAE = 0;&amp;nbsp;&amp;nbsp; /* operate in left aligned output mode. */&amp;nbsp; PWMCLK = 0;&amp;nbsp;&amp;nbsp; /* Clock B is the clock source for PWM channel 7 and 3, Clock A is the clock source for PWM channel 1and 5. */&amp;nbsp; PWMPRCLK = 0; /* Clock A = Clock B = Bus Clock */&amp;nbsp; PWMCTL = 255; /* Channel 0-1 , 2-3 , 4-5 , 6-7 concatenated */&amp;nbsp; PWMSDN = 0;&amp;nbsp;&amp;nbsp; /* Disable Emergency shutdown */&amp;nbsp; PWMPER01 = 8000; /* setup for PERIOD */&amp;nbsp; PWMDTY01 = 4000; /* setup for DUTY CYCLE */&amp;nbsp; PWME = 255;&amp;nbsp;&amp;nbsp; /* Enable PWM function on Port P for all channel */}void main(void){&amp;nbsp; setupPWM();&amp;nbsp; EnableInterrupts;&amp;nbsp; for(;;){&amp;nbsp; }}&lt;/PRE&gt;&lt;P align="left"&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Then im using the true-time simulator&lt;BR /&gt;with a LED as the visualisation for the adress 0x258 of the PTP byte&lt;BR /&gt;and i have no reaction&lt;BR /&gt;&lt;BR /&gt;The documentation mentionned to set PWMPERx &amp;gt; PWMDTYx&lt;BR /&gt;which i did&lt;BR /&gt;&lt;BR /&gt;then i tried this ( these examples are for a duty cycle around 50%)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;PWMPER01 = 8000;PWMDTY01 = 3841;&lt;/PRE&gt;&lt;P align="left"&gt;&lt;BR /&gt;&amp;nbsp;and with this the LED is working properly&lt;BR /&gt;&lt;BR /&gt;I think the simulator does a comparison between each 8 bits PWMPER1 and PWMDTY1&amp;nbsp;or PWMPER0 and PWMDTY0 to check the condition "PWMPERx &amp;gt; PWMDTYx"&lt;BR /&gt;&lt;BR /&gt;well can someone help me&lt;BR /&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Jul 2006 19:13:42 GMT</pubDate>
    <dc:creator>HT</dc:creator>
    <dc:date>2006-07-12T19:13:42Z</dc:date>
    <item>
      <title>Having trouble with the PWM setup</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Having-trouble-with-the-PWM-setup/m-p/123839#M18</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;HI,&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;Using Code warrior special edition&lt;BR /&gt;version 5.7.0&lt;BR /&gt;Build 1932&lt;BR /&gt;Full chip simulation but i intend to use a HC12 (S12DP512)&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;Im currently trying to configure PWM channels to work with 16 bits&lt;BR /&gt;&lt;BR /&gt;&lt;P align="left"&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;From the .pdf file i found:&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;"The PWMCTL register contains four control bits, each of which is used to concatenate a pair of PWM channels into one 16-bit channel."&lt;BR /&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;Here is my code&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;void setupPWM(void){&amp;nbsp; PWMPOL = 170; /* outputs are high at the beginning of the period, then go low when the duty count is reached. */&amp;nbsp; PWMCAE = 0;&amp;nbsp;&amp;nbsp; /* operate in left aligned output mode. */&amp;nbsp; PWMCLK = 0;&amp;nbsp;&amp;nbsp; /* Clock B is the clock source for PWM channel 7 and 3, Clock A is the clock source for PWM channel 1and 5. */&amp;nbsp; PWMPRCLK = 0; /* Clock A = Clock B = Bus Clock */&amp;nbsp; PWMCTL = 255; /* Channel 0-1 , 2-3 , 4-5 , 6-7 concatenated */&amp;nbsp; PWMSDN = 0;&amp;nbsp;&amp;nbsp; /* Disable Emergency shutdown */&amp;nbsp; PWMPER01 = 8000; /* setup for PERIOD */&amp;nbsp; PWMDTY01 = 4000; /* setup for DUTY CYCLE */&amp;nbsp; PWME = 255;&amp;nbsp;&amp;nbsp; /* Enable PWM function on Port P for all channel */}void main(void){&amp;nbsp; setupPWM();&amp;nbsp; EnableInterrupts;&amp;nbsp; for(;;){&amp;nbsp; }}&lt;/PRE&gt;&lt;P align="left"&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Then im using the true-time simulator&lt;BR /&gt;with a LED as the visualisation for the adress 0x258 of the PTP byte&lt;BR /&gt;and i have no reaction&lt;BR /&gt;&lt;BR /&gt;The documentation mentionned to set PWMPERx &amp;gt; PWMDTYx&lt;BR /&gt;which i did&lt;BR /&gt;&lt;BR /&gt;then i tried this ( these examples are for a duty cycle around 50%)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;PWMPER01 = 8000;PWMDTY01 = 3841;&lt;/PRE&gt;&lt;P align="left"&gt;&lt;BR /&gt;&amp;nbsp;and with this the LED is working properly&lt;BR /&gt;&lt;BR /&gt;I think the simulator does a comparison between each 8 bits PWMPER1 and PWMDTY1&amp;nbsp;or PWMPER0 and PWMDTY0 to check the condition "PWMPERx &amp;gt; PWMDTYx"&lt;BR /&gt;&lt;BR /&gt;well can someone help me&lt;BR /&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jul 2006 19:13:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Having-trouble-with-the-PWM-setup/m-p/123839#M18</guid>
      <dc:creator>HT</dc:creator>
      <dc:date>2006-07-12T19:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Having trouble with the PWM setup</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Having-trouble-with-the-PWM-setup/m-p/123840#M19</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Not sure if it's related, but I was also having some difficulty with the PWM setup.&amp;nbsp; I documented my woes in this thread:&lt;/P&gt;&lt;P&gt;&lt;A href="http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&amp;amp;message.id=1646" target="_blank"&gt;http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&amp;amp;message.id=1646&lt;/A&gt;&lt;/P&gt;&lt;P&gt;but unfortunately got no response.&amp;nbsp; Maybe someone can cure both our ills.&lt;/P&gt;&lt;P&gt;-Tomahawk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jul 2006 21:33:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Having-trouble-with-the-PWM-setup/m-p/123840#M19</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2006-07-17T21:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: Having trouble with the PWM setup</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Having-trouble-with-the-PWM-setup/m-p/123841#M20</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;well i really need to know if i did something wrong with my prog or if there is a bug with the emulator that would compare each 8 bit sequence of the number 4000 with 8000&lt;BR /&gt;&lt;BR /&gt;4000= 0F | A0&lt;BR /&gt;8000= 1F | 40 &lt;BR /&gt;This should work since DTYx is inferior to PERx but i think it blocks with the part A0 beeing superior to 40 even if 0FA0 is inferior to 1F40&lt;BR /&gt;&lt;BR /&gt;This doesnt work while 3841 instead of 4000 works&lt;BR /&gt;&lt;BR /&gt;3841= 0F | 01 this time 01 is inferior to 40 so that both 8 bits DTyx parts are inferior to the 8 bits parts of the Perx register &lt;BR /&gt;&lt;BR /&gt;I cant check right now if this works or not with a real target though ...&lt;P&gt;Message Edited by HT on &lt;SPAN class="date_text"&gt;2006-07-17&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;03:09 PM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jul 2006 03:07:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Having-trouble-with-the-PWM-setup/m-p/123841#M20</guid>
      <dc:creator>HT</dc:creator>
      <dc:date>2006-07-18T03:07:24Z</dc:date>
    </item>
  </channel>
</rss>

