<?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>8-bit MicrocontrollersのトピックRe: PWM Setup Issue - Can't make TPMCH0 work!</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-Setup-Issue-Can-t-make-TPMCH0-work/m-p/141088#M5825</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Here is the updated code. Still no deal. I'm definitely confused.&lt;BR /&gt;&lt;BR /&gt;void main(void) {&lt;BR /&gt;SOPT1_COPE = 0; //Disable Watchdog&lt;BR /&gt;&lt;BR /&gt;TPMMODH = 0x27; // set period to x10,000&lt;BR /&gt;TPMMODL = 0x09;&lt;BR /&gt;TPMC1VH = 0x13; // set duty cycle to x5,000&lt;BR /&gt;TPMC1VL = 0x88;&lt;BR /&gt;TPMC1SC = 0x24; // set channel 1 for PWM&lt;BR /&gt;TPMC0VH = 0x13; // set duty cycle to x5,000&lt;BR /&gt;TPMC0VL = 0x88;&lt;BR /&gt;TPMC0SC = 0x24; // set channel 0 for PWM&lt;BR /&gt;TPMSC = 0x08; // select bus clock and start timer&lt;BR /&gt;&lt;BR /&gt;for(;&lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt; {} //Loop Forever&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;R.&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 23 Dec 2006 22:31:03 GMT</pubDate>
    <dc:creator>Ryanst</dc:creator>
    <dc:date>2006-12-23T22:31:03Z</dc:date>
    <item>
      <title>PWM Setup Issue - Can't make TPMCH0 work!</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-Setup-Issue-Can-t-make-TPMCH0-work/m-p/141086#M5823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everyone... Here is the deal. I wrote some simple code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void main(void) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EnableInterrupts; /* enable interrupts */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;TPMMODH = 0x27; // set period to x10,000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TPMMODL = 0x09;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TPMC1VH = 0x13; // set duty cycle to x5,000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TPMC1VL = 0x88;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TPMC1SC = 0x24; // set channel 1 for PWM&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TPMC0VH = 0x13; // set duty cycle to x5,000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TPMC0VL = 0x88;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TPMC0SC = 0x24; // set channel 1 for PWM&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TPMSC = 0x08; // select bus clock and start timer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for(;&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;SPAN&gt; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;__RESET_WATCHDOG(); /* feeds the dog */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;} /* loop forever */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/* please make sure that you never leave main */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Well... Actually I partially wrote it. Most if it came out of a sample application that came with the MC9S08QG8 demo board. When I load this onto the chip I can measure the output at TPMCH1 as 1.67V which is rough what I would expect at 50% duty cycle. For the life of me I can't get any output whatsoever on TPMCH0... even though I just copied and pasted the code from 3 lines above it and changed a couple numbers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After fighting with this for the day I've decided to post here. If anyone has any ideas I would be greatly appreciative! I'm sure I'm just missing something obvious and crucial.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ryan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Dec 2006 07:11:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-Setup-Issue-Can-t-make-TPMCH0-work/m-p/141086#M5823</guid>
      <dc:creator>Ryanst</dc:creator>
      <dc:date>2006-12-23T07:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: PWM Setup Issue - Can't make TPMCH0 work!</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-Setup-Issue-Can-t-make-TPMCH0-work/m-p/141087#M5824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;The watchdog timer is probably firing while you're setting up the PWM functions. The code probably isn't making it to the __RESET_WATCHDOG() loop.&lt;BR /&gt;&lt;BR /&gt;To fix this, you can either disable the watchdog early in main() or sprinkle watchdog resets throughout your setup phase. I would also recommend not enabling interrupts until after the setup/init phase.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Dec 2006 19:35:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-Setup-Issue-Can-t-make-TPMCH0-work/m-p/141087#M5824</guid>
      <dc:creator>thisobj</dc:creator>
      <dc:date>2006-12-23T19:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: PWM Setup Issue - Can't make TPMCH0 work!</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-Setup-Issue-Can-t-make-TPMCH0-work/m-p/141088#M5825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Here is the updated code. Still no deal. I'm definitely confused.&lt;BR /&gt;&lt;BR /&gt;void main(void) {&lt;BR /&gt;SOPT1_COPE = 0; //Disable Watchdog&lt;BR /&gt;&lt;BR /&gt;TPMMODH = 0x27; // set period to x10,000&lt;BR /&gt;TPMMODL = 0x09;&lt;BR /&gt;TPMC1VH = 0x13; // set duty cycle to x5,000&lt;BR /&gt;TPMC1VL = 0x88;&lt;BR /&gt;TPMC1SC = 0x24; // set channel 1 for PWM&lt;BR /&gt;TPMC0VH = 0x13; // set duty cycle to x5,000&lt;BR /&gt;TPMC0VL = 0x88;&lt;BR /&gt;TPMC0SC = 0x24; // set channel 0 for PWM&lt;BR /&gt;TPMSC = 0x08; // select bus clock and start timer&lt;BR /&gt;&lt;BR /&gt;for(;&lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt; {} //Loop Forever&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;R.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Dec 2006 22:31:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-Setup-Issue-Can-t-make-TPMCH0-work/m-p/141088#M5825</guid>
      <dc:creator>Ryanst</dc:creator>
      <dc:date>2006-12-23T22:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: PWM Setup Issue - Can't make TPMCH0 work!</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-Setup-Issue-Can-t-make-TPMCH0-work/m-p/141089#M5826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I ran your latest code with no problems.&lt;BR /&gt;Are you testing the output on J1-20 or on pin 16 of the chip?&lt;BR /&gt;&lt;BR /&gt;As a test, you might want to configure the pin as an output and toggling it hi/lo in your for(..) loop to test the pin. Something like this:&lt;BR /&gt;&lt;BR /&gt;void main(void) {&lt;BR /&gt;int delay;&lt;BR /&gt;&lt;BR /&gt;SOPT1_COPE = 0; //Disable Watchdog&lt;BR /&gt;&lt;BR /&gt;TPMMODH = 0x27; // set period to x10,000&lt;BR /&gt;TPMMODL = 0x09;&lt;BR /&gt;TPMC1VH = 0x13; // set duty cycle to x5,000&lt;BR /&gt;TPMC1VL = 0x88;&lt;BR /&gt;TPMC1SC = 0x24; // set channel 1 for PWM&lt;BR /&gt;&lt;BR /&gt;//TPMC0VH = 0x13; // set duty cycle to x5,000&lt;BR /&gt;//TPMC0VL = 0x88;&lt;BR /&gt;//!!!!!!!!!!!!!!!!!!! add the following 2 lines !!!!!!!!!!!!!!!!!!&lt;BR /&gt;PTADD |= 0x01; // PTA0: output&lt;BR /&gt;PTAD |= 0x01; // init to hi state&lt;BR /&gt;//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&lt;BR /&gt;//TPMC0SC = 0x00; //0x24; // set channel 0 for PWM&lt;BR /&gt;TPMSC = 0x08; // select bus clock and start timer&lt;BR /&gt;&lt;BR /&gt;// toggle PTA0 in loop (approx 5.5 msec period)&lt;BR /&gt;for (;&lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt; {&lt;BR /&gt;delay = 500;&lt;BR /&gt;while ( --delay );&lt;BR /&gt;PTAD ^= 0x01; // toggle PTA0&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;}&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 Dec 2006 05:49:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-Setup-Issue-Can-t-make-TPMCH0-work/m-p/141089#M5826</guid>
      <dc:creator>thisobj</dc:creator>
      <dc:date>2006-12-24T05:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: PWM Setup Issue - Can't make TPMCH0 work!</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-Setup-Issue-Can-t-make-TPMCH0-work/m-p/141090#M5827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;With that code the port still doesn't toggle. I've tried three different chips now too and they all behave the same way. The code below waokrs if I adjust it for Port B6... that one toggles fine. Any more ideas?&lt;BR /&gt;&lt;BR /&gt;R.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;int delay;&lt;BR /&gt;&lt;BR /&gt;SOPT1_COPE = 0; //Disable Watchdog&lt;BR /&gt;&lt;BR /&gt;TPMMODH = 0x27; // set period to x10,000&lt;BR /&gt;TPMMODL = 0x09;&lt;BR /&gt;TPMC1VH = 0x13; // set duty cycle to x5,000&lt;BR /&gt;TPMC1VL = 0x88;&lt;BR /&gt;TPMC1SC = 0x24; // set channel 1 for PWM&lt;BR /&gt;&lt;BR /&gt;PTADD_PTADD0 |= 1; // PTA0: output&lt;BR /&gt;PTAD_PTAD0 |= 1; // init to hi state&lt;BR /&gt;&lt;BR /&gt;TPMSC = 0x08; // select bus clock and start timer&lt;BR /&gt;&lt;BR /&gt;// toggle PTA0 in loop (approx 5.5 msec period)&lt;BR /&gt;for (;&lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt; {&lt;BR /&gt;delay = 30000;&lt;BR /&gt;while ( --delay ) {}&lt;BR /&gt;PTAD_PTAD0 ^= 1; // toggle&lt;BR /&gt;}&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Dec 2006 02:39:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-Setup-Issue-Can-t-make-TPMCH0-work/m-p/141090#M5827</guid>
      <dc:creator>Ryanst</dc:creator>
      <dc:date>2006-12-25T02:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: PWM Setup Issue - Can't make TPMCH0 work!</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-Setup-Issue-Can-t-make-TPMCH0-work/m-p/141091#M5828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Okay, next time I promise I'll look at the schematic FIRST. &lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;BR /&gt;&lt;BR /&gt;The PTA0 line muxes with an A/D input whose voltage is set by RV1 pot. Depending on the position of this pot, it can place PTA0 near ground, causing loss of pulse output.&lt;BR /&gt;&lt;BR /&gt;Try removing jumper RV1 on the USER EN jumper string to remove the voltage divider from PTA0 pin. That should fix the PTA0 output problem.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Dec 2006 11:41:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-Setup-Issue-Can-t-make-TPMCH0-work/m-p/141091#M5828</guid>
      <dc:creator>thisobj</dc:creator>
      <dc:date>2006-12-25T11:41:51Z</dc:date>
    </item>
    <item>
      <title>Resolved!</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-Setup-Issue-Can-t-make-TPMCH0-work/m-p/141092#M5829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Thanks so much! That fixed the problem. I'm good to go now!&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Dec 2006 05:46:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-Setup-Issue-Can-t-make-TPMCH0-work/m-p/141092#M5829</guid>
      <dc:creator>Ryanst</dc:creator>
      <dc:date>2006-12-26T05:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: PWM Setup Issue - Can't make TPMCH0 work!</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-Setup-Issue-Can-t-make-TPMCH0-work/m-p/141093#M5830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Oh my goodness, you just saved me a lot of time.&amp;nbsp; For anybody searching the forums - My PWM was giving a very weak signal (only 100 mV p-p) which I for some reason assumed was a result of a software problem.&amp;nbsp; I never even stopped to think about an analog solution (the voltage divider on evaluation board was still connected to the pin).&lt;BR /&gt;&lt;BR /&gt;Thanks a million.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jan 2008 17:16:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-Setup-Issue-Can-t-make-TPMCH0-work/m-p/141093#M5830</guid>
      <dc:creator>PatrickW</dc:creator>
      <dc:date>2008-01-30T17:16:45Z</dc:date>
    </item>
  </channel>
</rss>

