whats wrong in my code because all pins showing pulse at same time meance there is no phase shift even if i 've given that much delay and toggle next pin after that where i'm doing wrong pls tell me
Code:
#include "p18f458.inc"
;------------------BIT DEFINITIONS------------------------------------
F EQU 0x0001
;COUNT1 EQU 200
;COUNT2 EQU 0x0003
;COUNT3 EQU 0x0004
red equ B'10101010'
green equ B'01010101'
var UDATA
COUNT1 res 1
COUNT2 res 1
COUNT3 res 1
COUNT4 res 1
temp_1 res 1
temp_2 res 1
temp_3 res 1
;------------------VECTORS--------------------------------------------
org 0x000000 ; reset vector
bra START
org 0x000008 ; high priority interrupt vector
bra TMR3_ISR
org 0x000070
;--------------------PROGRAM-----------------------------------
START
clrf LATD
rcall INIT
;Set up priority interrupts.
bsf RCON,IPEN ;enable priority interrupts.
bsf IPR2,TMR3IP ;set Timer3 as a low priority interrupt source
bcf PIR2,TMR3IF ;clear the Timer3 interrupt flag
bsf PIE2,TMR3IE ;enable Timer3 interrupts
bsf INTCON,GIEH ;set the global interrupt enable bits
bsf INTCON,GIEL ; "
MOVLW 0X02
MOVWF temp_1
clrf T3CON
bsf T3CON,TMR3ON ;turn on Timer3
movlw 0xd0
movwf TMR3H ;write 0xf000 to Timer3
clrf TMR3L
movlw 0x01
movwf COUNT4
MLOOP
goto MLOOP
;-------------------------------SUBROUTINES---------------------------------
TMR3_ISR ;low priority isr
CPFSEQ COUNT4
LP1 goto lpl
LP2
BTG LATD,7
BTG LATD,6
movlw 0x02
movwf COUNT1
movwf COUNT2
movlw 0x01
movwf COUNT3
bsf T3CON,TMR3ON ;turn on Timer3
bcf PIR1,TMR1IF ;Clear the Timer1 interrupt flag.
lppl
movlw 0xff
movwf TMR3H
movlw 0xfe
movwf TMR3L
T1POLLl
btfss PIR2,TMR3IF ;Poll TMR11 interrupt flag to wait for another
; TMR1 overflow.
bra T1POLLl
movlw 0xff
movwf TMR3H
movlw 0xfe
movwf TMR3L
bcf PIR2,TMR3IF ;Clear the Timer1 interrupt flag again.
decfsz COUNT1,F
bra lppl
decfsz COUNT2,F
bra lppl
decfsz COUNT3,F
bra lppl
INCF COUNT4
MOVLW 0X02
CPFSEQ COUNT4
LPP1
goto lpl
LPP2
bsf T3CON,TMR3ON ;turn on Timer3
bcf PIR2,TMR3IF ;Clear the TMR3 interrupt flag.
movlw 0xd0
movwf TMR3H
movlw 0x00
movwf TMR3L
T1POLLl1
btfss PIR2,TMR3IF ;Poll TMR11 interrupt flag to wait for another
; TMR1 overflow.
bra T1POLLl1
bcf PIR2,TMR3IF ;Clear the Timer1 interrupt flag again.
DECF COUNT4
GOTO LP3
LP3
BTG LATD,5
BTG LATD,4
movlw 0xd0
movwf TMR3H ;write 0xf000 to Timer3
MOVLW 0X01
clrf TMR3L
;GOTO LP2
lpl
retfie
INIT
movlw red
movwf LATD
clrf LATC ; setup portb for outputs
clrf TRISC
clrf TRISD
return
END