gret
August 1st, 2005, 09:57 AM
hi i just start this in school no long ago hope someone can help me with this as my lecture was too confusing to understand.
well i need to write a assembly code for the pic 18f452 to do a input capture and get the result as this is only part of the whole program there maybe parts missing so please ignore those as i am only doing input capture anyway i have gotten most of the setting done as shown below. the only problem i am having now is how do i contiune???
list p=18f452, n=48, t=ON, st=OFF
#include "p18f452.inc"
;------------------INTERRUPT SERVICE
ROUTINE--------------------------------------------
org 0x000000 ; reset vector
bra start
org 0x000008 ; high priority interrupt vector
bra TMR1_ISR
;---------------------------------------------------------------------
Program1 CODE
start
bcf PORTB, RB0 ;off LED
bcf PIR2,TMR3IF ;tmr3 clear interrupt flag bit
bcf PIR2,CCP2IF ;clear tmr1 captureccp register capture
bsf PIE2,TMR3IE ;enable timer3
bsf PIE2,CCP2IE ;enable ccp2
bcf IPR2,TMR3IP ;set tmr3 priorty
bsf IPR2,CCP2IP ;set ccp2 prority
movlw b'01 10001' ;setting of t3con
movwf T3CON ;config the setting of t3con
movlw b'0100' ;
movwf CCP1CON,CCP2M#:CCP2M0 ;
movlw 0xAF
movwf TMR3H
movlw 0xAC
movwf TMR3L
i know i need a interrupt service but how do i write 1 and i know that i need something else but i cannot seems to remember what it is could someone fell me in on this?
Really hope someone can help with this thanks for the help in advance
well i need to write a assembly code for the pic 18f452 to do a input capture and get the result as this is only part of the whole program there maybe parts missing so please ignore those as i am only doing input capture anyway i have gotten most of the setting done as shown below. the only problem i am having now is how do i contiune???
list p=18f452, n=48, t=ON, st=OFF
#include "p18f452.inc"
;------------------INTERRUPT SERVICE
ROUTINE--------------------------------------------
org 0x000000 ; reset vector
bra start
org 0x000008 ; high priority interrupt vector
bra TMR1_ISR
;---------------------------------------------------------------------
Program1 CODE
start
bcf PORTB, RB0 ;off LED
bcf PIR2,TMR3IF ;tmr3 clear interrupt flag bit
bcf PIR2,CCP2IF ;clear tmr1 captureccp register capture
bsf PIE2,TMR3IE ;enable timer3
bsf PIE2,CCP2IE ;enable ccp2
bcf IPR2,TMR3IP ;set tmr3 priorty
bsf IPR2,CCP2IP ;set ccp2 prority
movlw b'01 10001' ;setting of t3con
movwf T3CON ;config the setting of t3con
movlw b'0100' ;
movwf CCP1CON,CCP2M#:CCP2M0 ;
movlw 0xAF
movwf TMR3H
movlw 0xAC
movwf TMR3L
i know i need a interrupt service but how do i write 1 and i know that i need something else but i cannot seems to remember what it is could someone fell me in on this?
Really hope someone can help with this thanks for the help in advance