You are on page 1of 2

INCLUDE P16F84A.

INC CONTADOR EQU 0X0C PDel0 EQU 0X0D PDel1 EQU 0X0E CONT_AUX EQU 0X0F ORG 0X00 GOTO CONFIG_ CONFIG_ BSF STATUS, 5 MOVLW B\\\\'00001100\\\\' MOVWF TRISA CLRF TRISB BCF STATUS, 5 CLRF PORTA CLRF PORTB MOVLW .50 MOVWF CONTADOR INICIO BTFSC PORTA, 2 INCF CONTADOR, F BTFSC PORTA, 3 DECF CONTADOR, F CALL RETARDO MOVLW B\\\\'00000011\\\\' MOVWF PORTB CALL RETARDO MOVLW B\\\\'00000110\\\\' MOVWF PORTB CALL RETARDO MOVLW B\\\\'00001100\\\\' MOVWF PORTB CALL RETARDO MOVLW B\\\\'00001001\\\\' MOVWF PORTB GOTO INICIO RETARDO CLRF CONT_AUX BUCLE CALL PDelay INCF CONT_AUX, F MOVF CONT_AUX, W SUBWF CONTADOR, W BTFSC STATUS, Z RETURN GOTO BUCLE PDelay movlw movwf PLoop1 movlw movwf PLoop2 clrwdt decfsz goto decfsz goto .21 PDel0 .237 PDel1 ; ; ; ; ; PDel1, 1 ; PLoop2 ; PDel0, 1 ; PLoop1 ; 1 1 1 1 1 1 2 1 2 set number of repetitions (B) | set number of repetitions (A) | clear watchdog + (1) is the time over? (A) no, loop + (1) is the time over? (B) no, loop

2 cycles delay . 1 cycle delay .PDelL1 goto PDelL2 PDelL2 clrwdt return END .