• slider image 514
  • slider image 516
  • slider image 517
  • slider image 518
  • slider image 519
:::


Browsing this Thread:   3 Anonymous Users






Re: timer2中斷後 會跳到哪 ?
#4
版主
版主


查看用戶資訊
如果你要參考 PIC16F877 的範例程式,右邊範例程式裡的第八項有盧春林老師縮寫的範例,也有很多中文書可以參考:

http://www.microchip.com.tw/example.htm

發表於: 2007/7/18 10:59
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: timer2中斷後 會跳到哪 ?
#3
資深會員
資深會員


查看用戶資訊
16f877的中斷向量位址在04H,另外中斷之後設定pr2,你確定一定會在bank1???

發表於: 2007/7/17 11:52
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: timer2中斷後 會跳到哪 ?
#2
版主
版主


查看用戶資訊
PIC18F 系列要能產生中斷,基本上有項暫存器位元須設定。
1. 高低優先權位元 TMR2IP
2. 中斷智能位元 TMR2IE
3. 中斷總控制位元 GITEH 或 GIEL

息細資料可參考W400 Workshop 教材說明

發表於: 2007/7/17 11:14
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


timer2中斷後 會跳到哪 ?
#1
新會員
新會員


查看用戶資訊
我要一組 pwm 在3.6.9.12.....cycle的週期(pr2)要改變 我在網路上找到PIC18F1220的範例程式 co他的一些程式 但我timer2中斷時 不會跳到中斷副程式isr裡 我哪裡搞錯了ㄇ

我的程式
LIST p=16F877
#INCLUDE<p16F877.INC>
ORG 00H
goto START

ORG 08
isr
MOVLW .74
MOVWF PR2
retfie 1


START: BSF STATUS,RP0 ;切換到BANK1
BCF TRISC,2 ;設定PORTC<2>為輸出接腳
BCF TRISC,3 ;設定PORTC<3>為輸出接腳
MOVLW .74
MOVWF PR2
BCF STATUS,RP0 ;切換到BANK0
MOVLW B'01000011'
MOVWF CCPR1L
MOVLW B'00000101' ;Timer2 ON
MOVWF T2CON
MOVLW B'00101100' ;PWM模式
MOVWF CCP1CON
WAIT: NOP
GOTO WAIT
END




PIC18F1220的範例程式
; port definitions
#define OUT PORTB,0 ; for demonstration only
;------------------------------------------------
ORG 0 ; reset vector
resetv
goto init
;------------------------------------------------
ORG 08 ; high priority interrupt vector
isr
bcf CCP1CON,DC1B1
bcf PIR1,TMR2IF
.
.
.
init
.
.
.
; set CCP module in PWM mode
movlw b'00001100'
movwf CCP1CON

; set the tmr2 to generate the desired frquency and 50% duty
movlw b'00000100' ; prescale 0, postscale 0, tmr2 ON
movwf T2CON
.
.
.
.
main
goto main
end

發表於: 2007/7/17 10:51
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... ]

教育訓練中心

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