AnsweredAssumed Answered

How to light a LED through INTC module in MPC5604P

Question asked by Zhou tianyuan on Jul 19, 2015
Latest reply on Jul 21, 2015 by Lukas Zadrapa

Hi,friends!

   I've watched the  example code ,and the main function as follows:

void main (void)

{

    vuint32_t i = 0;    /* Dummy idle counter */

 

 

  initModesAndClock();  /* MPC56xxP/B/S: Initialize mode entries, set sysclk = 64 MHz*/

  disableWatchdog();    /* Disable watchdog */

  initIrqVectors();/* Initialize exceptions: only need to load IVPR */
  initINTC();/* Initialize INTC for software vector mode */
  initPIT();  /* Initialize PIT1 for 1KHz IRQ, priority 2 */
  initSwIrq4();/* Initialize software interrupt 4 */
  enableIrq();  /* Ensure INTC current prority=0 & enable IRQ */

 

  while (1)

  {

i++;
  }

}

void Pit1ISR(void) {

  Pit1Ctr++;                  /* Increment interrupt counter */

  if ((Pit1Ctr & 1)==0) {     /* If PIT1Ctr is even*/

    INTC.SSCIR[4].R = 2;      /*  then nvoke software interrupt 4 */

 

  }

  PIT.CH[1].TFLG.B.TIF = 1;   /* CLear PIT 1 flag by writing 1 */

}

 

 

void SwIrq4ISR(void) {

  SWirq4Ctr++;  /* Increment interrupt counter */

  INTC.SSCIR[4].R = 1;  /* Clear channel's flag */

}

 

So,I want to know when does MPC5604P enter the function Pit1ISR and SwIrq4ISR ? If I want to light a led when an interrupy happens,where should I add code "SIU.GPDO[52].B.PDO = 0"?

Outcomes