Re: 為何PIC18只會進高優先權中斷
|
||||
---|---|---|---|---|
中級會員
|
謝謝!謝謝!
原來IPEN disable都是跳到0x008 小弟的疏忽
發表於: 2006/6/13 11:38
|
|||
|
Re: 為何PIC18只會進高優先權中斷
|
||||
---|---|---|---|---|
中級會員
|
天阿!各位大大都誤會了。
我是要讓TMR中斷進入低優先權中斷阿。 我的程式明明做了 BCF RCON,IPEN ; Disable priority levels on interrupts BCF IPR2,TMR3IP ; Low priority 這兩行不就已經將高低優先權DISABLE了嗎,為何還能跳進0x008高優先權中斷服務程式呢?
發表於: 2006/6/13 10:25
|
|||
|
Re: 為何PIC18只會進高優先權中斷
|
||||
---|---|---|---|---|
高級會員
|
大哥 要BSF...............
發表於: 2006/6/12 17:53
|
|||
微電腦自動控制設計,產品製造
才疏學淺,若有錯誤敬請指正 |
||||
|
Re: 為何PIC18只會進高優先權中斷
|
||||
---|---|---|---|---|
中級會員
|
問題就是在於程式裡已經
BCF RCON,IPEN BCF IPR2,TMR3IP 當TMR0 或是 TMR3發生中斷時,都是去執行高優先權的中斷服務程式,都不會執行低優先權中斷服務程式。
發表於: 2006/6/12 16:46
|
|||
|
Re: 為何PIC18只會進高優先權中斷
|
||||
---|---|---|---|---|
版主
|
TMRxIP 也要設為1後才會有高優先權的設定,TMRxIP=0 則設為 Low Priority Interrupt。
bsf RCON,IPEN ; Enable Interrupt priority
這兩行也不可以忘記。 有關高、低優先權中斷設定請參考 W400 workshop 教材裡的練習二。
發表於: 2006/6/12 16:14
|
|||
|
Re: 為何PIC18只會進高優先權中斷
|
||||
---|---|---|---|---|
高級會員
|
RCON,7 IPEN
要設1,才有PRIORITY
發表於: 2006/6/12 15:58
|
|||
微電腦自動控制設計,產品製造
才疏學淺,若有錯誤敬請指正 |
||||
|
為何PIC18只會進高優先權中斷
|
||||
---|---|---|---|---|
中級會員
|
我寫了個測試程式,用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
|
|||
|