<?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: TPM interrupts in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/TPM-interrupts/m-p/135484#M4041</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;my bad i did not look at your code, no time. please search for my postings a few months ago for details on how i did it.&lt;BR /&gt;&lt;BR /&gt;if the processor is in a sleep mode that disables the clock the TPI, dependant on the clock, will be down and so this int will not wake the processor. but i dont have details on how the tpi is failing. i am basically using the tpi pin as an extra external interrupt in the code below. look it over if you will and if you need more details do the search but here is some details:&lt;BR /&gt;&lt;BR /&gt;//in the begining of main.c&lt;BR /&gt;PTDD = 0x40; // pull port D pins low, except ptd6/tpm0input&lt;BR /&gt;PTDPE = 0xFF; // enable pullup's on all of portD&lt;BR /&gt;PTDDD = 0xBF; // All of Port D Data Direction set to OUTPUT 0xFF, except b6=input&lt;BR /&gt;DisableInterrupts;&lt;BR /&gt;//Timer Int Init mod timer interrupts, remove overflow, add outcput compare (1) and //input(0)&lt;BR /&gt;TPM1SC = 0x08; //setup common ch1&amp;amp;0 control reg, clr TPM1CNTx&lt;BR /&gt;//clock=bus, scale=1, pwm=off, overflow irq=off&lt;BR /&gt;TPM1C0SC=0x48; //set ch0 as input capture w/ irq&lt;BR /&gt;//irq=on, PTD6/TPM1CH0=in capture mode, +e&amp;amp;level.&lt;BR /&gt;TPM1C1SC=0x90; //set ch1 as output compare, irq=off,&lt;BR /&gt;//output compare=on, softwre compare=on.&lt;BR /&gt;TPM1C0SC = TPM1C0SC;//clr any pending input capture irq&lt;BR /&gt;TPM1C0SC &amp;amp;= 0x7F;&lt;BR /&gt;EnableInterrupts;&lt;BR /&gt;&lt;BR /&gt;//int service routine&lt;BR /&gt;interrupt 5 void TPM1OutputCompare_ISR (void){&lt;BR /&gt;TPM1C1SC = TPM1C1SC; //2part irq reset.&lt;BR /&gt;TPM1C1SC &amp;amp;= 0x7F;&lt;BR /&gt;if(!timercounter) timertimeout++; //report irq status to main emulation .&lt;BR /&gt;timercounter--;&lt;BR /&gt;} //interrupt 5 void Timer...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;//in my linker file *.prn&lt;BR /&gt;//*******************************&amp;gt;&amp;gt;&amp;gt; define unused interrupt vectors ****************************&lt;BR /&gt;//081906jmp, mod timer interrupts, remove overflow, add outcput compare (1) and input(0)&lt;BR /&gt;VECTOR 0 _Startup //reset vector: this is the default entry point for a C/C++ application&lt;BR /&gt;VECTOR 1 _Startup&lt;BR /&gt;//VECTOR 2 _Startup //used defined&lt;BR /&gt;VECTOR 3 _Startup&lt;BR /&gt;//VECTOR 4 _Startup //used defined&lt;BR /&gt;//VECTOR 5 _Startup //used defined&lt;BR /&gt;VECTOR 6 _Startup&lt;BR /&gt;VECTOR 7 _Startup&lt;BR /&gt;VECTOR 8 _Startup&lt;BR /&gt;VECTOR 9 _Startup&lt;BR /&gt;//VECTOR 10 _Startup //used defined&lt;BR /&gt;VECTOR 11 _Startup&lt;BR /&gt;//VECTOR 12 _Startup //used defined&lt;BR /&gt;VECTOR 13 _Startup&lt;BR /&gt;//VECTOR 14 _Startup //used defined&lt;BR /&gt;VECTOR 15 _Startup&lt;BR /&gt;//******************&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;i hope this gives you some thoughts onto your situation, good luck.&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Nov 2006 23:48:14 GMT</pubDate>
    <dc:creator>jah</dc:creator>
    <dc:date>2006-11-06T23:48:14Z</dc:date>
    <item>
      <title>TPM interrupts</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/TPM-interrupts/m-p/135483#M4040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;I am using MC9S08RD16. I want to use TPM interrupts. I was unable to get&amp;nbsp;them. I send my written code.&lt;/DIV&gt;&lt;DIV&gt;What is problem in my code?&lt;/DIV&gt;&lt;DIV&gt;thank you.&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;#include &amp;lt;hidef.h&amp;gt; /* for EnableInterrupts macro */&lt;BR /&gt;#include "derivative.h" /* include peripheral declarations */&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;#include "utility.h"&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;/*define value for led's when on and off*/&lt;BR /&gt;#define ON 0&lt;BR /&gt;#define OFF 1&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;/*define value for switches when up (not pressed) and down (pressed)*/&lt;BR /&gt;#define UP 1&lt;BR /&gt;#define DOWN 0&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;/*define led's*/&lt;BR /&gt;#define LED1 PTBD_PTBD0&lt;BR /&gt;#define LED2 PTBD_PTBD1&lt;BR /&gt;#define LED3 PTBD_PTBD2&lt;BR /&gt;#define LED4 PTCD_PTCD0&lt;BR /&gt;#define LED5 PTCD_PTCD1&lt;/DIV&gt;&lt;DIV&gt;#define PRESCALAR 7&lt;BR /&gt;#define MODULUS&amp;nbsp;&amp;nbsp; 32768&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;void main(void) {&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;EnableInterrupts; /* enable interrupts */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;/* include your code here */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;SOPT_COPE=0;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;//Port initial&lt;BR /&gt;&amp;nbsp;PTAPE=0xFF;&lt;BR /&gt;&amp;nbsp;PTBPE=0x00;&lt;BR /&gt;&amp;nbsp;PTCPE=0x00;&amp;nbsp;&amp;nbsp; //0b00000000;&lt;BR /&gt;&amp;nbsp;PTDPE=0x00;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;// Data Directions&lt;BR /&gt;&amp;nbsp;PTADD=0x00;&lt;BR /&gt;&amp;nbsp;PTBDD=0xff;&amp;nbsp;&amp;nbsp; // all output&lt;BR /&gt;&amp;nbsp;PTCDD=0xff;&lt;BR /&gt;&amp;nbsp;PTDDD=0xff;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;//Pullups on upper 4 bits&lt;BR /&gt;&amp;nbsp;PTAPE = 0xf0;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;// Led off&lt;BR /&gt;&amp;nbsp;LED1 = OFF;&lt;BR /&gt;&amp;nbsp;LED2 = OFF;&lt;BR /&gt;&amp;nbsp;LED3 = OFF;&lt;BR /&gt;&amp;nbsp;LED4 = OFF;&lt;BR /&gt;&amp;nbsp;LED5 = OFF;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;//Initialize timer TPM1 channel, assumes not touched since reset!&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;TPM1SC_PS&amp;nbsp;&amp;nbsp;&amp;nbsp; = PRESCALAR; //clock source divided by prescalar&lt;BR /&gt;&amp;nbsp;TPM1MOD&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = MODULUS;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;TPM1SC_TOIE&amp;nbsp; = 1;&lt;BR /&gt;&amp;nbsp;TPM1SC_TOF&amp;nbsp;&amp;nbsp; = 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;//TPM1C0SC_ELS0A = 1; //Select the output compare low&lt;BR /&gt;&amp;nbsp;//TPM1C0SC_MS0B&amp;nbsp; = 1; //MS0B=1, MS0A=0; &amp;lt;&amp;lt; for edge align PWM&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;TPM1SC_CLKSA = 1;//Select BUS clock&lt;BR /&gt;&amp;nbsp;TPM1SC_CLKSB = 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;while (1) {&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;__RESET_WATCHDOG();&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (TPM1SC_TOF) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;TPM1SC_TOF = 0;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;}&lt;/DIV&gt;&lt;DIV&gt;interrupt Vtpm1ovf void intSW1(){&lt;BR /&gt;&amp;nbsp;LED1 = ON;&lt;BR /&gt;}&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Nov 2006 21:44:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/TPM-interrupts/m-p/135483#M4040</guid>
      <dc:creator>e_ikom</dc:creator>
      <dc:date>2006-11-06T21:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: TPM interrupts</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/TPM-interrupts/m-p/135484#M4041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;my bad i did not look at your code, no time. please search for my postings a few months ago for details on how i did it.&lt;BR /&gt;&lt;BR /&gt;if the processor is in a sleep mode that disables the clock the TPI, dependant on the clock, will be down and so this int will not wake the processor. but i dont have details on how the tpi is failing. i am basically using the tpi pin as an extra external interrupt in the code below. look it over if you will and if you need more details do the search but here is some details:&lt;BR /&gt;&lt;BR /&gt;//in the begining of main.c&lt;BR /&gt;PTDD = 0x40; // pull port D pins low, except ptd6/tpm0input&lt;BR /&gt;PTDPE = 0xFF; // enable pullup's on all of portD&lt;BR /&gt;PTDDD = 0xBF; // All of Port D Data Direction set to OUTPUT 0xFF, except b6=input&lt;BR /&gt;DisableInterrupts;&lt;BR /&gt;//Timer Int Init mod timer interrupts, remove overflow, add outcput compare (1) and //input(0)&lt;BR /&gt;TPM1SC = 0x08; //setup common ch1&amp;amp;0 control reg, clr TPM1CNTx&lt;BR /&gt;//clock=bus, scale=1, pwm=off, overflow irq=off&lt;BR /&gt;TPM1C0SC=0x48; //set ch0 as input capture w/ irq&lt;BR /&gt;//irq=on, PTD6/TPM1CH0=in capture mode, +e&amp;amp;level.&lt;BR /&gt;TPM1C1SC=0x90; //set ch1 as output compare, irq=off,&lt;BR /&gt;//output compare=on, softwre compare=on.&lt;BR /&gt;TPM1C0SC = TPM1C0SC;//clr any pending input capture irq&lt;BR /&gt;TPM1C0SC &amp;amp;= 0x7F;&lt;BR /&gt;EnableInterrupts;&lt;BR /&gt;&lt;BR /&gt;//int service routine&lt;BR /&gt;interrupt 5 void TPM1OutputCompare_ISR (void){&lt;BR /&gt;TPM1C1SC = TPM1C1SC; //2part irq reset.&lt;BR /&gt;TPM1C1SC &amp;amp;= 0x7F;&lt;BR /&gt;if(!timercounter) timertimeout++; //report irq status to main emulation .&lt;BR /&gt;timercounter--;&lt;BR /&gt;} //interrupt 5 void Timer...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;//in my linker file *.prn&lt;BR /&gt;//*******************************&amp;gt;&amp;gt;&amp;gt; define unused interrupt vectors ****************************&lt;BR /&gt;//081906jmp, mod timer interrupts, remove overflow, add outcput compare (1) and input(0)&lt;BR /&gt;VECTOR 0 _Startup //reset vector: this is the default entry point for a C/C++ application&lt;BR /&gt;VECTOR 1 _Startup&lt;BR /&gt;//VECTOR 2 _Startup //used defined&lt;BR /&gt;VECTOR 3 _Startup&lt;BR /&gt;//VECTOR 4 _Startup //used defined&lt;BR /&gt;//VECTOR 5 _Startup //used defined&lt;BR /&gt;VECTOR 6 _Startup&lt;BR /&gt;VECTOR 7 _Startup&lt;BR /&gt;VECTOR 8 _Startup&lt;BR /&gt;VECTOR 9 _Startup&lt;BR /&gt;//VECTOR 10 _Startup //used defined&lt;BR /&gt;VECTOR 11 _Startup&lt;BR /&gt;//VECTOR 12 _Startup //used defined&lt;BR /&gt;VECTOR 13 _Startup&lt;BR /&gt;//VECTOR 14 _Startup //used defined&lt;BR /&gt;VECTOR 15 _Startup&lt;BR /&gt;//******************&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;i hope this gives you some thoughts onto your situation, good luck.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Nov 2006 23:48:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/TPM-interrupts/m-p/135484#M4041</guid>
      <dc:creator>jah</dc:creator>
      <dc:date>2006-11-06T23:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: TPM interrupts</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/TPM-interrupts/m-p/135485#M4042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;-You should clear the intterupt within the timer ISR, not from within your forever loop. See the code provided by JAH.&lt;BR /&gt;- if you want to see the LED blink change the code within your ISR to somethin like:&lt;BR /&gt;LED0 = ~LED0;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Nov 2006 22:40:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/TPM-interrupts/m-p/135485#M4042</guid>
      <dc:creator>Geezer</dc:creator>
      <dc:date>2006-11-09T22:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: TPM interrupts</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/TPM-interrupts/m-p/135486#M4043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;thank you for your help.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Nov 2006 14:51:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/TPM-interrupts/m-p/135486#M4043</guid>
      <dc:creator>e_ikom</dc:creator>
      <dc:date>2006-11-15T14:51:16Z</dc:date>
    </item>
  </channel>
</rss>

