• slider image 442
  • slider image 497
  • slider image 498
  • slider image 499
  • slider image 500
  • slider image 502
:::


Browsing this Thread:   1 Anonymous Users






Re: 再請教中斷的問題,關於中斷優先權
#4
版主
版主


查看用戶資訊
有關中斷 context saving 的動作可以參考 Microchip MPASM 所提供的 Template "C:\Program Files\Microchip\MPASM Suite\Template\Code"
高優先全會使用到 Shadow Register 故可以直接使用 RETFIE FAST做快速返回,而低優先瓊中斷就需自行處理Context。

;******************************************************************************
;
High priority interrupt vector
This code will start executing when a high priority interrupt occurs or
when any interrupt occurs if interrupt priorities are not enabled.

        
ORG    0x0008

        bra    HighInt        
;go to high priority interrupt routine

;******************************************************************************
;
Low priority interrupt vector and routine
This code will start executing when a low priority interrupt occurs.
This code can be removed if low priority interrupts are not used.

        
ORG    0x0018

        movff    STATUS
,STATUS_TEMP    ;save STATUS register
        movff    WREG
,WREG_TEMP        ;save working register
        movff    BSR
,BSR_TEMP        ;save BSR register

;    *** low priority interrupt code goes here ***


        
movff    BSR_TEMP,BSR        ;restore BSR register
        movff    WREG_TEMP
,WREG        ;restore working register
        movff    STATUS_TEMP
,STATUS    ;restore STATUS register
        retfie

;******************************************************************************
;
High priority interrupt routine
The high priority interrupt code is placed here to avoid conflicting with
the low priority interrupt vector.

HighInt:

;    *** 
high priority interrupt code goes here ***


        
retfie    FAST


發表於: 2008/1/23 12:44
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 再請教中斷的問題,關於中斷優先權
#3
高級會員
高級會員


查看用戶資訊
兩層中斷的使用尚須留意低優先權中斷處理時,有可能被高優先權中斷程式中斷,故須留意中斷程式中所呼叫的副程式及參數是否相沖。
另也要考慮stack overflow的問題。FYR

發表於: 2008/1/23 11:43
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 再請教中斷的問題,關於中斷優先權
#2
新會員
新會員


查看用戶資訊
剛剛問到答案,自問自答一下,

一個位置只能設一個中斷的程式,

所以我問的問題要修改成

org 0x0008
bra TIME_int

org 0x0018
bra ALL

才是正確可行的!

然後把CAN的接收中斷和ADC接收中斷

打開並設為低優先權

這樣只要其中一個中斷被觸發

就會進到ALL這個程式中

進到ALL之後再去判斷說是哪個中斷被觸發

然後再對應要作的動作即可

就是這樣







發表於: 2008/1/22 16:31
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


再請教中斷的問題,關於中斷優先權
#1
新會員
新會員


查看用戶資訊
不好意思,我又來問問題了!!

請問一下當我在寫中斷向量的時候

如果在0x0018h中設置兩組中斷向量不知道行不行??

EX:

org 0x0008
bra TIME_int

org 0x0018
bra CAN_int

org 0x0018
bra ADC_int

又,如果可以的話,那處理的順序是如何?

是看誰的中斷條件先發生還是其他??




以上 非常感謝


發表於: 2008/1/22 15:59
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

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... ]

教育訓練中心

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