Quiero hacer un programa que realice un efecto ping pong con 8 leds, el problema es que no puedo hacerlo andar, ya que al querer probarlo me indica el siguiente error:
Es raro por que nunca me paso, no se si es por usar otro pic ya que antes usaba el 16F84a y no pasaba esto.
Acá esta el programa que realicé:
Que hago mal?
Código:
Warning[207] F:\PROYECTOS\PIC PROYECTOS\18F4550\EFECTO PING PONG\PROGRAMA.ASM 17 : Found label after column 1. (rrf)
Error[122] F:\PROYECTOS\PIC PROYECTOS\18F4550\EFECTO PING PONG\PROGRAMA.ASM 17 : Illegal opcode (PORTD)
Warning[207] F:\PROYECTOS\PIC PROYECTOS\18F4550\EFECTO PING PONG\PROGRAMA.ASM 22 : Found label after column 1. (rlf)
Error[122] F:\PROYECTOS\PIC PROYECTOS\18F4550\EFECTO PING PONG\PROGRAMA.ASM 22 : Illegal opcode (PORTD)
Skipping link step. Not all sources built successfully.
Acá esta el programa que realicé:
Código:
;Efecto Ping-Pong
;Pic
#include <p18F4550.inc>
;Etiquetas
PDel0 equ 0x0a
PDel1 equ 0x0b
;Programación de Puertos
movlw 0x00 ;Ingreso 0x00 en W
movwf TRISD ;Puerto D configurado como salida
goto START ;Programa Principal
;Subrutina: Movimiento Izquierda a Derecha
DERECHA
rrf PORTD,1 ;Acarreo de bits hacia la derecha
call DEMORA ;Demora de 0,5 s.
return
;Subrutina: Movimiento Derecha a Izquierda
IZQUIERDA
rlf PORTD,1 ;Acarreo de bits hacia la izquierda
call DEMORA ;Demora de 0,5 s.
return
;Subrutina: Demora de 0,5 s.
DEMORA movlw .239 ; 1 set numero de repeticion (B)
movwf PDel0 ; 1 |
PLoop1 movlw .232 ; 1 set numero de repeticion (A)
movwf PDel1 ; 1 |
PLoop2 clrwdt ; 1 clear watchdog
PDelL1 goto PDelL2 ; 2 ciclos delay
PDelL2 goto PDelL3 ; 2 ciclos delay
PDelL3 clrwdt ; 1 ciclo delay
decfsz PDel1, 1 ; 1 + (1) es el tiempo 0 ? (A)
goto PLoop2 ; 2 no, loop
decfsz PDel0, 1 ; 1 + (1) es el tiempo 0 ? (B)
goto PLoop1 ; 2 no, loop
PDelL4 goto PDelL5 ; 2 ciclos delay
PDelL5 goto PDelL6 ; 2 ciclos delay
PDelL6 goto PDelL7 ; 2 ciclos delay
PDelL7 clrwdt ; 1 ciclo delay
return ; 2+2 Fin.
;Programa Principal
START
bsf PORTD,0 ;Inicio del efecto
DER
call DERECHA ;Llamado a subrutina DERECHA
btfss PORTD,7 ;Pregunto si llego al ultimo bit
goto DER ;No = Voy a DER
call DEMORA ;SI = Demora de 0,5 s.
IZQ
call IZQUIERDA ;Llamado a subrutina IZQUIERDA
btfss PORTD,0 ;Pregunto si llego al primer bit
goto IZQ ;No = Voy a IZQ
call DEMORA ;Si = Demora de 0,5 s.
goto DER ;Voy a DER
;Fin del Programa
end ;Fin
Que hago mal?