<?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>S12 / MagniV Microcontrollers中的主题 S12ZVC timer Interrupt function</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12ZVC-timer-Interrupt-function/m-p/841649#M16014</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wrote the timer overflow interrupt function. It feels normal. But after debugging, I found that it can be used. Who can solve this problem?&lt;/P&gt;&lt;P&gt;&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;unsigned int m_sec=0,m=0;&lt;BR /&gt;interrupt 20 void TOI_ISR(void);&lt;/P&gt;&lt;P&gt;void main(void) {&lt;BR /&gt; &lt;BR /&gt; /********************************************/&lt;BR /&gt; /************ PLL INITIALIZATION ************/&lt;BR /&gt; /********************************************/&lt;BR /&gt; CPMUCLKS_PLLSEL = 1; //FBUS = FPLL/2. FBUS = 32MHz, &lt;BR /&gt; CPMUREFDIV_REFFRQ = 1; //Reference clock between 2MHZ and 6MHZ. &lt;BR /&gt; CPMUREFDIV_REFDIV = 0x1; //FREF=8/(1+1) = 4MHZ &lt;BR /&gt; CPMUSYNR_VCOFRQ = 0x1; //FVCO is between 48MHZ and 80MHZ &lt;BR /&gt; CPMUSYNR_SYNDIV = 0x7; //FVCO = 2xFREFx(SYNDIV+1) = FVCO = 2x4x(7+1) = 64MHZ&lt;BR /&gt; CPMUPOSTDIV_POSTDIV = 0x0; //FPLL = FVCO/(POSTDIV+1). FPLL = 64MHZ/(0+1) FPLL = 64MHz &lt;BR /&gt; CPMUOSC_OSCE = 1; //External oscillator enable. 8MHZ. FREF=FOSC/(REFDIV+1) &lt;BR /&gt; while(!CPMUIFLG_LOCK){} //Wait for LOCK. &lt;BR /&gt; CPMUIFLG = 0xFF; //clear CMPMU flags&lt;BR /&gt; &lt;BR /&gt; /********************************************/&lt;BR /&gt; /*********** GPIO INITIALIZATION ************/&lt;BR /&gt; /********************************************/&lt;BR /&gt; &lt;BR /&gt; //Use PP6 as output for LED&lt;BR /&gt; //DDRP_DDRP6 = 1;&lt;BR /&gt; DDRP_DDRP4 = 1;&lt;BR /&gt; /********************************************/&lt;BR /&gt; /************ TIM INITIALIZATION ************/&lt;BR /&gt; /********************************************/&lt;BR /&gt; &lt;BR /&gt; //1. Configure the prescaler (TSCR2[PR]).&lt;BR /&gt; TIM0TSCR2_PR = 0b111;&lt;BR /&gt; //TIM0TC0 = TIM0TCNT + 1000;&lt;BR /&gt; //2. Configure needed channels as Input Capture (TIOS[IOSx]=0) or Output Compare (TIOS[IOSx]=1).&lt;BR /&gt; TIM0TIOS = 0;&lt;BR /&gt; &lt;BR /&gt; //3. Enable interrupts if needed in the timer interrupt enable register (TIE).&lt;BR /&gt; TIM0TIE = 0;&lt;BR /&gt; &lt;BR /&gt; //4. Set the timer enable bit (TSCR1[TEN]).&lt;BR /&gt; TIM0TSCR1_TEN = 1;&lt;BR /&gt; //TIM0TIE_C0I = 1;&lt;BR /&gt; EnableInterrupts;&lt;BR /&gt; &lt;BR /&gt; /********************************************/&lt;BR /&gt; /************ LED BLINK LOOP ****************/&lt;BR /&gt; /********************************************/&lt;BR /&gt; for(;;){&lt;BR /&gt;;&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;interrupt 20 void TOI_ISR(void)// vector defined in the prm file&lt;BR /&gt;{ &lt;BR /&gt; m++;&lt;BR /&gt; if(m==500)&lt;BR /&gt; {&lt;BR /&gt; PTP_PTP4 ^= 1;&lt;BR /&gt; m=0;&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; TIM0TFLG2 = 0x80;&lt;BR /&gt; EnableInterrupts;&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Oct 2018 08:46:31 GMT</pubDate>
    <dc:creator>634216959</dc:creator>
    <dc:date>2018-10-10T08:46:31Z</dc:date>
    <item>
      <title>S12ZVC timer Interrupt function</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12ZVC-timer-Interrupt-function/m-p/841649#M16014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wrote the timer overflow interrupt function. It feels normal. But after debugging, I found that it can be used. Who can solve this problem?&lt;/P&gt;&lt;P&gt;&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;unsigned int m_sec=0,m=0;&lt;BR /&gt;interrupt 20 void TOI_ISR(void);&lt;/P&gt;&lt;P&gt;void main(void) {&lt;BR /&gt; &lt;BR /&gt; /********************************************/&lt;BR /&gt; /************ PLL INITIALIZATION ************/&lt;BR /&gt; /********************************************/&lt;BR /&gt; CPMUCLKS_PLLSEL = 1; //FBUS = FPLL/2. FBUS = 32MHz, &lt;BR /&gt; CPMUREFDIV_REFFRQ = 1; //Reference clock between 2MHZ and 6MHZ. &lt;BR /&gt; CPMUREFDIV_REFDIV = 0x1; //FREF=8/(1+1) = 4MHZ &lt;BR /&gt; CPMUSYNR_VCOFRQ = 0x1; //FVCO is between 48MHZ and 80MHZ &lt;BR /&gt; CPMUSYNR_SYNDIV = 0x7; //FVCO = 2xFREFx(SYNDIV+1) = FVCO = 2x4x(7+1) = 64MHZ&lt;BR /&gt; CPMUPOSTDIV_POSTDIV = 0x0; //FPLL = FVCO/(POSTDIV+1). FPLL = 64MHZ/(0+1) FPLL = 64MHz &lt;BR /&gt; CPMUOSC_OSCE = 1; //External oscillator enable. 8MHZ. FREF=FOSC/(REFDIV+1) &lt;BR /&gt; while(!CPMUIFLG_LOCK){} //Wait for LOCK. &lt;BR /&gt; CPMUIFLG = 0xFF; //clear CMPMU flags&lt;BR /&gt; &lt;BR /&gt; /********************************************/&lt;BR /&gt; /*********** GPIO INITIALIZATION ************/&lt;BR /&gt; /********************************************/&lt;BR /&gt; &lt;BR /&gt; //Use PP6 as output for LED&lt;BR /&gt; //DDRP_DDRP6 = 1;&lt;BR /&gt; DDRP_DDRP4 = 1;&lt;BR /&gt; /********************************************/&lt;BR /&gt; /************ TIM INITIALIZATION ************/&lt;BR /&gt; /********************************************/&lt;BR /&gt; &lt;BR /&gt; //1. Configure the prescaler (TSCR2[PR]).&lt;BR /&gt; TIM0TSCR2_PR = 0b111;&lt;BR /&gt; //TIM0TC0 = TIM0TCNT + 1000;&lt;BR /&gt; //2. Configure needed channels as Input Capture (TIOS[IOSx]=0) or Output Compare (TIOS[IOSx]=1).&lt;BR /&gt; TIM0TIOS = 0;&lt;BR /&gt; &lt;BR /&gt; //3. Enable interrupts if needed in the timer interrupt enable register (TIE).&lt;BR /&gt; TIM0TIE = 0;&lt;BR /&gt; &lt;BR /&gt; //4. Set the timer enable bit (TSCR1[TEN]).&lt;BR /&gt; TIM0TSCR1_TEN = 1;&lt;BR /&gt; //TIM0TIE_C0I = 1;&lt;BR /&gt; EnableInterrupts;&lt;BR /&gt; &lt;BR /&gt; /********************************************/&lt;BR /&gt; /************ LED BLINK LOOP ****************/&lt;BR /&gt; /********************************************/&lt;BR /&gt; for(;;){&lt;BR /&gt;;&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;interrupt 20 void TOI_ISR(void)// vector defined in the prm file&lt;BR /&gt;{ &lt;BR /&gt; m++;&lt;BR /&gt; if(m==500)&lt;BR /&gt; {&lt;BR /&gt; PTP_PTP4 ^= 1;&lt;BR /&gt; m=0;&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; TIM0TFLG2 = 0x80;&lt;BR /&gt; EnableInterrupts;&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2018 08:46:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12ZVC-timer-Interrupt-function/m-p/841649#M16014</guid>
      <dc:creator>634216959</dc:creator>
      <dc:date>2018-10-10T08:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: S12ZVC timer Interrupt function</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12ZVC-timer-Interrupt-function/m-p/841650#M16015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Why it can't be used?&lt;/P&gt;&lt;P&gt;What is the problem?&lt;/P&gt;&lt;P&gt;You can refer to the attached example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2018 10:36:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12ZVC-timer-Interrupt-function/m-p/841650#M16015</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2018-10-11T10:36:45Z</dc:date>
    </item>
  </channel>
</rss>

