<?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 Re: how I turn on and off led with TPM module using TPMMOD in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/how-I-turn-on-and-off-led-with-TPM-module-using-TPMMOD/m-p/187560#M14174</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;When the TPM module operates in freerunning mode, the overflow count will be 65536 (2^16).&amp;nbsp; For a prescale value of 1, this will represent the number of bus clock cycles.&amp;nbsp; Assuming 8MHz bus clock, the overflow period will be 65536 / 8 = 8192 microseconds.&amp;nbsp; A quantity of 122 overflow periods gives a total period very close to one second.&amp;nbsp; The timing will have an uncertainty of one overflow period, since the timed period may start anywhere within the overflow cycle.&amp;nbsp; This will give&amp;nbsp;an&amp;nbsp;average period of 121.5 overflows.&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>Mon, 05 Apr 2010 00:54:13 GMT</pubDate>
    <dc:creator>bigmac</dc:creator>
    <dc:date>2010-04-05T00:54:13Z</dc:date>
    <item>
      <title>how I turn on and off led with TPM module  using TPMMOD</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/how-I-turn-on-and-off-led-with-TPM-module-using-TPMMOD/m-p/187555#M14169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how I turn on and off led with TPM module&amp;nbsp; using TPMMOD thanks for your answer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Mar 2010 11:24:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/how-I-turn-on-and-off-led-with-TPM-module-using-TPMMOD/m-p/187555#M14169</guid>
      <dc:creator>yecosuma</dc:creator>
      <dc:date>2010-03-31T11:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: how I turn on and off led with TPM module  using TPMMOD</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/how-I-turn-on-and-off-led-with-TPM-module-using-TPMMOD/m-p/187556#M14170</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;There seems to be some confusion.&amp;nbsp; The TPMMOD register determines the modulo count for the TPM module - the count value at which the TPM counter overflows, and restarts again&amp;nbsp;from a zero value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If your LED application is simply to provide a visual indicator at a relatively slow flash rate, i.e. for a period&amp;nbsp;much greater than the TPM overflow period, use of TPM output compare mode is inappropriate,&amp;nbsp;and variation of the TPMMOD value will mostly be unnecessary.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A&amp;nbsp;method of LED timing control is to set a short TPM overflow period (using a&amp;nbsp;low prescale value), and then choose the LED on and off periods so that they can be represented by an integral number of overflow periods.&amp;nbsp; A RAM based counter register is used to keep track of the number of overflows.&amp;nbsp; During each overflow interrupt, the counter is decremented, and when it reaches zero, the LED is turned on or turned off via a GP output pin, and the counter is set for the next timed period.&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;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Mar 2010 22:06:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/how-I-turn-on-and-off-led-with-TPM-module-using-TPMMOD/m-p/187556#M14170</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2010-03-31T22:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: how I turn on and off led with TPM module  using TPMMOD</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/how-I-turn-on-and-off-led-with-TPM-module-using-TPMMOD/m-p/187557#M14171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am to use xtal of 16Mhz for mcu and TMOD CPWMS=1; THIS&amp;nbsp; IS CORRECT?&lt;/P&gt;&lt;P&gt;&amp;nbsp;how I turn on and off led with TPM module using TPMMOD to one second&amp;nbsp;&lt;/P&gt;&lt;P&gt;i dont undertand because it not work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void tiempo(unsigned char&amp;nbsp; contador)&lt;BR /&gt;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (contador &amp;gt;0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(TPM1SC_TOF&amp;lt;1);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TPM1SC_TOF=0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contador--;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;void main(void) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SOPT1_BKGDPE=1 ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PTCDD = 0B11111111;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PTCD&amp;nbsp; =&amp;nbsp;&amp;nbsp; 0B00000001;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TPM1SC=0B00111111;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TPM1MOD=3125&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; 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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PTCD^=0X01;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tiempo(10);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; } /* loop forever */&lt;BR /&gt;&amp;nbsp; /* please make sure that you never leave main */&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Apr 2010 23:30:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/how-I-turn-on-and-off-led-with-TPM-module-using-TPMMOD/m-p/187557#M14171</guid>
      <dc:creator>yecosuma</dc:creator>
      <dc:date>2010-04-01T23:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: how I turn on and off led with TPM module  using TPMMOD</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/how-I-turn-on-and-off-led-with-TPM-module-using-TPMMOD/m-p/187558#M14172</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;Firstly, you do not show the setup&amp;nbsp;code to make use of the crystal as an external reference.&amp;nbsp; You will also need to set the ICG module for FBE mode (you cannot use FEE mode&amp;nbsp;at 16MHz).&amp;nbsp; On this basis, the use of the&amp;nbsp;fixed frequency clock is not applicable.&amp;nbsp; Using the bus clock as a clock source&amp;nbsp;will give a&amp;nbsp;frequency of 8MHz or lower, depending on lthe RDF setting within the ICGC2 register.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I notice that you are persisting to alter TPM1MOD to a very low value, yet you have a prescale setting (within TPM1SC) of 128.&amp;nbsp; This does not make any sense - reduce the prescale setting to 1, and use a freerunning TPM1 counter (TPM1MOD = 0), or use a much higher TPM1MOD setting, if not freerunning mode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using a prescale of 1 with a bus frequency of 8MHz, the TPM overflow period would be 8.192 milliseconds in freerunning mode.&amp;nbsp; This could be easily&amp;nbsp;used to generate a one second delay, requiring a count value of 122.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You have some additional issues with the TPM1SC setting.&amp;nbsp; CPWMS bit should remain at zero since you are not using centre aligned PWM mode for the module.&amp;nbsp; You have also selected the external TPM clock source, which is not correct.&amp;nbsp; Select the bus clock source.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Within the code for the delay loop, you should also consider periodically reseting the COP timer, to prevent timeout.&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>Fri, 02 Apr 2010 12:53:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/how-I-turn-on-and-off-led-with-TPM-module-using-TPMMOD/m-p/187558#M14172</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2010-04-02T12:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: how I turn on and off led with TPM module using TPMMOD</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/how-I-turn-on-and-off-led-with-TPM-module-using-TPMMOD/m-p/187559#M14173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks&amp;nbsp; for your answer bigmac are very useful for&amp;nbsp; my; i am learn, realy thanks&lt;/P&gt;&lt;P&gt;i have a question, how do I&amp;nbsp;get 8.192 milliseconds? how do I calculate &amp;nbsp;these value? what a count value of 122?&lt;/P&gt;&lt;P&gt;thnaks for your answer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Apr 2010 12:57:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/how-I-turn-on-and-off-led-with-TPM-module-using-TPMMOD/m-p/187559#M14173</guid>
      <dc:creator>yecosuma</dc:creator>
      <dc:date>2010-04-04T12:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: how I turn on and off led with TPM module using TPMMOD</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/how-I-turn-on-and-off-led-with-TPM-module-using-TPMMOD/m-p/187560#M14174</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;When the TPM module operates in freerunning mode, the overflow count will be 65536 (2^16).&amp;nbsp; For a prescale value of 1, this will represent the number of bus clock cycles.&amp;nbsp; Assuming 8MHz bus clock, the overflow period will be 65536 / 8 = 8192 microseconds.&amp;nbsp; A quantity of 122 overflow periods gives a total period very close to one second.&amp;nbsp; The timing will have an uncertainty of one overflow period, since the timed period may start anywhere within the overflow cycle.&amp;nbsp; This will give&amp;nbsp;an&amp;nbsp;average period of 121.5 overflows.&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>Mon, 05 Apr 2010 00:54:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/how-I-turn-on-and-off-led-with-TPM-module-using-TPMMOD/m-p/187560#M14174</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2010-04-05T00:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: how I turn on and off led with TPM module using TPMMOD</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/how-I-turn-on-and-off-led-with-TPM-module-using-TPMMOD/m-p/187561#M14175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello thanks for your answers already I&amp;nbsp;learned more with you help.&lt;/P&gt;&lt;P&gt;now&amp;nbsp;&amp;nbsp;I belive&amp;nbsp;this module this working but not correctly, I believe I am failing in something&amp;nbsp;because the led flashing until that the value count is 1......28&amp;nbsp; when&amp;nbsp;is 29........122 not working i dont understand&amp;nbsp;what happend&amp;nbsp;i send code for check you which is the error please; is probable I am setting bad the registers or something missing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Apr 2010 07:32:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/how-I-turn-on-and-off-led-with-TPM-module-using-TPMMOD/m-p/187561#M14175</guid>
      <dc:creator>yecosuma</dc:creator>
      <dc:date>2010-04-05T07:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: how I turn on and off led with TPM module using TPMMOD</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/how-I-turn-on-and-off-led-with-TPM-module-using-TPMMOD/m-p/187562#M14176</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;As I said in my earler post, you should reset the COP timer, both within the delay loop and the main loop.&amp;nbsp; This is otherwise known as "feeding the watchdog".&amp;nbsp; Most likely is that you currently have COP timeout, causing reset of the MCU, prior to the completion of the delay.&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>Mon, 05 Apr 2010 19:51:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/how-I-turn-on-and-off-led-with-TPM-module-using-TPMMOD/m-p/187562#M14176</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2010-04-05T19:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: how I turn on and off led with TPM module using TPMMOD</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/how-I-turn-on-and-off-led-with-TPM-module-using-TPMMOD/m-p/187563#M14177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello, thanks for your answers, realy thaks already the circuit is working, I learned very things&lt;/P&gt;&lt;P&gt;a freerunning mode always TMOD=0; and others thinks of settings and more; thanks thanks thanks. bicmag&lt;/P&gt;&lt;P&gt;I will follow learn;&lt;/P&gt;&lt;P&gt;other question;&amp;nbsp; what do &amp;nbsp;i have that make&amp;nbsp;&amp;nbsp;2 cop&amp;nbsp; once within the delay loop and other in &amp;nbsp;the main loop?.&lt;/P&gt;&lt;P&gt;another&amp;nbsp; I want use a pull up in PTC OF THIS MCU&amp;nbsp; MC9S08LC60&amp;nbsp; BUT i obtain this message&lt;/P&gt;&lt;P&gt;error at location 1838&amp;nbsp; attemp to write&amp;nbsp; to read-only location&lt;/P&gt;&lt;P&gt;the port register PTCPE IS READ AND WRITE I DONT HAVE BECAUSE HAPPEN THIS&amp;nbsp; THANKS NEWLY FOR YOU ANSWER&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="Helvetica-Bold" size="6"&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Apr 2010 11:03:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/how-I-turn-on-and-off-led-with-TPM-module-using-TPMMOD/m-p/187563#M14177</guid>
      <dc:creator>yecosuma</dc:creator>
      <dc:date>2010-04-06T11:03:31Z</dc:date>
    </item>
  </channel>
</rss>

