• 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






Re: 請問各位這程式如何中斷
#4
新會員
新會員


查看用戶資訊
版主及各位謝謝,有問題我在p文章上去

發表於: 2005/6/9 23:48
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問各位這程式如何中斷
#3
版主
版主


查看用戶資訊
程式的邏輯真的很亂,怎麼在中斷裡又跟主程式糾纏不清,中斷裡也沒用 RETFIE 回去。

修改一下程式如下:
RR:
        
RRF     PORTD,F
        CALL    DELAY
        BTFSS   PORTD
,0
        
GOTO    RR
        
GOTO    RL
;
MAIN:
        
BSF     STATUS,RP0
        MOVLW   0x00
        MOVWF   TRISD
        BCF     STATUS
,RP0        
        MOVLW   
B'10011000'
        
MOVWF   INTCON
        MOVLW    0X00
        MOVWF    PORTD
        BSF     STATUS
,C
        
goto     $

RL:
        
RLF     PORTD,F
        CALL    DELAY
        BTFSS   PORTD
,7
        
GOTO    RL
        RETFIE


你的功能是不是按鍵從PORTB產生中斷,PORTD的LED自動亮一圈

發表於: 2005/6/9 16:21
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問各位這程式如何中斷
#2
高級會員
高級會員


查看用戶資訊
你的程式到底會什麼問題實在是無法預測 , 因為你進到INTERRUPT之後並沒有RETFIE , 進入中斷後MCU會自動關掉GIE , 而且佔用堆疊 , 然後你又有機會手動打開GIE , 從此陷入萬劫不復的下場 , 真的不知道讓怎麼說才好 ,

發表於: 2005/6/9 13:20
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


請問各位這程式如何中斷
#1
新會員
新會員


查看用戶資訊
LIST  P=16F877
        
#INCLUDE <P16F877.inc>
DELAY1  EQU   0x20
DELAY2  EQU   0x21
           ORG   0x00
        NOP
        
GOTO  MAIN
        ORG      04H
        BCF      INTCON
,RBIF
        BCF      INTCON
,INTF
        MOVLW    0X00
        MOVWF    PORTD
        BSF      STATUS
,C
RR
:
        
RRF     PORTD,F
        CALL    DELAY
        BTFSS   PORTD
,0
        
GOTO    RR
        
GOTO    RL
MAIN
:
        
BSF     STATUS,RP0
        MOVLW   0x00
        MOVWF   TRISD
        BCF     STATUS
,RP0        
        MOVLW   
B'10011000'
        
MOVWF   INTCON
        MOVLW    0X00
        MOVWF    PORTD
        BSF     STATUS
,C
RL
:
        
RLF     PORTD,F
        CALL    DELAY
        BTFSS   PORTD
,7
        
GOTO    RL
        
GOTO    MAIN

DELAY
:
        
MOVLW   0xFF
        MOVWF   DELAY1
        MOVWF   DELAY2
DELAY0
:
        
DECFSZ  DELAY1,F
        
GOTO    DELAY0
        DECFSZ  DELAY2
,F
        
GOTO    DELAY0
        
RETURN
        
END


發表於: 2005/6/8 23:33
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... ]

教育訓練中心

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