<?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: Output PWM from MC68HC908QY4A</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Output-PWM-from-MC68HC908QY4A/m-p/213003#M18377</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks all. Since both signals have a fixed duty cycle. I think I can use timer interrput to generate the second signal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 Jul 2010 20:25:50 GMT</pubDate>
    <dc:creator>aurora</dc:creator>
    <dc:date>2010-07-15T20:25:50Z</dc:date>
    <item>
      <title>Output PWM from MC68HC908QY4A</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Output-PWM-from-MC68HC908QY4A/m-p/213000#M18374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using a MC68HC908QY4A microcontroller. It has 2 timer channels. Is it possible to have one channel (PTA0) output a 1KHz square waveform and another channel (PTA1) output a 2KHz square waveform?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-email-small" href="mailto:hliu@parkell.com"&gt;hliu@parkell.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jul 2010 21:21:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Output-PWM-from-MC68HC908QY4A/m-p/213000#M18374</guid>
      <dc:creator>aurora</dc:creator>
      <dc:date>2010-07-14T21:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: Output PWM from MC68HC908QY4A</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Output-PWM-from-MC68HC908QY4A/m-p/213001#M18375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can see a couple of possibilities.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use PWM mode with 50 percent duty for the 1kHz signal, and use output compare mode on the other channel&amp;nbsp;to generate&amp;nbsp;the 2kHz signal.&amp;nbsp; The PWM output will not require any interrupts, but the output compare channel interrupt will require servicing every 250 microseconds.&amp;nbsp; The modulo value will need to be set for an overflow period of 1 millisecond, and since it is not free-running, this will add complication to the calculation of the next output compare value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another alternative would be to use output compare mode for both channels.&amp;nbsp; This would increase the number of interrupts required, with one every 500 microseconds, and another every 250 microseconds.&amp;nbsp; However, since the TIM module could be free-running, this would simplify the calculation of the next output compare value for both signals.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have a strict phase relationship requirement between the two waveforms?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jul 2010 01:18:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Output-PWM-from-MC68HC908QY4A/m-p/213001#M18375</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2010-07-15T01:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: Output PWM from MC68HC908QY4A</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Output-PWM-from-MC68HC908QY4A/m-p/213002#M18376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Aurora,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Another option, similar to Mac's, is to set the modulus to overflow every half-millisecond.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You could then use one channel as 50% PWM to give you 2 kHz, and toggle the other channel (or an I/O pin) on every overflow (or output-compare) to give you 1kHz.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I believe (from un-refreshed memory) that there is either a toggle on compare or toggle on overflow function in the QY's timer, but I don't have access to the datasheet right now. That would allow generating both square-waves with no interrupts to service.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jul 2010 05:07:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Output-PWM-from-MC68HC908QY4A/m-p/213002#M18376</guid>
      <dc:creator>rocco</dc:creator>
      <dc:date>2010-07-15T05:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: Output PWM from MC68HC908QY4A</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Output-PWM-from-MC68HC908QY4A/m-p/213003#M18377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks all. Since both signals have a fixed duty cycle. I think I can use timer interrput to generate the second signal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jul 2010 20:25:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Output-PWM-from-MC68HC908QY4A/m-p/213003#M18377</guid>
      <dc:creator>aurora</dc:creator>
      <dc:date>2010-07-15T20:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Output PWM from MC68HC908QY4A</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Output-PWM-from-MC68HC908QY4A/m-p/213004#M18378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I rather like Rocco's approach that would not require any interrupts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both toggle on overflow and toggle on compare are available for both channels, however it would appear than toggle on overflow would not work unless output compare mode is selected.&amp;nbsp; So, toggle on compare for the 1kHz channel should&amp;nbsp;give the desired result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps the following setup would work, assuming trimmed 3.2MHz bus clock frequency, and with channel 0 used for the 2kHz output, and channel 1 for the 1kHz output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;TSC = 0x30;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Stop and clear TIM counter, prescale 1&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;TMOD = 1599;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Overflow period 500us&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;TCH0 = 800;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// 50% duty for Ch 0&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;TSC0 = 0x1A;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Unbuffered PWM with clear&amp;nbsp;O/P on compare&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;TCH1 = 800;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Toggle point for Ch 1 output&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;TSC1 = 0x14;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Output compare with toggle on compare&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;TSC_TSTOP = 0;&amp;nbsp;// Enable TIM counter&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With this setting, the 1kHz signal should toggle on each negative edge of the 2kHz signal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jul 2010 23:00:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Output-PWM-from-MC68HC908QY4A/m-p/213004#M18378</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2010-07-15T23:00:37Z</dc:date>
    </item>
  </channel>
</rss>

