Browsing this Thread:
1 Anonymous Users
|
請教中斷問題.....
|
|
中級會員
Joined
: 2004/10/19 11:53 最後登入時間
: 2006/7/5 15:13
Group:
註冊會員
Level : 5 HP : 0 / 122 MP : 16 / 7011 EXP : 90
|
大家好 這是我寫的一個中斷程式 問題出在我使用單步執行 程式並不會跑到中斷向量的位址 請各位幫幫忙 我在想是不是我的中斷旗標沒設定好 以下是我PIC 與TIMER1得初始值設定 當打開 bsf T1CON,TMR1ON 程式不是應該會跑到0x004的位址 但是我的程式只會回到當初呼叫Timer1的位址 請各位幫幫忙 謝謝
initial banksel TRISB clrf TRISB ;定義PORTB為輸出阜 clrf TMR1H ;將Timer1內容清為零 clrf TMR1L clrf INTCON ;將INTCON內容清為零 bcf INTCON,PEIE ;將周邊功能的中斷致能 bcf INTCON,GIE banksel TMR1L clrf TMR1L movlw 0x3C movwf TMR1H movlw 0xB0 movwf TMR1L return ;------------------------------------------------------------------------------------------------- Timer1 banksel T1CON clrf T1CON ;設定Timer1時脈為Fosc/4 bsf INTCON,GIE bsf INTCON,PEIE banksel PIR1 ;選擇PIR1放置的Bank bcf PIR1,TMR1IF;將Timer1的致能旗標清除 banksel PIE1 clrf PIE1 ;將PIE1內容清為零 bsf PIE1,TMR1IE ;將Timer1溢位中斷致能 movlw Numcount1s movwf Reg_count_1s movlw Num1mCount movwf Reg_count_1m clrf TMR1L;把Timer1L清為零,防止進位 movlw 0x3C movwf TMR1H movlw 0xB0 movwf TMR1L bsf T1CON,TMR1ON return
發表於: 2005/9/26 17:56
|
|
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.