CONTADOR equ 0x20
ORG 0
clrf CONTADOR
inicio
incf CONTADOR,F ;Incrementamos el contador
btfss CONTADOR,3 ;Si el bit 3
goto display ;y el bit 1
btfss CONTADOR,1 ;del contador
goto display ;son 1 (10 en binario)
movlw 0x06 ;sumamos 6 a las unidades
addwf CONTADOR,F ;para incrementar las decenas
btfss CONTADOR,7 ;Si el bit 7
goto display ;y el bit 5
btfss CONTADOR,5 ;del contador
goto display ;son 1 (100 en binario)
movlw 0x60 ;sumamos 6 a las decenas
addwf CONTADOR,F ;asi pasamos a cero todo el contador
display
movf CONTADOR,W ;Presentamos en
andlw 0x0F ;el display el
call tabla_segmentos ;valor de las
movwf PORTA ;decenas
swapf CONTADOR,W ;Presentamos en
andlw 0x0F ;el display el
call tabla_segmentos ;valor de las
movwf PORTB ;centenas
goto inicio
tabla_segmentos
addwf pcl,f
retlw b'00111111';0
retlw b'00000110';1
retlw b'01011011';2
retlw b'01001111';3
retlw b'01100110';4
retlw b'01101101';5
retlw b'01111100';6
retlw b'00000111';7
retlw b'01111111';8
retlw b'01100111';9
END