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


Browsing this Thread:   1 Anonymous Users




« 1 (2)


CCP中斷有捕獲成功,但無進入中斷程式,煩請各位先進幫忙
#1
初級會員
初級會員


查看用戶資訊
各位大大我程式如下,使用PIC16F883及ICD2做設計,我遇到問題是在CCP2執行捕捉動作成功後(PIR2,CCP2IF有置1),但我沒看到程式有跳到INT那段程式去動作(DEBUG模式),請問各位先進對此問題,有何見解,煩請不吝指教,謝謝!!



ORG 0x0000
GOTO MAIN

ORG 0x0004
GOTO INT


MAIN:
BANKSEL PORTA ;
CLRF PORTA ;Init PORTA
CLRF PORTB ;Init PORTB
CLRF PORTC ;Init PORTC
CLRF PIR1 ;Init PIR1
CLRF PIR2 ;Init PIR2
MOVLW B'11010000' ;
MOVWF INTCON ;Set INTCON
MOVLW B'10000001' ;
MOVWF T1CON ;Set T1CON
MOVLW B'00000101' ;
MOVWF CCP2CON ;Set CCP2CON

BANKSEL TRISA ;
MOVLW B'11001101' ;
MOVWF TRISA ;Set PORTA is input or output
MOVLW B'11111011' ;
MOVWF TRISB ;Set PORTB is input or output
MOVLW B'10100110' ;
MOVWF TRISC ;Set PORTC is input or output
BSF TRISE,3 ;Set RE3 to input
CLRF PIE1 ;Init PIE1
MOVLW B'00000001' ;
MOVWF PIE2 ;EEIE turn on $ CCP2IE turn on

;***********INT**************************************************************
INT:
MOVWF W_TEMP ;Copy W to TEMP register
SWAPF STATUS,W ;Swap status to be saved into W
;Swaps are used because they do not affect the status bits
MOVWF STATUS_TEMP ;Save status to bank zero STATUS_TEMP register
BTFSS HALL2 ;Is int_CW?
GOTO $+2 ;
CALL INT_CW ;
BTFSC HALL2 ;Is int_CCW?
GOTO $+2 ;
CALL INT_CCW ;
SWAPF STATUS_TEMP,W ;Swap STATUS_TEMP register into W
;(sets bank to original state)
MOVWF STATUS ;Move W into STATUS register
SWAPF W_TEMP,F ;Swap W_TEMP
SWAPF W_TEMP,W ;Swap W_TEMP into W
BCF PIR2,CCP2IF
RETFIE
;***********Motor is CW and CNT will -1***************************************
INT_CW:
DECF MT_POS_LO,1 ;
BTFSS STATUS,C ;
GOTO $+2 ;
DECF MT_POS_HI,1 ;
RETURN
;***********Motor is CCW and CNT will +1**************************************
INT_CCW:
INCF MT_POS_LO,1 ;
BTFSS STATUS,C ;
GOTO $+2 ;
INCF MT_POS_HI,1 ;
RETURN

發表於: 2009/6/9 16:58
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... ]

教育訓練中心

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