two TMRs and two TMR interrupt configuration

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

two TMRs and two TMR interrupt configuration

跳至解决方案
2,654 次查看
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 项奖励
回复
1 解答
2,647 次查看
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 项奖励
回复
6 回复数
2,216 次查看
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 项奖励
回复
2,648 次查看
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 项奖励
回复
2,644 次查看
terrybogard
Contributor II

xiangjun,

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

0 项奖励
回复
2,639 次查看
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 项奖励
回复
2,485 次查看
terrybogard
Contributor II

Hi xiangjun,

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

Thanks

0 项奖励
回复
2,464 次查看
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 项奖励
回复