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


Browsing this Thread:   1 Anonymous Users






Re: 為何PIC18只會進高優先權中斷
#8
中級會員
中級會員


查看用戶資訊
謝謝!謝謝!
原來IPEN disable都是跳到0x008
小弟的疏忽

發表於: 2006/6/13 11:38
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 為何PIC18只會進高優先權中斷
#7
版主
版主


查看用戶資訊
PICSTART,

你可能會錯意了,IPEN 是控制要不要啟動 高、低優先權中斷功能, Disable IPEN (IPEN=0) 則永遠會從0x0008 點進入中斷,將IPEN=1後再設定TMR3IP=0 這樣就會進入0x0018的位址了,所以程式必須改為:

BSF RCON,IPEN ; Enable Interrupt priority levels
BCF IPR2,TMR3IP ; Timer3 to the Low priority

發表於: 2006/6/13 10:34
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 為何PIC18只會進高優先權中斷
#6
中級會員
中級會員


查看用戶資訊
天阿!各位大大都誤會了。
我是要讓TMR中斷進入低優先權中斷阿。

我的程式明明做了
BCF RCON,IPEN ; Disable priority levels on interrupts
BCF IPR2,TMR3IP ; Low priority
這兩行不就已經將高低優先權DISABLE了嗎,為何還能跳進0x008高優先權中斷服務程式呢?

發表於: 2006/6/13 10:25
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 為何PIC18只會進高優先權中斷
#5
高級會員
高級會員


查看用戶資訊
大哥 要BSF...............

發表於: 2006/6/12 17:53
微電腦自動控制設計,產品製造
才疏學淺,若有錯誤敬請指正
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 為何PIC18只會進高優先權中斷
#4
中級會員
中級會員


查看用戶資訊
問題就是在於程式裡已經
BCF RCON,IPEN
BCF IPR2,TMR3IP
當TMR0 或是 TMR3發生中斷時,都是去執行高優先權的中斷服務程式,都不會執行低優先權中斷服務程式。

發表於: 2006/6/12 16:46
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 為何PIC18只會進高優先權中斷
#3
版主
版主


查看用戶資訊
TMRxIP 也要設為1後才會有高優先權的設定,TMRxIP=0 則設為 Low Priority Interrupt。
bsf        RCON,IPEN        Enable Interrupt priority
            bsf        INTCON
,GIEH        Enable all High Priority Interrupt

這兩行也不可以忘記。

有關高、低優先權中斷設定請參考 W400 workshop 教材裡的練習二。

發表於: 2006/6/12 16:14
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 為何PIC18只會進高優先權中斷
#2
高級會員
高級會員


查看用戶資訊
RCON,7 IPEN
要設1,才有PRIORITY

發表於: 2006/6/12 15:58
微電腦自動控制設計,產品製造
才疏學淺,若有錯誤敬請指正
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


為何PIC18只會進高優先權中斷
#1
中級會員
中級會員


查看用戶資訊
我寫了個測試程式,用TMR0 & TMR3中斷,
明明IPEN & TMR3IP都clear了,為何還是進到高優先權中斷。
要如何才可進低優先中斷呢?
我用MPLAB IDE v7.40。

LIST P=18F1320
#include <P18F1320.INC>

CBLOCK 0x080
WREG_TEMP
STATUS_TEMP
BSR_TEMP
ENDC

CBLOCK 0x000
EXAMPLE
ENDC

ORG 0x0000
goto Main

ORG 0x0008
bra HighInt

ORG 0x0018
movff STATUS,STATUS_TEMP
movff WREG,WREG_TEMP
movff BSR,BSR_TEMP

BCF PIR2,TMR3IF
BCF INTCON,TMR0IF

movff BSR_TEMP,BSR
movff WREG_TEMP,WREG
movff STATUS_TEMP,STATUS
retfie

HighInt:
BCF PIR2,TMR3IF
BCF INTCON,TMR0IF
retfie FAST

Main:
BCF RCON,IPEN
;SET TMR3
CLRF TMR3L
CLRF TMR3H
MOVLW 0XB0
MOVWF T3CON
;BSF IPR2,TMR3IP
BCF IPR2,TMR3IP
BSF PIE2,TMR3IE
BCF PIR2,TMR3IF
;SET TMR0
MOVLW 0XC1
MOVWF T0CON
BSF INTCON,TMR0IE

BSF INTCON,PEIE
BSF INTCON,GIE
BSF T3CON,TMR3ON
MOVF TMR0L,W
MOVF TMR3L,W
GOTO $-4
END

發表於: 2006/6/12 15:37
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... ]

教育訓練中心

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