• 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: 有關外部中斷問題?
#2
初級會員
初級會員


查看用戶資訊
進入中斷之後..PORTC都是HIGH啊..離開之後也沒有清除..再怎麼左移右移..其他RC0~RC7都是HIGH啊..

發表於: 2005/9/5 11:30
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


有關外部中斷問題?
#1
高級會員
高級會員


查看用戶資訊
麻煩哪位大大能幫我看一下程式...
我這個程式是個簡單的跑馬燈程式!
LED由左向右亮,再由右亮回來...
以RB0當外部中斷觸發接腳...
當發生中斷時LED全亮!
我現在的情形是...
跑馬燈OK!
發生中斷LED也全亮!
問題是發生中斷後怎LED就一直亮著?!
沒恢復跑馬燈型態!
不曉得我少考慮了什麼事情?!
還是哪邊程式有錯?!
麻煩哪位好心的大大能花些時間幫我看一下程式...
感激不盡...謝謝!
我的程式如下...
list     P=18F252
#include    <P18F252.INC>
num    equ    0x80
num1    equ    0x81
W_temp    equ    0x82
S_temp    equ    0x83
B_temp    equ    0x84
    org    0x00
    nop
    
goto    Initial
    org    0x08
    
goto    ISR
;************ 初始化 ****************;
Initial:
    
banksel    TRISC
    clrf    TRISC
,0
    movlw    
B'00000001'
    
movwf    LATC,0    
    bcf    INTCON2
,INTEDG0,0    
    bsf    INTCON
,INT0IE,0
           bsf    RCON
,IPEN,0            
           bsf    INTCON
,GIE,0    
;*********** LED左移程式 *************;
Left:
    
call    Delay
    rlncf    LATC
,f,0
    btfss    PORTC
,7,0    
    
goto    Left
           
goto    Right            
;********** LED右移程式 *************;
Right:
    
call    Delay
    rrncf    LATC
,f,0
    btfss    PORTC
,0,0
           
goto    Right
           
goto    Left            
;************ 延遲時間 *************;
Delay:
    
banksel    num
    movlw    .100
    movwf    num
,1
delay_loop    
    nop
    call    Delay1
    decfsz    num
,1,1
    
goto    delay_loop
    
return
;*****************;
Delay1:
    
banksel    num1
    movlw    .250
    movwf    num1
delay1_loop
    nop
    decfsz    num1
,1,1
    
goto    delay1_loop
    
return
;*********** 
中斷程式 **************;
ISR:
    
movwf    W_temp,0
          movff    STATUS
,S_temp
          movff    BSR
,B_temp
          movlw    
B'11111111'
          
movwf    PORTC
          call    Delay
          bcf    INTCON
,INT0IF,0
          movff    S_temp
,STATUS
          movff    B_temp
,BSR
          swapf    W_temp
,f
          swapf    W_temp
,w
          retfie
          end

發表於: 2005/9/3 18:11
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... ]

教育訓練中心

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