Escolar Documentos
Profissional Documentos
Cultura Documentos
Seguidor V2
Seguidor V2
#INCLUDE <P16F84A.INC>
__CONFIG _CP_OFF & _PWRTE_OFF & _WDT_OFF & _XT_OSC
inicio
sensores
btfss PORTA,1 ;CENTRO
goto ver_dere_izq
movlw b'00000101'
movwf PORTB
;call retardo100ms
btfsc PORTA,0 ;DERECHO
goto girar_dere
btfsc PORTA,2 ;IZQUIERDO
goto girar_izq
goto sensores
adelante
movlw b'00000101'
movwf PORTB
;call retardo100ms
goto sensores
girar_dere
movlw b'00000100'
movwf PORTB
;call retardo100ms
btfss PORTA,1 ;CENTRO
goto girar_dere
btfss PORTA,0 ;DERECHO
goto adelante
goto girar_dere
girar_izq
movlw b'00000001'
movwf PORTB
;call retardo100ms
btfss PORTA,1 ;CENTRO
goto girar_izq
btfss PORTA,2 ;IZQUIERDO
goto adelante
goto girar_izq
ver_dere_izq
btfss PORTA,0 ;DERECHO
goto ver_izq
btfsc PORTA,2 ;IZQUIERDO
goto adelante
goto girar_dere
ver_izq
btfss PORTA,2 ;IZQUIERDO
goto adelante
goto girar_izq
atras
movlw b'000001010'
movwf PORTB
call retardo100ms
goto sensores
retardo100ms
movlw .255
movwf REG1
cargarREG2
movlw .255
movwf REG2
decre1 decfsz REG2
goto decre1
decfsz REG1
goto cargarREG2
RETURN
END