Return from ISR (PIT)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Return from ISR (PIT)

Jump to solution
831 Views
juanignaciotroi
Contributor III

Hello. I am giving my first steps on the KE02 and I have a problem. I have set up the PIT correctly using the processor expert. However, I cant get out de ISR. Once it finishes, it starts again. What should I do once mi ISR has finished to return to the main program? Thanks, Juan Ignacio Troisi

Tags (4)
1 Solution
618 Views
adriancano
NXP Employee
NXP Employee

Hi,

I assume you are using the Init_PIT component and you are writing your own ISR code and not using the one generated by processor expert. Which component you are using?

It is probably that you are not clearing the interrupt flag. Try the next:

void PIT0_Isr( void )

{

    if( PIT_TFLG0 )

    {

        /* clear timer interrupt flag by writing 1*/

        PIT_TFLG0 = 0x01;  

}


Hope this information can help you

Best Regards,
Adrian Sanchez Cano
Technical Support Engineer
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

5 Replies
618 Views
juanignaciotroi
Contributor III

Hello. A new problem come up now I tryied to create de whole interrupt. The following error come up: 'conflicting types for 'isr_display' '. Is there a library which i shlould have included before of something related with the isr? Thanks

void isr_display(unsigned int DISPC){
DISPC++;
if( DISPC == 5) DISPC = 0;
int i;
unsigned char byte; //variable auxiliar para hacer mascara con el numero binario
for(i=0;i<8;i++){
unsigned char bit = byte & 1;   //hacemos mascara con 00000001b
byte = byte >> 1; // rotamos el byte para hacer lo mismo el proximo ciclo
if (bit == 0) Red_SetVal();
else Red_ClrVal ();//sacamos el bit como corresponda por el pin
}

            if( PIT_TFLG0 )    /* clear timer interrupt flag by writing 1*/

  PIT_TFLG0 = 0x01;
                    }
0 Kudos
618 Views
ndavies
Contributor V

If Isr_display() is an interrupt service routine, you cannot pass in the DISPC variable. The ISR must be declared as void Isr_Display(). The ISR cannot be declared as void Isr_Display(unsigned int DISPC). DISPC must be declared as global to do what you want to do.

try this instead:

unsigned int DISPC = 0; // Make  DISPC global

void isr_display()

{

     DISPC++;

          .......// insert the rest of the routine.

}

Norm

0 Kudos
618 Views
adriancano
NXP Employee
NXP Employee

Hi,

Are you using the Init_PIT component?

Regards,

Adrian

0 Kudos
618 Views
mjbcswitzerland
Specialist V

Hi Juan

Make sure that the PIT interrupt flag is reset by writing it with '1' to clear. Eg.

PIT_TFLG0 = PIT_TFLG_TIF;

Regards

Mark

Kinetis: µTasker Kinetis support

KE: µTasker FRDM-KE02Z support / µTasker FRDM-KE02Z40M support / µTasker FRDM-KE06Z support

For the complete "out-of-the-box" Kinetis experience and faster time to market

619 Views
adriancano
NXP Employee
NXP Employee

Hi,

I assume you are using the Init_PIT component and you are writing your own ISR code and not using the one generated by processor expert. Which component you are using?

It is probably that you are not clearing the interrupt flag. Try the next:

void PIT0_Isr( void )

{

    if( PIT_TFLG0 )

    {

        /* clear timer interrupt flag by writing 1*/

        PIT_TFLG0 = 0x01;  

}


Hope this information can help you

Best Regards,
Adrian Sanchez Cano
Technical Support Engineer
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------