hello everybody,
i'm loading the code here which gives me output as a 50hz pulse on each pin to which i'm giving high voltage first and on pin PORTC,5 it doesn't matter voltage is high or low a 50hz pulse is there.in same code i'm using timer3 for a phase shift of 120degree but while debugging its showing me that much delay in between req pins but in actual its not showing on CRO where i'm doing wrong
CODE:
#include "P18F458.inc"
TENMH equ D'16'
TENML equ D'243'
twoMH equ D'7'
twoML equ D'19'
oneMH equ D'4'
oneML equ D'7'
COUNT2 equ D'200'
red equ B'10100000'
red1 equ B'01000000'
F EQU 0x0001
VARIEBALS UDATA
COUNTH res 1
COUNTL res 1
COUNT1 RES 1
COUNT3 RES 1
;COUNT2 RES 1
COUNT4 RES 1
twoL res 1
twoH res 1
oneL res 1
oneH res 1
org 0x00000000
goto START
ORG 0X00000008
GOTO TMR3_ISR
org 0x000000ae
START
clrf PORTC
clrf PORTD
clrf LATD
clrf LATC
movlw 0x00
movwf TRISD
movwf TRISC
movlw 0x01
bsf RCON,IPEN ;enable priority interrupts.
; bSf IPR1,TMR1IP ;set Timer1 as a high priority interrupt source
bsf IPR2,TMR3IP ;set Timer3 as a low priority interrupt source
; bcf PIR1,TMR1IF ;clear the Timer1 interrupt flag
bcf PIR2,TMR3IF ;clear the Timer3 interrupt flag
; bsf PIE1,TMR1IE ;enable Timer1 interrupts
bsf PIE2,TMR3IE ;enable Timer3 interrupts
; BSF INTCON,TMR0IE
; BCF INTCON,TMR0IF
bsf INTCON,GIEH ;set the global interrupt enable bits
bsf INTCON,GIEL ; "
clrf T3CON
clrf TMR3H ;clear Timer1 high
clrf TMR3L ;clear Timer1 low
movlw 0xD0
movwf TMR3H
movlw 0x00
movwf TMR3L
bsf T3CON,TMR3ON ;turn on Timer3
MOVLW 0X01
MOVWF COUNT4
bsf LATD,7
bSf LATD,5
bSf LATD,6
bsf LATD,4
;
loop
goto loop
return
;************************************
;ISR ROUTINES
;************************************
TMR3_ISR
CPFSEQ COUNT4
LP1 goto lpl
LP2 ;RCALL DELAY1
BTG LATD,7
BTG LATD,6
INCF COUNT4
movlw 0x02
cpfseq COUNT4
lp0
goto lpl
lp00
bcf PIR2,TMR3IF ;Clear the Timer1 interrupt flag.
movlw D'200'
movwf COUNT2
lp000
movlw 0xED
movwf TMR3H
movlw 0xB0
movwf TMR3L
movlw 0x02
T1POLLl
btfss PIR2,TMR3IF ;Poll TMR11 interrupt flag to wait for another
; ; TMR1 overflow.
bra T1POLLl
bcf PIR2,TMR3IF ;Clear the Timer1 interrupt flag again.
decfsz COUNT2,1
goto lp000
CPFSEQ COUNT4
LPP1
goto lpl
LPP2
DECF COUNT4
; decf COUNT4
; decf COUNT4
GOTO LP3
LP3
BTG LATD,5
BTG LATD,4
movlw 0xD0
movwf TMR3H
movlw 0x00
movwf TMR3L
MOVLW 0X01
GOTO lpl
lpl
RETFIE
END
i'm loading the code here which gives me output as a 50hz pulse on each pin to which i'm giving high voltage first and on pin PORTC,5 it doesn't matter voltage is high or low a 50hz pulse is there.in same code i'm using timer3 for a phase shift of 120degree but while debugging its showing me that much delay in between req pins but in actual its not showing on CRO where i'm doing wrong
CODE:
#include "P18F458.inc"
TENMH equ D'16'
TENML equ D'243'
twoMH equ D'7'
twoML equ D'19'
oneMH equ D'4'
oneML equ D'7'
COUNT2 equ D'200'
red equ B'10100000'
red1 equ B'01000000'
F EQU 0x0001
VARIEBALS UDATA
COUNTH res 1
COUNTL res 1
COUNT1 RES 1
COUNT3 RES 1
;COUNT2 RES 1
COUNT4 RES 1
twoL res 1
twoH res 1
oneL res 1
oneH res 1
org 0x00000000
goto START
ORG 0X00000008
GOTO TMR3_ISR
org 0x000000ae
START
clrf PORTC
clrf PORTD
clrf LATD
clrf LATC
movlw 0x00
movwf TRISD
movwf TRISC
movlw 0x01
bsf RCON,IPEN ;enable priority interrupts.
; bSf IPR1,TMR1IP ;set Timer1 as a high priority interrupt source
bsf IPR2,TMR3IP ;set Timer3 as a low priority interrupt source
; bcf PIR1,TMR1IF ;clear the Timer1 interrupt flag
bcf PIR2,TMR3IF ;clear the Timer3 interrupt flag
; bsf PIE1,TMR1IE ;enable Timer1 interrupts
bsf PIE2,TMR3IE ;enable Timer3 interrupts
; BSF INTCON,TMR0IE
; BCF INTCON,TMR0IF
bsf INTCON,GIEH ;set the global interrupt enable bits
bsf INTCON,GIEL ; "
clrf T3CON
clrf TMR3H ;clear Timer1 high
clrf TMR3L ;clear Timer1 low
movlw 0xD0
movwf TMR3H
movlw 0x00
movwf TMR3L
bsf T3CON,TMR3ON ;turn on Timer3
MOVLW 0X01
MOVWF COUNT4
bsf LATD,7
bSf LATD,5
bSf LATD,6
bsf LATD,4
;
loop
goto loop
return
;************************************
;ISR ROUTINES
;************************************
TMR3_ISR
CPFSEQ COUNT4
LP1 goto lpl
LP2 ;RCALL DELAY1
BTG LATD,7
BTG LATD,6
INCF COUNT4
movlw 0x02
cpfseq COUNT4
lp0
goto lpl
lp00
bcf PIR2,TMR3IF ;Clear the Timer1 interrupt flag.
movlw D'200'
movwf COUNT2
lp000
movlw 0xED
movwf TMR3H
movlw 0xB0
movwf TMR3L
movlw 0x02
T1POLLl
btfss PIR2,TMR3IF ;Poll TMR11 interrupt flag to wait for another
; ; TMR1 overflow.
bra T1POLLl
bcf PIR2,TMR3IF ;Clear the Timer1 interrupt flag again.
decfsz COUNT2,1
goto lp000
CPFSEQ COUNT4
LPP1
goto lpl
LPP2
DECF COUNT4
; decf COUNT4
; decf COUNT4
GOTO LP3
LP3
BTG LATD,5
BTG LATD,4
movlw 0xD0
movwf TMR3H
movlw 0x00
movwf TMR3L
MOVLW 0X01
GOTO lpl
lpl
RETFIE
END