• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
  • slider image 488
  • slider image 491
:::

論壇索引


Board index » All Posts (海蜇皮)




Re: MCC18中的中断返回 为什么用return而不用retfie
#1
新會員
新會員


多谢指点,看了资料确实如此
加了中断宣告指令,编译后为retfie返回

我原来的程序中用到了串口,A/D,timer2三个中断,主程序中只有几个nop指令。运行以后,程序并没有飞掉,是偶然看反编译指令才发现的

發表於: 2007/3/19 18:15
頂部


MCC18中的中断返回 为什么用return而不用retfie
#2
新會員
新會員


用MCC18 调试PIC18F452时,发现资料中中断的格式一般如下
/****************************************/
void interrupt_at_low_vector(void)
{ _asm GOTO Interrupt_test _endasm

}
/****************************************/
void Interrupt_test(void)
{
if(PIR1bits.RCIF)
_asm goto Usart_int _endasm
if(PIR1bits.TMR2IF==1)
_asm GOTO Timer2_int _endasm
if(PIR1bits.ADIF==1)
_asm GOTO Ad_int _endasm
}
/***************************************/
void main(void)
{
..
}

void Usart_int(void)
{
}
void Timer2_int(void)
{
}
void Ad_int(void)
{
}

有两点不太明白
1。为什么中断要用goto 语句跳转到中断程序,用子程序调用不可行吗?
2。 既然用goto 语句,为什么在编译后的汇编语句中,中断返回时不是用retfie返回,而是采用 return 子程序返回语句呢


發表於: 2007/3/19 14:35
頂部






:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------