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

論壇索引


Board index » All Posts (cat520)




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


麻煩哪位大大能幫我看一下程式...
我這個程式是個簡單的跑馬燈程式!
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
頂部


Re: 請問個小問題...
#22
高級會員
高級會員


那我了解了~~~
感謝xfsmart和taiwanuser大大的回答...
謝謝!!

發表於: 2005/7/25 13:34
頂部


請問個小問題...
#23
高級會員
高級會員


ex:
movlw 0xff
movwf TXREG,0
請問此時從TX腳位傳出的資料為"字串型態"還是算"二進位形態"?
謝謝...

發表於: 2005/7/22 22:58
頂部


有點怪的問題?!
#24
高級會員
高級會員


請問各位大大一個怪問題....
For correct A/D conversions , the A/D conversion clock (TAD) must be selected to ensure a minimum TAD time of 1.6us .
請問"1.6us這個時間是如何訂出來ㄉ?!"
不知這個問題有答案ㄇ??

發表於: 2005/3/31 10:29
頂部


Re: 有將ADC-10bits改成8bits的方法ㄇ?
#25
高級會員
高級會員


感謝smtree大大的建議...
但我的需求為...
"以一個暫存器(8bit)的精度來表示出ADC轉換後的結果!!"
我想知道是否有這種方式的轉換?
如果有的話...
請問一下該如何使用組合語言寫此程式?!

發表於: 2005/3/23 17:22
頂部


有將ADC-10bits改成8bits的方法ㄇ?
#26
高級會員
高級會員


請問各位大大...如題!!
有將ADC轉換後10bits的結果...
改以轉換成8bits輸出的方法ㄇ??
(我所使用的晶片是...PIC18F252!!)
麻煩指導一下...謝謝!!

發表於: 2005/3/23 8:22
頂部


Re: 我真的搞不懂哪裡出錯?!
#27
高級會員
高級會員


謝謝mickeys_wu和版主的建議...
我將時間拉長後觀察LED情形...
果然可以看出LED移動的情形!!
謝謝...

發表於: 2005/3/17 9:40
頂部


我真的搞不懂哪裡出錯?!
#28
高級會員
高級會員


請問大大如題...
下面是我所做的"簡單測試程式-LED依序左移一位"
為何燒錄後的動作是....
PORTB接腳全微亮(約0.6V)...就一直給它亮著!..ˋˊ
沒其他的動作!
我實在不知道為什ㄇ?!
哪位大大幫我看一下...
先謝了!!!
list P=18F252
    
#include<P18F252.INC>
VAL    equ    .170
num    equ    0x80
;*******************
    
org    0x00
    nop
;*******************
Initial:
    
banksel    TRISB
    clrf    TRISB
,0
    movlw    
B'00000001'  ;最初LED位置
    movwf    LATB
,0
;*******************
start:
    
call    Delay
    rlncf    LATB
,f,0
    
goto    start
;*******************
Delay:
    
banksel    num
    movlw    VAL
    movwf    num
,1
Delay_loop    nop
    decfsz    num
,1,1
    
goto    Delay_loop
    
return
;********************
    
end

發表於: 2005/3/16 20:24
頂部


Re: PIC 接收資料
#29
高級會員
高級會員


請問Pull-Up電阻的用途?以及它的使用時機為何?

發表於: 2005/3/4 22:27
頂部


Re: 可喜可賀!Microchip Taiwan網站登錄會員突破1000人!有沒有人建議辦個什麼慶祝活動啊?
#30
高級會員
高級會員


有獎品好好喔!!!
不過重要的是...
大家能在這網站分享經驗和心得...
這比得到獎品更好!!

發表於: 2005/3/3 21:13
頂部



« 1 2 (3) 4 5 6 ... 10 »



:::

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... ]

教育訓練中心

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