two TMRs and two TMR interrupt configuration

cancel
Showing results for 
Search instead for 
Did you mean: 

two TMRs and two TMR interrupt configuration

Jump to solution
1,021 Views
terrybogard
Contributor II

Dear NXP expert,

I set TMR1 20kHz and enable the TMR1 interrupt, and TMR1 2kHz and enable the TMR2 interrupt. Both TMR1 and TMR2 interrupt, the ADC will be triggered, at the end of ADC sample, ADC ISR will run. is it OK about this configuration?

0 Kudos
1 Solution
1,014 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I suppose that your scheme is okay, but you have to add the #pragma interrupt on at the beginning of the ISR, and #pragma interrupt off at the end of ISR for each ISR function.

Hope it can help you

#pragma interrupt on
void MC56F827xx_ISR_SCI1_Transmitter(void)
{
if(QSCI1_STAT&0x8000)
{
QSCI1_DATA='C';
}
}

#pragma interrupt off

 

View solution in original post

0 Kudos
6 Replies
583 Views
cotaxak207
Contributor I

Sonic Allergen Menu – This information doesn’t identify all food ingredients. It may use generalized terms that may not sufficiently inform a person of all food items that may produce an allergic reaction in some people.

0 Kudos
1,015 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I suppose that your scheme is okay, but you have to add the #pragma interrupt on at the beginning of the ISR, and #pragma interrupt off at the end of ISR for each ISR function.

Hope it can help you

#pragma interrupt on
void MC56F827xx_ISR_SCI1_Transmitter(void)
{
if(QSCI1_STAT&0x8000)
{
QSCI1_DATA='C';
}
}

#pragma interrupt off

 

0 Kudos
1,011 Views
terrybogard
Contributor II

xiangjun,

#pragma is necessary? and what's the reason about that? thanks.

0 Kudos
1,006 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Terry,

using "#pragma interrupt on" tells the compiler to generate "rti" rather than "rts"  at the end of function code. The "rti" is return from ISR. The  "rts" is return from general api function.

Hope it can help you

BR

XiangJun Rong

0 Kudos
852 Views
terrybogard
Contributor II

Hi xiangjun,

if ISR return RTS, what will happen? MCU will do what difference about RTI and RTS?

Thanks

0 Kudos
831 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

As you know that the ISR uses rti, general subroutine uses rts. The RTI will pop both PC and SR(status register), but the RTS just will pop PC automatically.

When the DSC enters ISR, it push both PC and SR automatically, so when exits ISR, it must pop both PC and SR using rti.

 

Hope it can help you

BR

XiangJun Rong

 

0 Kudos