<?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 with TPM Timer at low frequency in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-with-TPM-Timer-at-low-frequency/m-p/172054#M11693</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&amp;nbsp; I need a PWM function to use with a frequency of as low as a minute or two.&amp;nbsp; For example, a freq of 1 minute would provide a 30 secs on/30 secs off with a 50% duty cycle.&amp;nbsp; I'm using a 32.768kHz&amp;nbsp;external crystal attached to the XTAL pins,&amp;nbsp;and have&amp;nbsp;a bus frequency of 4MHz.&amp;nbsp; Unfortunately, dividing the clock by 128 and doing a full count in the TPM counter 0xFFFF does not provide a sufficiently long time period.&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a statement in my user manual that an internal "XCLK" could be used.&amp;nbsp; After reading what I could find in this forum, I still cannot figure out if there's a way to provide a lower clock freq to the TPM without changing the bus clock frequency.&amp;nbsp; If using the "XCLK" is an option, any suggestions about what registers to alter to provide a lower clock freq for the TPM ?&amp;nbsp; I am using the HCS08LG32 (C coding).&amp;nbsp;&amp;nbsp; Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 Feb 2010 09:01:53 GMT</pubDate>
    <dc:creator>Thunder</dc:creator>
    <dc:date>2010-02-02T09:01:53Z</dc:date>
    <item>
      <title>PWM with TPM Timer at low frequency</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-with-TPM-Timer-at-low-frequency/m-p/172054#M11693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&amp;nbsp; I need a PWM function to use with a frequency of as low as a minute or two.&amp;nbsp; For example, a freq of 1 minute would provide a 30 secs on/30 secs off with a 50% duty cycle.&amp;nbsp; I'm using a 32.768kHz&amp;nbsp;external crystal attached to the XTAL pins,&amp;nbsp;and have&amp;nbsp;a bus frequency of 4MHz.&amp;nbsp; Unfortunately, dividing the clock by 128 and doing a full count in the TPM counter 0xFFFF does not provide a sufficiently long time period.&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a statement in my user manual that an internal "XCLK" could be used.&amp;nbsp; After reading what I could find in this forum, I still cannot figure out if there's a way to provide a lower clock freq to the TPM without changing the bus clock frequency.&amp;nbsp; If using the "XCLK" is an option, any suggestions about what registers to alter to provide a lower clock freq for the TPM ?&amp;nbsp; I am using the HCS08LG32 (C coding).&amp;nbsp;&amp;nbsp; Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Feb 2010 09:01:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-with-TPM-Timer-at-low-frequency/m-p/172054#M11693</guid>
      <dc:creator>Thunder</dc:creator>
      <dc:date>2010-02-02T09:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: PWM with TPM Timer at low frequency</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-with-TPM-Timer-at-low-frequency/m-p/172055#M11694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Thunder,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With a frequency that low, you don't need a PWM module at all. You could more easily bit-bang it. Here is how I have done it:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expand the timer to 24 or 32 bits. Simply allocate the byte or two in ram, and increment it in the timer-overflow interrupt-service routine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check the expanded timer at a predetermined interval to see if it is time to toggle the output-bit. You can simply use the timer-overflow if you don't need much precision, or if you do need precision, you can use the timer's compare function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've used this technique for a PWM with a 20 second cycle-time and 1/8 second resolution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;mark&lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by rocco on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2010-02-01&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;06:05 PM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Feb 2010 10:02:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-with-TPM-Timer-at-low-frequency/m-p/172055#M11694</guid>
      <dc:creator>rocco</dc:creator>
      <dc:date>2010-02-02T10:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: PWM with TPM Timer at low frequency</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-with-TPM-Timer-at-low-frequency/m-p/172056#M11695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rocco, your suggestions work well.&lt;/P&gt;&lt;P&gt;I also went back to look into changing the clock input to the TPM.&amp;nbsp; It seems that XCLK, the internal clock, is the signal pre-filter to the DCO.&amp;nbsp; In my case, it is correlated to the 32.768kHz crystal frequency which is being used external to the processor.&amp;nbsp; With RDIV=0 and setting this clock for TPM input (plus divide by 128), I am able to get a very low frequency.&amp;nbsp; I'm still having a few problems setting the modulus (the program memory doesn't seem to want to accept any changes to this register for some reason), but that's another problem.&lt;/P&gt;&lt;P&gt;I should be able to use either method for generating the PWM.&amp;nbsp; Thanks again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Feb 2010 12:06:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/PWM-with-TPM-Timer-at-low-frequency/m-p/172056#M11695</guid>
      <dc:creator>Thunder</dc:creator>
      <dc:date>2010-02-03T12:06:41Z</dc:date>
    </item>
  </channel>
</rss>

