<?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: PWM on MC68H908JB in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217284#M8599</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 was actually suggesting to avoid&amp;nbsp;both&amp;nbsp;values zero and TMOD within your table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With a TMOD setting of 63 decimal, and a minimum channel value of 1, the minimum duty will be 1/64.&amp;nbsp; For a higher TMOD values, the minimum duty would be proportionally smaller.&amp;nbsp; This is&amp;nbsp;to achieve&amp;nbsp;maximum output voltage&amp;nbsp;swing about a mean value corresponding with 50 percent duty.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When using the 64 entry table, did you increase the TIM prescale factor, as I previously suggested?&amp;nbsp; Maybe select a division ratio of 4.&amp;nbsp; This will then allow nearly 256 bus cycles to process the ISR function.&amp;nbsp; With the former prescale&amp;nbsp;division of 1,&amp;nbsp;there would be somewhat less than 64 bus cycles available, which may not be enough time.&amp;nbsp; There will be less time available between interrupts as the duty decreases, and a little more time as the duty increases (affected by the difference between two adjacent table entries).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps&amp;nbsp;you should also recheck your sine table calculations to see whether any significant arithmetic&amp;nbsp;errors have crept in.&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;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Jul 2011 17:42:51 GMT</pubDate>
    <dc:creator>bigmac</dc:creator>
    <dc:date>2011-07-01T17:42:51Z</dc:date>
    <item>
      <title>PWM on MC68H908JB</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217274#M8589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am really new to freescale uControllers and I have been trying for a while to get a working pwm from JB8 controller but to no avail. following is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#include &amp;lt;hidef.h&amp;gt; /* for EnableInterrupts macro */&lt;BR /&gt;#include "derivative.h" /* include peripheral declarations */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void main(void) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; EnableInterrupts; /* enable interrupts */&lt;BR /&gt;&amp;nbsp; /* include your code here */&lt;BR /&gt;&amp;nbsp; TSC=(TSC&amp;amp;0xCF)|0x30;&lt;BR /&gt;&amp;nbsp; TMODH=0x00;&lt;BR /&gt;&amp;nbsp; TMODL=0x7F;&lt;BR /&gt;&amp;nbsp; TCH0H=0x00;&lt;BR /&gt;&amp;nbsp; TCH0L=0x7F;&lt;BR /&gt;&amp;nbsp; TSC0=TSC0|0x1A;&lt;BR /&gt;&amp;nbsp; TSC=TSC|0x20;&lt;BR /&gt;&amp;nbsp; while(1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; for(;&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;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; __RESET_WATCHDOG(); /* feeds the dog */&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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please help me as this is not working even though i followed all the steps in the datsheet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2011 18:25:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217274#M8589</guid>
      <dc:creator>champion_7891</dc:creator>
      <dc:date>2011-06-23T18:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: PWM on MC68H908JB</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217275#M8590</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;You have set the TCH0 register to a value equal to the TMOD register setting.&amp;nbsp; The outcome of this has a degree of uncertainty - I suspect you will get almost 100 percent duty, with a very narrow low going pulse.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The final write to TSC actually stops the module, and this is why there is no action to be seen.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the TPM initialisation code that I would try, assuming an initial 50 percent duty:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;TSC&amp;nbsp; = 0x20;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Prescale 1, TIM disabled&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;TMOD&amp;nbsp;= 0x007F;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;TCH0 = 0x0040;&amp;nbsp; // 50 percent duty&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, clear O/P 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;Note that, interrupts are not necessary provided the duty remains constant.&amp;nbsp; However, should you wish to change the duty without any glitches, this will need to be done within&amp;nbsp;a TIM channel ISR, immediately after the current output pulse has gone low.&amp;nbsp; The ISR code&amp;nbsp;would obtain the new duty value from a global variable, update the TCH0 register, and&amp;nbsp;disable further interrupts.&amp;nbsp; The interrupt flag would also be cleared.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A final comment - while not relevant to the current issue, it is usually a good coding practice to globally enable interrupts &lt;U&gt;after&lt;/U&gt; the various peripherals have been initialised.&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, 24 Jun 2011 00:55:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217275#M8590</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2011-06-24T00:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: PWM on MC68H908JB</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217276#M8591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey man thanks a lot!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A couple of questions:&lt;/P&gt;&lt;P&gt;1. polling (while(1); ) after the code you have given indeed gives a 50% duty cycle pwm...removing polling generates a periodic, exponential decaying to zero, waveform...could you explain that.&lt;/P&gt;&lt;P&gt;2. Ok, i measured the time period to be 42.64 x10^-6 s i.e. the pulse is high for half that time ie 21.32 us. Theoretically, I would have been able to find the high time as TCH0*T, where for me T=1/3MHz, and TCH0 was set as 0x0040...i.e. 64....i find the value to be 21.3us for high time...which is negligibly different from what I actually obtain...what I dont get is that to get 100% duty cycle then I would have to set TCH0 to 128....however, TCH0 can hold upto 65535...so, how is this related to duty cycle I mean from my understanding, duty cycle is the value set in TCH0 divided by the maximum value that TCH0 can hold?&lt;/P&gt;&lt;P&gt;3. TMOD, the pulse width...where do I see it practically? How is it different from duty cycle?&lt;/P&gt;&lt;P&gt;4. my intentions are to finally generate a 50Hz sine wave using a sine lookup table, with a JL16...but again since I am new, I have started with JB8...could you please explain how i will call an interrupt function (and use TIM channel registers as you stated above), to do so...I have actually done this on AVR ATMEGA16, but&amp;nbsp; the addition of channel registers, and actually going about calling an interrupt function in JB8, has left me at loss.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jun 2011 12:08:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217276#M8591</guid>
      <dc:creator>champion_7891</dc:creator>
      <dc:date>2011-06-24T12:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: PWM on MC68H908JB</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217277#M8592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;elaborating on point 4 above:&lt;/P&gt;&lt;P&gt;I wrote the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#include &amp;lt;hidef.h&amp;gt; /* for EnableInterrupts macro */&lt;BR /&gt;#include "derivative.h" /* include peripheral declarations */&lt;BR /&gt;static unsigned char sample_number=0;&lt;BR /&gt;static unsigned char sine_table[64]={32,33,35,36,38,39,40,42,43,45,46,47,49,50,51,52,53,54,55,56,57,58,59,60,60,61,61,62,62,62,62,62,62,62,62,62,62,62,61,61,60,60,59,58,57,56,55,54,53,52,51,50,49,47,46,45,43,42,40,39,38,36,35,33};&lt;/P&gt;&lt;P&gt;interrupt void TimerTOF(void);&lt;BR /&gt;void main(void) {&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; TSC&amp;nbsp; = 0x20;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Prescale 1, TIM disabled&lt;/P&gt;&lt;P&gt;&amp;nbsp; TMOD = 0x0040; //64&lt;/P&gt;&lt;P&gt;&amp;nbsp; TCH0 = 0x0020;&amp;nbsp; // 50 percent duty&lt;/P&gt;&lt;P&gt;&amp;nbsp; TSC0 = 0x1A;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Unbuffered PWM, clear O/P on compare&lt;/P&gt;&lt;P&gt;&amp;nbsp; TSC_TSTOP = 0;&amp;nbsp; // Enable TIM counter&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; EnableInterrupts;&lt;BR /&gt;&amp;nbsp; while(1);&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;interrupt void TimerTOF (void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; TCH0=sine_table[sample_number];&lt;BR /&gt;&amp;nbsp; sample_number++;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; if (sample_number&amp;gt;=64){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sample_number=0;&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now:&lt;/P&gt;&lt;P&gt;a. I have used a 64 value sine table pre generated.&lt;/P&gt;&lt;P&gt;b. Running the code as it is causes nothing but a 50% duty cycle pwm.&lt;/P&gt;&lt;P&gt;c. calling the TimerTOF function just before the poll (while(1); ) and after EnableInterrupts causes a memory error: Link Error: L1102: Out of allocation space in segment RAM at address 0x140;&lt;/P&gt;&lt;P&gt;d. declaring the sine_table as const and then doing c causes the link error to disappear. however, the generated wave is not changing in duty cycle according to the sine lookup table. Infact, a contsant duty cycle of &amp;lt;10% is obtained.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jun 2011 15:01:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217277#M8592</guid>
      <dc:creator>champion_7891</dc:creator>
      <dc:date>2011-06-24T15:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: PWM on MC68H908JB</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217278#M8593</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;OL&gt;&lt;LI&gt;The sine table requires to be located in flash as a constant array.&lt;/LI&gt;&lt;LI&gt;I do not see where you are clearing the interrupt flag.&amp;nbsp; The ISR will immediately be re-entered.&lt;/LI&gt;&lt;LI&gt;You are using the wrong interrupt.&amp;nbsp; You will&amp;nbsp;need to use the TIM channel interrupt to avoid&amp;nbsp;output glitches due to timing conflicts between overflow and output compare events.&lt;/LI&gt;&lt;LI&gt;If the COP timer is enabled, you are not clearing this timer within the while loop, so a COP reset would eventually occur.&amp;nbsp; I might suggest that you utilise the standard main() framework, as provided by the new&amp;nbsp;project wizzard.&amp;nbsp; I seem to recall that using&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;while (1) {&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; // this generates a compiler warning message&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;for ( ; ; )&amp;nbsp;{&amp;nbsp; }&amp;nbsp; //&lt;/FONT&gt; does not generate a warning message&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once the other problems are fixed, the output frequency should be about 721 Hz, with a 3 MHz bus frequency (3000000 / 65 / 64).&amp;nbsp; If there are N phase increments per output cycle (the table size), the output frequency is given by:&lt;BR /&gt;Fout = Fbus / (TMOD +1) / N&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the same bus frequency, to achieve a fixed output frequency of 50 Hz suggests that N = 240, TMOD = 249 would be a suitable combination.&amp;nbsp; The sine table values should be restricted between&amp;nbsp;the limits 1 and 248.&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, 24 Jun 2011 22:22:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217278#M8593</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2011-06-24T22:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: PWM on MC68H908JB</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217279#M8594</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;Thanks again. i would appreciate it immensely if you could provide some code about the interrupts. I have been honestly trying for hours but can't get them to work.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Jun 2011 15:38:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217279#M8594</guid>
      <dc:creator>champion_7891</dc:creator>
      <dc:date>2011-06-26T15:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: PWM on MC68H908JB</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217280#M8595</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;You might try the following code for the TIM&amp;nbsp;Channel 0 ISR:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;interrupt 4 void ISR_TIM_Ch0( void){  TCH0 = sine_table[sample_number];  sample_number++;  if (sample_number &amp;gt;= 64){    sample_number = 0;  }  TSC0_CH0F = 0;    // Clear flag}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;The register TSC0 should be initialised to a value of 0x5A.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the previous small TMOD value, this ISR would need to complete in substantially less than 65 bus cycles, but this may not actually be feasible.&amp;nbsp; So there may still be problems due to missed interrupts.&amp;nbsp; If this is so, you could try increasing the prescale setting while you are experimenting with&amp;nbsp;the small TMOD values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The number of bus cycles required by ISR, or other code, can be ascertained using full chip simulation.&amp;nbsp; But there will be some additional fixed overheads for ISR entry (vector fetch process)&amp;nbsp;and ISR exit (RTI return).&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>Sun, 26 Jun 2011 17:34:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217280#M8595</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2011-06-26T17:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: PWM on MC68H908JB</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217281#M8596</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;Thanks a lot bigmac. I have a problem, however:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The sine wave that is generated has a few kinks, one just after the peak, and a couple maybe maybe a tenth a cycle before the peak. These kinks are basically a localized fall in amplitude. Now, I have tried various sine tables, with 64, 128, and 256 values, but these kinks always appear in the same place. Any idea why?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2011 12:43:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217281#M8596</guid>
      <dc:creator>champion_7891</dc:creator>
      <dc:date>2011-06-28T12:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: PWM on MC68H908JB</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217282#M8597</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;What sort of low pass filter do you have at the timer output?&amp;nbsp; Does this have active components that could be subject to overload and distortion?&amp;nbsp; Also check the TIM output waveform to see whether there are any glitches, i.e. the duty does not smoothly increase and decrease over the output cycle.&amp;nbsp; This is probably best&amp;nbsp;checked with 64 state table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume that the highest value in each table does not exceed TMOD-1, and a table value of zero is not used.&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, 30 Jun 2011 11:27:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217282#M8597</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2011-06-30T11:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: PWM on MC68H908JB</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217283#M8598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using an RC filter with a 100nF Myler Capacitor and a 10k resistor. There are no active components. Actually, there are glitches in the PWM waveform. I'll check back later to tell you exactly where they are but I can tell you that duty cycle decreases to almost 0 where it shoud not. About the table value, I used it both ways (i.e. with 0 and without), but the effect was the same. And yes, max value does not exceed TMOD.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jul 2011 12:04:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217283#M8598</guid>
      <dc:creator>champion_7891</dc:creator>
      <dc:date>2011-07-01T12:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: PWM on MC68H908JB</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217284#M8599</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 was actually suggesting to avoid&amp;nbsp;both&amp;nbsp;values zero and TMOD within your table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With a TMOD setting of 63 decimal, and a minimum channel value of 1, the minimum duty will be 1/64.&amp;nbsp; For a higher TMOD values, the minimum duty would be proportionally smaller.&amp;nbsp; This is&amp;nbsp;to achieve&amp;nbsp;maximum output voltage&amp;nbsp;swing about a mean value corresponding with 50 percent duty.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When using the 64 entry table, did you increase the TIM prescale factor, as I previously suggested?&amp;nbsp; Maybe select a division ratio of 4.&amp;nbsp; This will then allow nearly 256 bus cycles to process the ISR function.&amp;nbsp; With the former prescale&amp;nbsp;division of 1,&amp;nbsp;there would be somewhat less than 64 bus cycles available, which may not be enough time.&amp;nbsp; There will be less time available between interrupts as the duty decreases, and a little more time as the duty increases (affected by the difference between two adjacent table entries).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps&amp;nbsp;you should also recheck your sine table calculations to see whether any significant arithmetic&amp;nbsp;errors have crept in.&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jul 2011 17:42:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/PWM-on-MC68H908JB/m-p/217284#M8599</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2011-07-01T17:42:51Z</dc:date>
    </item>
  </channel>
</rss>

