saludos
caballeros el inconveniente que tengo en mano es que los retardos que programo con el pdel delayer que son 5seg; 3seg y 1seg no me estan dando como quiero y programo y nada. entonces no se cual sera el problema
utilizo pic: 16f873A
cristal: 4mhz
condensadores:27pf
este es el programa es una secuencia de leds con tres tiempos diferentes.
al precionar el ra2 solo prende el primer led y ahi se queda y no me atiende los otros pulsadores.
el programa conta de 14 leds. 7 en portb y 7 en portc .
gracias por la colabaracion.
LIST p=16f873A
include"p16f873A.INC"
contador EQU 23
status EQU 03
porta EQU 05
portb EQU 06
portc EQU 07
adcon1 EQU H'9F'
PDel0 EQU 10
PDel1 EQU 11
PDel2 EQU 12
PDel3 EQU 13
PDel4 EQU 14
PDel5 EQU 15
PDel6 EQU 16
org 00
goto inicio
tabla ADDWF PCL,1
RETLW B'00000001'
RETLW B'00000010'
RETLW B'00000100'
RETLW B'00001000'
RETLW B'00010000'
RETLW B'00100000'
RETLW B'01000000'
anti
movlw .248 ; 1 set number of repetitions
movwf PDel0 ; 1 |
PLoopR clrwdt ; 1 clear watchdog
decfsz PDel0, 1 ; 1 + (1) is the time over?
goto PLoopR ; 2 no, loop
PDelLM goto PDelLL ; 2 cycles delay
PDelLL ; 1 cycle delay
return ; 2+2 Done
retardo
movlw .200
movwf contador
ggg decfsz contador,1
goto ggg
return
uno_seg
movlw .14 ; 1 set number of repetitions (C)
movwf PDel0 ; 1 |
PLoopx movlw .72 ; 1 set number of repetitions (B)
movwf PDel1 ; 1 |
PLoopy movlw .247 ; 1 set number of repetitions (A)
movwf PDel2 ; 1 |
PLoopz clrwdt ; 1 clear watchdog
decfsz PDel2, 1 ; 1 + (1) is the time over? (A)
goto PLoopz ; 2 no, loop
decfsz PDel1, 1 ; 1 + (1) is the time over? (B)
goto PLoopy ; 2 no, loop
decfsz PDel0, 1 ; 1 + (1) is the time over? (C)
goto PLoopx ; 2 no, loop
PDelL1 goto PDelLx ; 2 cycles delay
PDelLx clrwdt ; 1 clear watchdog
return ; 2+2 Done
tres_seg
movlw .67 ; 1 set number of repetitions (C)
movwf PDel0 ; 1 |
PLoop0 movlw .91 ; 1 set number of repetitions (B)
movwf PDel1 ; 1 |
PLoop1 movlw .122 ; 1 set number of repetitions (A)
movwf PDel2 ; 1 |
PLoop2 clrwdt ; 1 clear watchdog
decfsz PDel2, 1 ; 1 + (1) is the time over? (A)
goto PLoop2 ; 2 no, loop
decfsz PDel1, 1 ; 1 + (1) is the time over? (B)
goto PLoop1 ; 2 no, loop
decfsz PDel0, 1 ; 1 + (1) is the time over? (C)
goto PLoop0 ; 2 no, loop
PDelL6 goto PDelL2 ; 2 cycles delay
PDelL2 clrwdt ; 1 cycle delay
return ; 2+2 Done
cinco_seg
movlw .165 ; 1 set number of repetitions (C)
movwf PDel0 ; 1 |
PLoopv movlw .41 ; 1 set number of repetitions (B)
movwf PDel1 ; 1 |
PLoopw movlw .147 ; 1 set number of repetitions (A)
movwf PDel2 ; 1 |
PLoopm clrwdt ; 1 clear watchdog
clrwdt
decfsz PDel2, 1 ; 1 + (1) is the time over? (A)
goto PLoopm ; 2 no, loop
decfsz PDel1, 1 ; 1 + (1) is the time over? (B)
goto PLoopw ; 2 no, loop
decfsz PDel0, 1 ; 1 + (1) is the time over? (C)
goto PLoopv ; 2 no, loop
return ; 2+2 Done
inicio bsf status,5
bcf status,6
movlw 07
movwf adcon1
movlw b'001111'
movwf porta
clrf portb
clrf portc
bcf status,5
clrf portb
clrf portc
coveñas
empezar
btfss porta,0
goto uno_rot
call anti
btfss porta,0
goto uno_rot
goto fijo
uno_rot btfss porta,1
goto dos_rot
call anti
btfss porta,1
goto dos_rot
goto primer_rot
dos_rot btfss porta,2
goto tres_rot
call anti
btfss porta,2
goto tres_rot
goto segundo_rot
tres_rot btfss porta,3
goto empezar
call anti
btfss porta,3
goto empezar
goto tercer_rot
fijo movlw H'ff'
movwf portb
movwf portc
call retardo
btfsc porta,1
goto primer_rot
btfsc porta,2
goto segundo_rot
btfsc porta,3
goto tercer_rot
goto fijo
primer_rot clrf contador
clrf portc
clrf portb
repit movf contador,0
btfsc porta,0
goto fijo
btfsc porta,2
goto segundo_rot
btfsc porta,3
goto tercer_rot
call tabla
movwf portb
call uno_seg
incf contador,1
movlw .7
xorwf contador,0
btfss status,2
goto repit
clrf portb
clrf contador
ben movf contador,0
btfsc porta,0
goto fijo
btfsc porta,2
goto segundo_rot
btfsc porta,3
goto tercer_rot
call tabla
movwf portc
call uno_seg
incf contador,1
movlw .7
xorwf contador,0
btfss status,2
goto ben
goto primer_rot
segundo_rot clrf contador
clrf portc
clrf portb
repit1 movf contador,0
btfsc porta,0
goto fijo
btfsc porta,1
goto primer_rot
btfsc porta,3
goto tercer_rot
call tabla
movwf portb
call tres_seg
incf contador,1
movlw .7
xorwf contador,0
btfss status,2
goto repit1
clrf portb
clrf contador
ben99 movf contador,0
btfsc porta,0
goto fijo
btfsc porta,1
goto primer_rot
btfsc porta,3
goto tercer_rot
call tabla
movwf portc
call tres_seg
incf contador,1
movlw .7
xorwf contador,0
btfss status,2
goto ben99
goto segundo_rot
tercer_rot clrf contador
clrf portc
clrf portb
repit2 movf contador,0
btfsc porta,0
goto fijo
btfsc porta,1
goto primer_rot
btfsc porta,2
goto segundo_rot
call tabla
movwf portb
call cinco_seg
incf contador,1
movlw .7
xorwf contador,0
btfss status,2
goto repit2
clrf contador
clrf portb
ben999 movf contador,0
btfsc porta,0
goto fijo
btfsc porta,1
goto primer_rot
btfsc porta,2
goto segundo_rot
call tabla
movwf portc
call cinco_seg
incf contador,1
movlw .7
xorwf contador,0
btfss status,2
goto ben999
goto tercer_rot
end