Bit8_cdu
clrf cen ; Limpiar la variable "cen" (La pone en 0)
clrf dec ; Limpiar la variable "dec" (La pone en 0)
clrf uni ; Limpiar la variable "uni" (La pone en 0)
movf dato,f ; Guardar "dato" en el acumulador F
btfss status,z ; Comparar el bit Z (Cero) del registro STATUS (Saltar si es 1)
goto no_es_cero_dato ; Si está en 0, ir a "no_es_cero_dato"
return ; Si está en 1, Regresar
no_es_cero_dato
movlw d'10' ; Cargar 10 en el acumulador W
subwf dato,w ; Se resta el valor de "dato" al acumulador W
btfsc status,c ; Comparar el bit C (Carry = Acarreo) del registro STATUS (Saltar si es 0)
goto dato_es_mayor_igual_a_10 ; Si está en 1, ir a "dato_es_mayor_igual_a_10"
movf dato,w ; Si está en 0, guardar "dato" en el acumulador W
movwf uni ; Mover el contenido del acumulador W a la variable "uni"
return ; Regresar
dato_es_mayor_igual_a_10
movlw d'10' ; Cargar 10 en el acumulador W
subwf dato,f ; Se resta el valor de "dato" al acumulador F
incf dec,f ; Incrementar la variable "dec"
movlw d'10' ; Cargar 10 en el acumulador W
subwf dec,w ; Se resta el valor de "dec" al acumulador W
btfss status,z ; Comparar el bit Z (Cero) del registro STATUS (Saltar si es 1)
goto no_es_cero_dato ; Si está en 0, ir a "no_es_cero_dato"
incf cen,f ; Si está en 1, incrementar la variable "cen"
clrf dec ; Limpiar la variable "dec" (La pone en 0)
goto no_es_cero_dato ; Ir a "no_es_cero_dato"