cronometro con boton pausa y continua

Hola que tal a todos los integrantes de este maravilloso foro, mi inquietud es la siguiente: el cronometro que se muestra abajo cuenta con un botón de reset (RB0) y botón de pausa y continuación de cuenta (RB1), el detalle es que no consigo hacer que este botón (RB1) que detiene la cuenta haga regresar a la cuenta al cronometro , lo del reset si funciona :) .
Lo que debe suceder es que cuando el RB1 (pulsador) se pone a un uno lógico se va a la rutina pausa y si es cero lógico pos que siga la cuenta; y si después de estar en pausa, otra vez se presiona el RB1 colocándose a un uno lógico el cronometro debe volver a la cuenta (cosa que no sucede). Dentro de la rutina pausa intente testear el RB1 nuevamente pero me di cuenta después que hay un tipo de conflicto entre el testear el RB1 que lleva a la subrutina pausa y el RB1 que esta dentro de esta subrutina, es por eso que lo puse comentario como lo podrán observar, esta en las ultimas lineas del programa.
Espero me hayan entendido, y puedan guiarme en la solución de este problemita. :)
Gracias
saludos coordiales


list p=16f877A ; list directive to define processor
#include <p16f877A.inc> ; processor specific variable definitions
#INCLUDE <Macros.inc>

__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _XT_OSC & _WRT_OFF & _LVP_OFF & _CPD_OFF


errorlevel -302
gg EQU 0X75
ff EQU 0X74
ee EQU 0X73
dd EQU 0X72
cc EQU 0X71
bb EQU 0X70
aa EQU 0X69
w_temp EQU 0x68 ; variable used for context saving
status_temp EQU 0x67 ; variable used for context saving
pclath_temp EQU 0x66 ; variable used for context saving
numero EQU 0x65
temporal EQU 0x64

ORG 0X000
nop ; nop required for icd
goto main ; go to beginning of program


ORG 0X004 ; interrupt vector location

movwf w_temp ; save off current W register contents
movf STATUS,w ; move status register into W register
movwf status_temp ; save off contents of STATUS register
movf PCLATH,w ; move pclath register into w register
movwf pclath_temp ; save off contents of PCLATH register

goto RutInterrupcion

SalirInterrupcion

movf pclath_temp,w ; retrieve copy of PCLATH register
movwf PCLATH ; restore pre-isr PCLATH register contents
movf status_temp,w ; retrieve copy of STATUS register
movwf STATUS ; restore pre-isr STATUS register contents
swapf w_temp,f
swapf w_temp,w ; restore pre-isr W register contents
retfie ; return from interrupt

main
Banco1
movlw b'00000011'
movwf TRISB
clrf TRISD
Banco0
bsf INTCON,GIE
bsf INTCON,INTE

Inicio:
CALL Inicio_LCD
movlw 'C'
call EnviaCarLCD
movlw 'R'
call EnviaCarLCD
movlw 'O'
call EnviaCarLCD
movlw 'N'
call EnviaCarLCD
movlw 'O'
call EnviaCarLCD
;RESET
clrf gg ; Inicializa todos los datos del reloj.
clrf ff
clrf ee
clrf dd
clrf cc
clrf bb
clrf aa


g:
call muestra
btfsc PORTB,1 ;testeando RB1
call pausa
;play
incf gg,f
movf gg,w
sublw d'9'
btfsc STATUS,C
goto g
goto f

f: movlw d'0'
movwf gg
incf ff,f
movf ff,w
sublw d'9'
btfsc STATUS,C
goto g
goto e

e: movlw d'0'
movwf ff
incf ee,f
movf ee,w
sublw d'9'
btfsc STATUS,C
goto g
goto d

d: movlw d'0'
movwf ee
incf dd,f
movf dd,w
sublw d'9'

btfsc STATUS,C
goto g
goto c

c: movlw d'0'
movwf dd
incf cc,f
movf cc,w
sublw d'5'
btfsc STATUS,C
goto g
goto b1

b1: movlw d'0'
movwf cc
incf bb,f
movf bb,w
sublw d'9'
btfsc STATUS,C
goto g
goto a

a: movlw d'0'
movwf bb
incf aa,f
movf aa,w
sublw d'5'
btfsc STATUS,C
goto g
goto Inicio

muestra:
movf DISP_CLEAR,w
call EnviaCmdLCD

movlw DISP_LINEA2 ;
call EnviaCmdLCD

movlw ' '
call EnviaCarLCD
movlw ' '
call EnviaCarLCD
movlw ' '
call EnviaCarLCD
movlw ' '
call EnviaCarLCD
movf aa,w
addlw 0x30 ;para pasar a ASCII
call EnviaCarLCD ;n
movf bb,w
addlw 0x30 ;para pasar a ASCII
call EnviaCarLCD ;n

movlw ':'
call EnviaCarLCD

movf cc,w
addlw 0x30 ;para pasar a ASCII
call EnviaCarLCD ;n
movf dd,w
addlw 0x30 ;para pasar a ASCII
call EnviaCarLCD ;n

movlw ':'
call EnviaCarLCD
movf ee,w
addlw 0x30 ;para pasar a ASCII
call EnviaCarLCD ;n
movf ff,w
addlw 0x30 ;para pasar a ASCII
call EnviaCarLCD ;n
movf gg,w
addlw 0x30 ;para pasar a ASCII
call EnviaCarLCD ;n

return

RutInterrupcion
btfsc PORTB,0
goto IntExter
goto SalirInterrupcion
IntExter
clrf gg ; Inicializa todos los datos del reloj.
clrf ff
clrf ee
clrf dd
clrf cc
clrf bb
clrf aa
goto SalirintExter

SalirintExter
bcf INTCON,INTF
goto SalirInterrupcion
pausa
call muestra
; btfss PORTB,1
goto pausa
; goto play
return

INCLUDE "ModuloLCD.asm"
INCLUDE "ModuloDELAY10M.asm"
end
 
Atrás
Arriba