Está en la página 1de 2

TRISA EQU

PORTA EQU
TRISB EQU
PORTB EQU
STATUS EQU
UNIDADES
PDel0 EQU
PDel1 EQU
PDel2 EQU
DECENA EQU

0x85
0x05
0x86
0x06
0x03
EQU 0x0C
0x0D
0x0E
0x0F
0x10

BSF
MOVLW
MOVWF
CLRF

STATUS,5
; Acceso al Banco 1.
b'00010000'
PORTA
PORTB
; Las lneas del Puerto B se configuran como salid

BCF
CLRF
CLRF
CLRF

UNIDADES
DECENA
PORTB

a.
STATUS,5;

BOTON
BTFSC

PORTA,4
GOTO
INCREMENTO
GOTO
DECREMENTO

INCREMENTO ;RUTINA PARA EL INCREMENTO


CALL
MOSTRAR
MOVF
UNIDADES,0
INCF
UNIDADES
XORLW b'00001001'
BTFSC STATUS,2
GOTO REINICIA_UP
GOTO BOTON
REINICIA_UP
CLRF
UNIDADES
INCF
DECENA
MOVF
DECENA,0
XORLW b'00001010'
BTFSC STATUS,2
GOTO REINICIAD_UP
GOTO BOTON
REINICIAD_UP
CLRF
DECENA
GOTO
BOTON

RETRUN
;------------------------------------------------------------PDelay movlw
.14
; 1 set number of repetitions (C)
movwf
PDel0
; 1 |
PLoop0 movlw
.72
; 1 set number of repetitions (B)
movwf
PDel1
; 1 |
PLoop1 movlw
.247
; 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
PDelL1 goto PDelL2
; 2 cycles delay
PDelL2 clrwdt
; 1 cycle delay
return
; 2+2 Done
;------------------------------------------------------------END

También podría gustarte