;------------------------------------------------------------
; Código assembler generado por Niple V5.6.2
; Proyecto: Vivienda
; Autor: Santiago Riffel
; Fecha: 31/08/2012
; PIC: 16F887
; Velocidad de reloj: Int 4 Mhz
; Descripcion: 
;------------------------------------------------------------


 LIST    P=PIC16F887


_INTOSCIO             equ  0x3FFC
_DEBUG_OFF            equ  0x3FFF
_LVP_OFF              equ  0x2FFF
_FCMEN_OFF            equ  0x37FF
_IESO_OFF             equ  0x3BFF
_BOR_OFF              equ  0x3CFF
_CPD_OFF              equ  0x3FFF
_CP_OFF               equ  0x3FFF
_MCLRE_ON             equ  0x3FFF
_PWRTE_ON             equ  0x3FEF
_WDT_OFF              equ  0x3FF7
_INTOSCIO             equ  0x3FFC
_WRT_OFF              equ  0x3FFF
_BOR21V               equ  0x3EFF
_config1              equ  0x2007
_config2              equ  0x2008

 __config _config1, _INTOSCIO & _DEBUG_OFF & _LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_OFF & _CPD_OFF & _CP_OFF & _MCLRE_ON & _PWRTE_ON & _WDT_OFF
 __config _config2, _WRT_OFF & _BOR21V


;------------------------------------------------------------
;                  Declaración de Registros
;------------------------------------------------------------
w                     equ  0x0000
pcl                   equ  0x0002
status                equ  0x0003
porta                 equ  0x0005
portb                 equ  0x0006
portc                 equ  0x0007
portd                 equ  0x0008
porte                 equ  0x0009
pclath                equ  0x000a
intcon                equ  0x000b
adcon0                equ  0x001f
_np_w                 equ  0x0020
valor_tecla           equ  0x0024
_np_temp1             equ  0x0025
_np_temp2             equ  0x0026
_np_temp3             equ  0x0027
_np_temp4             equ  0x0028
_np_resultado         equ  0x002a
_np_presionada        equ  0x002b
_np_indice            equ  0x002c
_np_tec               equ  0x002d
_np_est_inte          equ  0x002e
_np_status            equ  0x002f
_np_actint_a          equ  0x0031
_np_actint_b          equ  0x0032
_np_tiempo            equ  0x0033
_np_tiempo1           equ  0x0034
_np_tiempo2           equ  0x0035
_np_tiempo3           equ  0x0036
_np_t_bak             equ  0x0037
_np_t1_bak            equ  0x0038
_np_t2_bak            equ  0x0039
_np_t3_bak            equ  0x003a
banderas_l            equ  0x003c
contador_prela        equ  0x003d
contador_enjua_1      equ  0x003e
contador_enjua_2      equ  0x003f
contador_enjua_3      equ  0x0040
contador_enjua_4      equ  0x0041
contador_lava_1       equ  0x0042
contador_lava_2       equ  0x0043
contador_centr_1      equ  0x0044
contador_centr_2      equ  0x0045
contador_desag_1      equ  0x0046
_np_nro_lcd           equ  0x0048
_np_nro_msj           equ  0x0049
_np_msj_act           equ  0x004a
_np_lcd_1             equ  0x004b
contador              equ  0x004e
programa              equ  0x004f
_np_banderas2         equ  0x0050
estado_lavado         equ  0x0051
contador_gral         equ  0x0053
programa_uni          equ  0x0054
programa_dec          equ  0x0055
programa_cen          equ  0x0056
_np_tiempo_inte       equ  0x0057
_np_tiempo1_inte      equ  0x0059
_np_tiempo2_inte      equ  0x005a
_np_tiempo3_inte      equ  0x005b
opcion                equ  0x0081
trisa                 equ  0x0085
trisb                 equ  0x0086
trisc                 equ  0x0087
trisd                 equ  0x0088
trise                 equ  0x0089
iocb                  equ  0x0096
adcon1                equ  0x009f
cm1con0               equ  0x0107
cm2con0               equ  0x0108
eedata                equ  0x010c
eeadr                 equ  0x010d
ansel                 equ  0x0188
anselh                equ  0x0189
eecon1                equ  0x018c
eecon2                equ  0x018d


;------------------------------------------------------------
;                  Declaración de Bits
;------------------------------------------------------------
adon                  equ  0   ;
c                     equ  0   ;carry / borrow bit
c1ch0                 equ  0   ;
c1ch1                 equ  1   ;
c1oe                  equ  5   ;
c1r                   equ  2   ;
c2ch0                 equ  0   ;
c2ch1                 equ  1   ;
c2oe                  equ  5   ;
c2r                   equ  2   ;
eeif                  equ  4   ;eeprom write operation interrupt flag bit
eepgd                 equ  7   ;
gie                   equ  7   ;habilitador general de interrupciones
inte                  equ  4   ;habilitador de interrupción por rb0
intedg                equ  6   ;interrupt edge select bit
intf                  equ  1   ;rb0 / int interrupt flag bit
iocb4                 equ  4   ;
iocb5                 equ  5   ;
iocb6                 equ  6   ;
iocb7                 equ  7   ;
ra0                   equ  0   ;bit 0 del puerto a
ra2                   equ  2   ;bit 2 delpuerto a
ra3                   equ  3   ;bit 3 del puerto a
ra4_t0cki             equ  4   ;bit 4 del puerto a o entrada de reloj
ra5                   equ  5   ;bit 5 del puerto a
ra7                   equ  7   ;bit 7 del puerto a
rb1                   equ  1   ;bit 1 del puerto b
rb2                   equ  2   ;bit 2 delpuerto b
rb3                   equ  3   ;bit 3 del puerto b
rb4                   equ  4   ;bit 4 del puerto b
rb5                   equ  5   ;bit 5 del puerto b
rb6                   equ  6   ;bit 6 del puerto b
rb7                   equ  7   ;bit 7 del puerto b
rbie                  equ  3   ;habilitador de interrupción por cambio de estado puerto b4 a 7
rbif                  equ  0   ;rb port change interrupt flag bit
rc0                   equ  0   ;bit 0 del puerto c
rc1                   equ  1   ;bit 1 del puerto c
rc4                   equ  4   ;bit 4 del puerto c
rc5                   equ  5   ;bit 5 del puerto c
rc6                   equ  6   ;bit 6 del puerto c
rc7                   equ  7   ;bit 7 del puerto c
rd                    equ  0   ;
rd4                   equ  4   ;bit 4 del puerto d
rd6                   equ  6   ;bit 6 del puerto d
rd7                   equ  7   ;bit 7 del puerto d
re0                   equ  0   ;bit 0 del puerto e
re1                   equ  1   ;bit 1 del puerto e
re2                   equ  2   ;bit 2 delpuerto e
rp0                   equ  5   ;registrer bank select bit
rp1                   equ  6   ;registrer bank select bit
vcfg0                 equ  4   ;
vcfg1                 equ  5   ;
wr                    equ  1   ;
wren                  equ  2   ;
z                     equ  2   ;bit cero
iniciar_lavado        equ  5   ;
media_carga           equ  2   ;
prelavado             equ  0   ;
seleccionar_prog      equ  6   ;
sub_inte              equ  0   ;bandera de subrrutina cancelada por interrupcion.


;------------------------------------------------------------
;               Declaración de Registros EEPROM
;------------------------------------------------------------
memo_estado           equ  0x000a
memo_avance           equ  0x000b
memo_programa         equ  0x000c


;------------------------------------------------------------
;                        Inicio
;------------------------------------------------------------

   org 0x00
   goto paso2
   org 0x04
   movwf _np_w
   swapf _np_w,1
   movf status,w
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_status
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_tiempo,w
   movwf _np_t_bak
   movf _np_tiempo1,w
   movwf _np_t1_bak
   movf _np_tiempo2,w
   movwf _np_t2_bak
   movf _np_tiempo3,w
   movwf _np_t3_bak
   btfsc intcon,rbif
   goto inte_rb0a7
   btfsc intcon,intf
   goto inte_rb0
salir_interrupcion
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf _np_banderas2,sub_inte       ;activar la bandera de rutina cancelada por interrupcion
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_t_bak,w
   movwf _np_tiempo
   movf _np_t1_bak,w
   movwf _np_tiempo1
   movf _np_t2_bak,w
   movwf _np_tiempo2
   movf _np_t3_bak,w
   movwf _np_tiempo3
   movf _np_status,w 
   movwf status
   swapf _np_w,w 
   retfie

_np_tabla_teclado
   movf _np_indice,0
   movwf _np_temp1
   movlw low _np_tabla_teclado_tabla
   addwf _np_temp1,1
   movlw high _np_tabla_teclado_tabla
   btfsc status,c
   addlw .1
   movwf pclath
   movf _np_indice,0
   call _np_tabla_teclado_tabla
   movwf _np_resultado
   return

_np_tabla_teclado_tabla
   addwf pcl,1
   retlw 0x00                       ; 0
   retlw 0x01                       ; 1
   retlw 0x02                       ; 2
   retlw 0x03                       ; 3
   retlw 0xf1                       ; f1
   retlw 0x04                       ; 4
   retlw 0x05                       ; 5
   retlw 0x06                       ; 6
   retlw 0xf2                       ; f2
   retlw 0x07                       ; 7
   retlw 0x08                       ; 8
   retlw 0x09                       ; 9
   retlw 0xf3                       ; f3
   retlw 0x13                       ; *
   retlw 0x00                       ; 0
   retlw 0x14                       ; #
   retlw 0xf4                       ; f4


   ;------------------------------------------------------------
   ;                      inicio de la interrupción por rb0 a 7
   ;------------------------------------------------------------
inte_rb0a7_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf portb,w
   bcf intcon,rbif
   goto salir_interrupcion
inte_rb0a7
   call teclado_matricial           ;llamada a rutina teclado_matricial
   movf _np_resultado,w
   movwf valor_tecla
   movlw d'17'                      ;si el reg valor_tecla < d'17'
   subwf valor_tecla,w
   btfsc status,c
   goto inte_rb0a7_salir
   movf valor_tecla,w               ;consultar la tabla_np_tabla_teclado
   movwf _np_indice
   call _np_tabla_teclado           ;llamada a rutina _np_tabla_teclado
   movf _np_resultado,w
   movwf valor_tecla
   movf valor_tecla,w               ;si el reg valor_tecla = 0x13
   xorlw 0x13
   btfss status,z
   goto inte_rb0a78
   bsf banderas_l,iniciar_lavado    ;da comienzo al lavado
inte_rb0a77
   goto inte_rb0a7_salir
inte_rb0a78
   movf valor_tecla,w               ;si el reg valor_tecla = 0x14
   xorlw 0x14
   btfss status,z
   goto inte_rb0a710
   bsf banderas_l,seleccionar_prog  ;ingresa a la rutina de selección de programa.
   goto inte_rb0a7_salir
inte_rb0a710
   btfss banderas_l,seleccionar_prog;si el bit seleccionar_prog = 1
   goto inte_rb0a7_salir
   movf valor_tecla,w
   movwf programa
   ;convertir un registro a bcd
inte_rb0a712_inte
   movf programa,w
   movwf _np_temp1
   call conv_8_bcd                  ;llamada a rutina conv_8_bcd
   btfsc _np_banderas2,sub_inte     ;si la subrutina fue cancelada por una interrupcion
   goto inte_rb0a712_inte           ;ejecutar la rutina nuevamente
   movf _np_temp1,w
   movwf programa_uni
   movf _np_temp2,w
   movwf programa_dec
   movf _np_temp3,w
   movwf programa_cen
   call rutusr_022                  ;llamada a rutina usr_lcd_seleccionado

   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf portd,7                      ;inhabilitar el teclado
   bsf status,rp0                   ;cambiar a banco 1
   bcf trisb,7                      ;configurar los pines b4 al 7 como salida
   bcf trisb,6
   bcf trisb,5
   bcf trisb,4
   movlw b'11001101'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movlw b'11001101'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movf programa_dec,w              ;enviar la variable programa_dec al lcd.
   addlw .48
   call lcd_caracter                ;llamada a rutina lcd_caracter
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisb,4                      ;configurar los pines b4 al 7 como entrada
   bsf trisb,5
   bsf trisb,6
   bsf trisb,7
   bcf status,rp0                   ;cambiar a banco 0
   bcf portd,7                      ;habilitar el teclado

   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf portd,7                      ;inhabilitar el teclado
   bsf status,rp0                   ;cambiar a banco 1
   bcf trisb,7                      ;configurar los pines b4 al 7 como salida
   bcf trisb,6
   bcf trisb,5
   bcf trisb,4
   movlw b'11001110'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movlw b'11001110'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movf programa_uni,w              ;enviar la variable programa_uni al lcd.
   addlw .48
   call lcd_caracter                ;llamada a rutina lcd_caracter
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisb,4                      ;configurar los pines b4 al 7 como entrada
   bsf trisb,5
   bsf trisb,6
   bsf trisb,7
   bcf status,rp0                   ;cambiar a banco 0
   bcf portd,7                      ;habilitar el teclado
   movlw .3                         ;temporizador 3 seg
   call tmp_1_mgc_i                 ;llamada a rutina tmp_1_mgc_i
   goto inte_rb0a7_salir

   ;------------------------------------------------------------
   ;                      inicio de la interrupción por rb0
   ;------------------------------------------------------------
inte_rb0_salir
   bcf intcon,intf
   goto salir_interrupcion
inte_rb0
inte_rb02
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   btfss portc,rc7                  ;si el bit rc7 = 1
   goto inte_rb07
   call rutusr_021                  ;llamada a rutina usr_lcd_errores

   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf portd,7                      ;inhabilitar el teclado
   bsf status,rp0                   ;cambiar a banco 1
   bcf trisb,7                      ;configurar los pines b4 al 7 como salida
   bcf trisb,6
   bcf trisb,5
   bcf trisb,4
   movlw b'11000000'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movlw .68                        ;d
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .105                       ;i
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .115                       ;s
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .112                       ;p
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .101                       ;e
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .110                       ;n
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .115                       ;s
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .101                       ;e
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .114                       ;r
   call lcd_caracter                ;llamada a rutina lcd_caracter
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisb,4                      ;configurar los pines b4 al 7 como entrada
   bsf trisb,5
   bsf trisb,6
   bsf trisb,7
   bcf status,rp0                   ;cambiar a banco 0
   bcf portd,7                      ;habilitar el teclado
inte_rb05
   btfss banderas_l,iniciar_lavado  ;si el bit iniciar_lavado = 1
   goto inte_rb02                   ;cierra el ciclo
   goto inte_rb0_salir
inte_rb07
   btfss portc,rc6                  ;si el bit rc6 = 1
   goto inte_rb010
   call rutusr_021                  ;llamada a rutina usr_lcd_errores

   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf portd,7                      ;inhabilitar el teclado
   bsf status,rp0                   ;cambiar a banco 1
   bcf trisb,7                      ;configurar los pines b4 al 7 como salida
   bcf trisb,6
   bcf trisb,5
   bcf trisb,4
   movlw b'11000000'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movlw .77                        ;m
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .111                       ;o
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .116                       ;t
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .111                       ;o
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .114                       ;r
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .32                        ;espacio
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .99                        ;c
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .101                       ;e
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .110                       ;n
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .116                       ;t
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .114                       ;r
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .97                        ;a
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .108                       ;l
   call lcd_caracter                ;llamada a rutina lcd_caracter
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisb,4                      ;configurar los pines b4 al 7 como entrada
   bsf trisb,5
   bsf trisb,6
   bsf trisb,7
   bcf status,rp0                   ;cambiar a banco 0
   bcf portd,7                      ;habilitar el teclado
   goto inte_rb05                   ;cierra el ciclo
inte_rb010
   btfss portc,rc5                  ;si el bit rc5 = 1
   goto inte_rb013
   call rutusr_021                  ;llamada a rutina usr_lcd_errores

   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf portd,7                      ;inhabilitar el teclado
   bsf status,rp0                   ;cambiar a banco 1
   bcf trisb,7                      ;configurar los pines b4 al 7 como salida
   bcf trisb,6
   bcf trisb,5
   bcf trisb,4
   movlw b'11000000'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movlw .77                        ;m
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .111                       ;o
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .116                       ;t
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .111                       ;o
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .114                       ;r
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .32                        ;espacio
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .68                        ;d
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .101                       ;e
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .115                       ;s
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .97                        ;a
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .103                       ;g
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .111                       ;o
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .116                       ;t
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .101                       ;e
   call lcd_caracter                ;llamada a rutina lcd_caracter
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisb,4                      ;configurar los pines b4 al 7 como entrada
   bsf trisb,5
   bsf trisb,6
   bsf trisb,7
   bcf status,rp0                   ;cambiar a banco 0
   bcf portd,7                      ;habilitar el teclado
   goto inte_rb05                   ;cierra el ciclo
inte_rb013
   btfss portc,rc4                  ;si el bit rc4 = 1
   goto inte_rb016
   call rutusr_021                  ;llamada a rutina usr_lcd_errores

   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf portd,7                      ;inhabilitar el teclado
   bsf status,rp0                   ;cambiar a banco 1
   bcf trisb,7                      ;configurar los pines b4 al 7 como salida
   bcf trisb,6
   bcf trisb,5
   bcf trisb,4
   movlw b'11000000'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movlw .80                        ;p
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .114                       ;r
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .111                       ;o
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .103                       ;g
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .114                       ;r
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .97                        ;a
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .109                       ;m
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .97                        ;a
   call lcd_caracter                ;llamada a rutina lcd_caracter
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisb,4                      ;configurar los pines b4 al 7 como entrada
   bsf trisb,5
   bsf trisb,6
   bsf trisb,7
   bcf status,rp0                   ;cambiar a banco 0
   bcf portd,7                      ;habilitar el teclado
   goto inte_rb05                   ;cierra el ciclo
inte_rb016
   movlw .3                         ;temporizador 3 seg
   call tmp_1_mgc_i                 ;llamada a rutina tmp_1_mgc_i
   goto inte_rb05                   ;cierra el ciclo

;------------------------------------------------------------
;                      programa principal
;------------------------------------------------------------
paso2
   clrf _np_w
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf valor_tecla
   clrf _np_temp1
   clrf _np_temp2
   clrf _np_temp3
   clrf _np_temp4
   clrf _np_resultado
   clrf _np_presionada
   clrf _np_indice
   clrf _np_tec
   clrf _np_est_inte
   clrf _np_status
   clrf _np_actint_a
   clrf _np_actint_b
   clrf _np_tiempo
   clrf _np_tiempo1
   clrf _np_tiempo2
   clrf _np_tiempo3
   clrf _np_t_bak
   clrf _np_t1_bak
   clrf _np_t2_bak
   clrf _np_t3_bak
   clrf banderas_l
   clrf contador_prela
   clrf contador_enjua_1
   clrf contador_enjua_2
   clrf contador_enjua_3
   clrf contador_enjua_4
   clrf contador_lava_1
   clrf contador_lava_2
   clrf contador_centr_1
   clrf contador_centr_2
   clrf contador_desag_1
   clrf _np_nro_lcd
   clrf _np_nro_msj
   clrf _np_msj_act
   clrf _np_lcd_1
   clrf contador
   clrf programa
   clrf _np_banderas2
   clrf estado_lavado
   clrf contador_gral
   clrf programa_uni
   clrf programa_dec
   clrf programa_cen
   clrf _np_tiempo_inte
   clrf _np_tiempo1_inte
   clrf _np_tiempo2_inte
   clrf _np_tiempo3_inte
   clrf _np_w
   clrf _np_w
   clrf _np_w
   clrf porta
   clrf porte
   movlw b'00000000'                ;configurar el puerto e como xxxxxsss
   bsf status,rp0                   ;cambiar a banco 1
   movwf trise
   movlw b'00000000'                ;configurar el puerto a como ssssssss
   movwf trisa
   bsf status,rp1                   ;cambiar a banco 3
   clrf ansel                       ;puerto a/e = e/s digital
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf portb
   movlw b'11110001'                ;configurar el puerto b como eeeessse
   bsf status,rp0                   ;cambiar a banco 1
   movwf trisb
   bsf status,rp1                   ;cambiar a banco 3
   clrf anselh
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf portc
   movlw b'11110000'                ;configurar el puerto c como eeeessss
   bsf status,rp0                   ;cambiar a banco 1
   movwf trisc
   bcf status,rp0                   ;cambiar a banco 0
   clrf portd
   movlw b'11110000'                ;configurar el puerto d como eeeessss
   bsf status,rp0                   ;cambiar a banco 1
   movwf trisd

   movlw memo_estado                ;leer un dato de eeprom
   bcf status,rp0                   ;cambiar a banco 2
   bsf status,rp1
   movwf eeadr
   bsf status,rp0                   ;cambiar a banco 3
   bcf eecon1,eepgd
   bsf eecon1,rd
   bcf status,rp0                   ;cambiar a banco 2
   movf eedata,w
   bcf status,rp1                   ;cambiar a banco 0
   movwf estado_lavado

   movlw memo_programa              ;leer un dato de eeprom
   bsf status,rp1                   ;cambiar a banco 2
   movwf eeadr
   bsf status,rp0                   ;cambiar a banco 3
   bcf eecon1,eepgd
   bsf eecon1,rd
   bcf status,rp0                   ;cambiar a banco 2
   movf eedata,w
   bcf status,rp1                   ;cambiar a banco 0
   movwf programa
   bsf status,rp0                   ;cambiar a banco 1
   bsf opcion,intedg                ;interrupción rb0. flanco_asc.

   bcf intcon,intf                  ;limpiar la bandera antes de activarla
   bsf intcon,inte                  ;activar interrupción por int.
   bcf intcon,rbif                  ;limpiar la bandera antes de activarla
   bsf intcon,rbie                  ;activar interrupción por rb4-7.
   bsf iocb,iocb4                   ;activar interrupción por cambio en pin b4
   bsf iocb,iocb5                   ;activar interrupción por cambio en pin b5
   bsf iocb,iocb6                   ;activar interrupción por cambio en pin b6
   bsf iocb,iocb7                   ;activar interrupción por cambio en pin b7
   bsf intcon,gie                   ;activar habilitador general de interrupciones.
   movlw b'00000001'
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_nro_lcd
   call lcd_inicio                  ;llamada a rutina lcd_inicio
comienzo
   call rutusr_002                  ;llamada a rutina usr_lcd_pantalla_ini
   movlw .3                         ;temporizador 3 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc
paso14
   btfss banderas_l,seleccionar_prog;si el bit seleccionar_prog = 1
   goto paso17
   movf programa,w                  ;si el reg programa = d'1'
   xorlw d'1'
   btfss status,z
   goto paso85
   call rutusr_009                  ;llamada a rutina usr_programa_1
paso17
   btfss banderas_l,iniciar_lavado  ;si el bit iniciar_lavado = 1
   goto paso84
   bcf banderas_l,iniciar_lavado
   bcf banderas_l,seleccionar_prog  ;no seleccionar programa
   call rutusr_020                  ;llamada a rutina usr_grabar_programa
   bsf porta,ra7                    ;coloca el seguros de la puerta
   movf estado_lavado,w             ;si el reg estado_lavado = d'0'
   xorlw d'0'
   btfss status,z
   goto paso65
paso23
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   btfss banderas_l,prelavado       ;si el bit prelavado = 1
   goto paso25
   call rutusr_003                  ;llamada a rutina usr_deslavado_1
paso25

   incf estado_lavado,1             ;estado_lavado = estado_lavado + 1
estado_1
   call rutusr_019                  ;llamada a rutina usr_grabar_actual
   call rutusr_004                  ;llamada a rutina usr_lavado_01

   incf estado_lavado,1             ;estado_lavado = estado_lavado + 1
estado_2
   call rutusr_019                  ;llamada a rutina usr_grabar_actual
   call rutusr_007                  ;llamada a rutina usr_desagote

   incf estado_lavado,1             ;estado_lavado = estado_lavado + 1
estado_3
   call rutusr_019                  ;llamada a rutina usr_grabar_actual
   call rutusr_006                  ;llamada a rutina usr_enjuague_01

   incf estado_lavado,1             ;estado_lavado = estado_lavado + 1
estado_4
   call rutusr_019                  ;llamada a rutina usr_grabar_actual
   call rutusr_007                  ;llamada a rutina usr_desagote

   incf estado_lavado,1             ;estado_lavado = estado_lavado + 1
estado_5
   call rutusr_019                  ;llamada a rutina usr_grabar_actual
   call rutusr_006                  ;llamada a rutina usr_enjuague_01

   incf estado_lavado,1             ;estado_lavado = estado_lavado + 1
estado_6
   call rutusr_019                  ;llamada a rutina usr_grabar_actual
   call rutusr_007                  ;llamada a rutina usr_desagote

   incf estado_lavado,1             ;estado_lavado = estado_lavado + 1
estado_7
   call rutusr_019                  ;llamada a rutina usr_grabar_actual
   call rutusr_008                  ;llamada a rutina usr_enjuague_02

   incf estado_lavado,1             ;estado_lavado = estado_lavado + 1
estado_8
   call rutusr_019                  ;llamada a rutina usr_grabar_actual
   call rutusr_007                  ;llamada a rutina usr_desagote

   incf estado_lavado,1             ;estado_lavado = estado_lavado + 1
estado_9
   call rutusr_019                  ;llamada a rutina usr_grabar_actual
   call rutusr_005                  ;llamada a rutina usr_centrifugado_01
   clrf estado_lavado
   bcf porta,ra7                    ;quita el seguros de la puerta
   call rutusr_019                  ;llamada a rutina usr_grabar_actual
   goto comienzo
   goto comienzo
paso65
   movf estado_lavado,w             ;si el reg estado_lavado = d'1'
   xorlw d'1'
   btfss status,z
   goto paso67
   org 0x00
   goto paso2
   org 0x04
   movwf _np_w
   swapf _np_w,1
   movf status,w
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_status
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_tiempo,w
   movwf _np_t_bak
   movf _np_tiempo1,w
   movwf _np_t1_bak
   movf _np_tiempo2,w
   movwf _np_t2_bak
   movf _np_tiempo3,w
   movwf _np_t3_bak
   btfsc intcon,rbif
   goto inte_rb0a7
   btfsc intcon,intf
   goto inte_rb0
salir_interrupcion
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf _np_banderas2,sub_inte       ;activar la bandera de rutina cancelada por interrupcion
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_t_bak,w
   movwf _np_tiempo
   movf _np_t1_bak,w
   movwf _np_tiempo1
   movf _np_t2_bak,w
   movwf _np_tiempo2
   movf _np_t3_bak,w
   movwf _np_tiempo3
   movf _np_status,w 
   movwf status
   swapf _np_w,w 
   retfie

_np_tabla_teclado
   movf _np_indice,0
   movwf _np_temp1
   movlw low _np_tabla_teclado_tabla
   addwf _np_temp1,1
   movlw high _np_tabla_teclado_tabla
   btfsc status,c
   addlw .1
   movwf pclath
   movf _np_indice,0
   call _np_tabla_teclado_tabla
   movwf _np_resultado
   return

_np_tabla_teclado_tabla
   addwf pcl,1
   retlw 0x00                       ; 0
   retlw 0x01                       ; 1
   retlw 0x02                       ; 2
   retlw 0x03                       ; 3
   retlw 0xf1                       ; f1
   retlw 0x04                       ; 4
   retlw 0x05                       ; 5
   retlw 0x06                       ; 6
   retlw 0xf2                       ; f2
   retlw 0x07                       ; 7
   retlw 0x08                       ; 8
   retlw 0x09                       ; 9
   retlw 0xf3                       ; f3
   retlw 0x13                       ; *
   retlw 0x00                       ; 0
   retlw 0x14                       ; #
   retlw 0xf4                       ; f4


   ;------------------------------------------------------------
   ;                      inicio de la interrupción por rb0 a 7
   ;------------------------------------------------------------
inte_rb0a7_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf portb,w
   bcf intcon,rbif
   goto salir_interrupcion
inte_rb0a7
   call teclado_matricial           ;llamada a rutina teclado_matricial
   movf _np_resultado,w
   movwf valor_tecla
   movlw d'17'                      ;si el reg valor_tecla < d'17'
   subwf valor_tecla,w
   btfsc status,c
   goto inte_rb0a7_salir
   movf valor_tecla,w               ;consultar la tabla_np_tabla_teclado
   movwf _np_indice
   call _np_tabla_teclado           ;llamada a rutina _np_tabla_teclado
   movf _np_resultado,w
   movwf valor_tecla
   movf valor_tecla,w               ;si el reg valor_tecla = 0x13
   xorlw 0x13
   btfss status,z
   goto inte_rb0a78
   bsf banderas_l,iniciar_lavado    ;da comienzo al lavado
inte_rb0a77
   goto inte_rb0a7_salir
inte_rb0a78
   movf valor_tecla,w               ;si el reg valor_tecla = 0x14
   xorlw 0x14
   btfss status,z
   goto inte_rb0a710
   bsf banderas_l,seleccionar_prog  ;ingresa a la rutina de selección de programa.
   goto inte_rb0a7_salir
inte_rb0a710
   btfss banderas_l,seleccionar_prog;si el bit seleccionar_prog = 1
   goto inte_rb0a7_salir
   movf valor_tecla,w
   movwf programa
   ;convertir un registro a bcd
inte_rb0a712_inte
   movf programa,w
   movwf _np_temp1
   call conv_8_bcd                  ;llamada a rutina conv_8_bcd
   btfsc _np_banderas2,sub_inte     ;si la subrutina fue cancelada por una interrupcion
   goto inte_rb0a712_inte           ;ejecutar la rutina nuevamente
   movf _np_temp1,w
   movwf programa_uni
   movf _np_temp2,w
   movwf programa_dec
   movf _np_temp3,w
   movwf programa_cen
   call rutusr_022                  ;llamada a rutina usr_lcd_seleccionado

   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf portd,7                      ;inhabilitar el teclado
   bsf status,rp0                   ;cambiar a banco 1
   bcf trisb,7                      ;configurar los pines b4 al 7 como salida
   bcf trisb,6
   bcf trisb,5
   bcf trisb,4
   movlw b'11001101'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movlw b'11001101'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movf programa_dec,w              ;enviar la variable programa_dec al lcd.
   addlw .48
   call lcd_caracter                ;llamada a rutina lcd_caracter
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisb,4                      ;configurar los pines b4 al 7 como entrada
   bsf trisb,5
   bsf trisb,6
   bsf trisb,7
   bcf status,rp0                   ;cambiar a banco 0
   bcf portd,7                      ;habilitar el teclado

   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf portd,7                      ;inhabilitar el teclado
   bsf status,rp0                   ;cambiar a banco 1
   bcf trisb,7                      ;configurar los pines b4 al 7 como salida
   bcf trisb,6
   bcf trisb,5
   bcf trisb,4
   movlw b'11001110'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movlw b'11001110'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movf programa_uni,w              ;enviar la variable programa_uni al lcd.
   addlw .48
   call lcd_caracter                ;llamada a rutina lcd_caracter
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisb,4                      ;configurar los pines b4 al 7 como entrada
   bsf trisb,5
   bsf trisb,6
   bsf trisb,7
   bcf status,rp0                   ;cambiar a banco 0
   bcf portd,7                      ;habilitar el teclado
   movlw .3                         ;temporizador 3 seg
   call tmp_1_mgc_i                 ;llamada a rutina tmp_1_mgc_i
   goto inte_rb0a7_salir

   ;------------------------------------------------------------
   ;                      inicio de la interrupción por rb0
   ;------------------------------------------------------------
inte_rb0_salir
   bcf intcon,intf
   goto salir_interrupcion
inte_rb0
inte_rb02
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   btfss portc,rc7                  ;si el bit rc7 = 1
   goto inte_rb07
   call rutusr_021                  ;llamada a rutina usr_lcd_errores

   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf portd,7                      ;inhabilitar el teclado
   bsf status,rp0                   ;cambiar a banco 1
   bcf trisb,7                      ;configurar los pines b4 al 7 como salida
   bcf trisb,6
   bcf trisb,5
   bcf trisb,4
   movlw b'11000000'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movlw .68                        ;d
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .105                       ;i
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .115                       ;s
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .112                       ;p
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .101                       ;e
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .110                       ;n
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .115                       ;s
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .101                       ;e
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .114                       ;r
   call lcd_caracter                ;llamada a rutina lcd_caracter
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisb,4                      ;configurar los pines b4 al 7 como entrada
   bsf trisb,5
   bsf trisb,6
   bsf trisb,7
   bcf status,rp0                   ;cambiar a banco 0
   bcf portd,7                      ;habilitar el teclado
inte_rb05
   btfss banderas_l,iniciar_lavado  ;si el bit iniciar_lavado = 1
   goto inte_rb02                   ;cierra el ciclo
   goto inte_rb0_salir
inte_rb07
   btfss portc,rc6                  ;si el bit rc6 = 1
   goto inte_rb010
   call rutusr_021                  ;llamada a rutina usr_lcd_errores

   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf portd,7                      ;inhabilitar el teclado
   bsf status,rp0                   ;cambiar a banco 1
   bcf trisb,7                      ;configurar los pines b4 al 7 como salida
   bcf trisb,6
   bcf trisb,5
   bcf trisb,4
   movlw b'11000000'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movlw .77                        ;m
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .111                       ;o
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .116                       ;t
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .111                       ;o
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .114                       ;r
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .32                        ;espacio
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .99                        ;c
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .101                       ;e
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .110                       ;n
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .116                       ;t
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .114                       ;r
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .97                        ;a
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .108                       ;l
   call lcd_caracter                ;llamada a rutina lcd_caracter
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisb,4                      ;configurar los pines b4 al 7 como entrada
   bsf trisb,5
   bsf trisb,6
   bsf trisb,7
   bcf status,rp0                   ;cambiar a banco 0
   bcf portd,7                      ;habilitar el teclado
   goto inte_rb05                   ;cierra el ciclo
inte_rb010
   btfss portc,rc5                  ;si el bit rc5 = 1
   goto inte_rb013
   call rutusr_021                  ;llamada a rutina usr_lcd_errores

   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf portd,7                      ;inhabilitar el teclado
   bsf status,rp0                   ;cambiar a banco 1
   bcf trisb,7                      ;configurar los pines b4 al 7 como salida
   bcf trisb,6
   bcf trisb,5
   bcf trisb,4
   movlw b'11000000'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movlw .77                        ;m
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .111                       ;o
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .116                       ;t
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .111                       ;o
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .114                       ;r
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .32                        ;espacio
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .68                        ;d
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .101                       ;e
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .115                       ;s
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .97                        ;a
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .103                       ;g
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .111                       ;o
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .116                       ;t
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .101                       ;e
   call lcd_caracter                ;llamada a rutina lcd_caracter
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisb,4                      ;configurar los pines b4 al 7 como entrada
   bsf trisb,5
   bsf trisb,6
   bsf trisb,7
   bcf status,rp0                   ;cambiar a banco 0
   bcf portd,7                      ;habilitar el teclado
   goto inte_rb05                   ;cierra el ciclo
inte_rb013
   btfss portc,rc4                  ;si el bit rc4 = 1
   goto inte_rb016
   call rutusr_021                  ;llamada a rutina usr_lcd_errores

   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf portd,7                      ;inhabilitar el teclado
   bsf status,rp0                   ;cambiar a banco 1
   bcf trisb,7                      ;configurar los pines b4 al 7 como salida
   bcf trisb,6
   bcf trisb,5
   bcf trisb,4
   movlw b'11000000'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movlw .80                        ;p
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .114                       ;r
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .111                       ;o
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .103                       ;g
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .114                       ;r
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .97                        ;a
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .109                       ;m
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .97                        ;a
   call lcd_caracter                ;llamada a rutina lcd_caracter
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisb,4                      ;configurar los pines b4 al 7 como entrada
   bsf trisb,5
   bsf trisb,6
   bsf trisb,7
   bcf status,rp0                   ;cambiar a banco 0
   bcf portd,7                      ;habilitar el teclado
   goto inte_rb05                   ;cierra el ciclo
inte_rb016
   movlw .3                         ;temporizador 3 seg
   call tmp_1_mgc_i                 ;llamada a rutina tmp_1_mgc_i
   goto inte_rb05                   ;cierra el ciclo

;------------------------------------------------------------
;                      programa principal
;------------------------------------------------------------
paso23
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   btfss banderas_l,prelavado       ;si el bit prelavado = 1
   goto paso25
   call rutusr_003                  ;llamada a rutina usr_deslavado_1
paso25

   incf estado_lavado,1             ;estado_lavado = estado_lavado + 1
estado_1
   call rutusr_019                  ;llamada a rutina usr_grabar_actual
   call rutusr_004                  ;llamada a rutina usr_lavado_01

   incf estado_lavado,1             ;estado_lavado = estado_lavado + 1
estado_2
   call rutusr_019                  ;llamada a rutina usr_grabar_actual
   call rutusr_007                  ;llamada a rutina usr_desagote

   incf estado_lavado,1             ;estado_lavado = estado_lavado + 1
estado_3
   call rutusr_019                  ;llamada a rutina usr_grabar_actual
   call rutusr_006                  ;llamada a rutina usr_enjuague_01

   incf estado_lavado,1             ;estado_lavado = estado_lavado + 1
estado_4
   call rutusr_019                  ;llamada a rutina usr_grabar_actual
   call rutusr_007                  ;llamada a rutina usr_desagote

   incf estado_lavado,1             ;estado_lavado = estado_lavado + 1
estado_5
   call rutusr_019                  ;llamada a rutina usr_grabar_actual
   call rutusr_006                  ;llamada a rutina usr_enjuague_01

   incf estado_lavado,1             ;estado_lavado = estado_lavado + 1
estado_6
   call rutusr_019                  ;llamada a rutina usr_grabar_actual
   call rutusr_007                  ;llamada a rutina usr_desagote

   incf estado_lavado,1             ;estado_lavado = estado_lavado + 1
estado_7
   call rutusr_019                  ;llamada a rutina usr_grabar_actual
   call rutusr_008                  ;llamada a rutina usr_enjuague_02

   incf estado_lavado,1             ;estado_lavado = estado_lavado + 1
estado_8
   call rutusr_019                  ;llamada a rutina usr_grabar_actual
   call rutusr_007                  ;llamada a rutina usr_desagote

   incf estado_lavado,1             ;estado_lavado = estado_lavado + 1
estado_9
   call rutusr_019                  ;llamada a rutina usr_grabar_actual
   call rutusr_005                  ;llamada a rutina usr_centrifugado_01
   clrf estado_lavado
   bcf porta,ra7                    ;quita el seguros de la puerta
   call rutusr_019                  ;llamada a rutina usr_grabar_actual
   goto comienzo
   goto comienzo


;------------------------------------------------------------
;                  Declaración de Subrutinas
;------------------------------------------------------------

; usr_lcd_seleccionado
rutusr_022
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf _np_est_inte
   btfsc intcon,gie
   incf _np_est_inte,1
   bcf intcon,gie                   ;desactivar habilitador general de interrupciones.
   bsf portd,7                      ;inhabilitar el teclado
   bsf status,rp0                   ;cambiar a banco 1
   bcf trisb,7                      ;configurar los pines b4 al 7 como salida
   bcf trisb,6
   bcf trisb,5
   bcf trisb,4
   movlw .3
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_nro_msj
   call lcd_mensaje_actual          ;llamada a rutina lcd_mensaje_actual
   btfss _np_msj_act,0
   goto rutusr_022_2_nc
   movlw b'00001100'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movlw b'00000001'
   call lcd_comando                 ;llamada a rutina lcd_comando
rutusr_022_2_nc
   movlw b'10000001'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movlw .83                        ;s
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .69                        ;e
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .32                        ;espacio
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .83                        ;s
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .69                        ;e
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .76                        ;l
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .69                        ;e
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .67                        ;c
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .67                        ;c
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .73                        ;i
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .79                        ;o
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .78                        ;n
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .79                        ;o
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .58                        ;:
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw b'11000010'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movlw .80                        ;p
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .114                       ;r
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .111                       ;o
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .103                       ;g
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .114                       ;r
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .97                        ;a
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .109                       ;m
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .97                        ;a
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .32                        ;espacio
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .78                        ;n
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .138                       ;º
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .32                        ;espacio
   call lcd_caracter                ;llamada a rutina lcd_caracter
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisb,4                      ;configurar los pines b4 al 7 como entrada
   bsf trisb,5
   bsf trisb,6
   bsf trisb,7
   bcf status,rp0                   ;cambiar a banco 0
   bcf portd,7                      ;habilitar el teclado
   btfsc _np_est_inte,0
   bsf intcon,gie                   ;activar habilitador general de interrupciones.
rutusr_022_3
   goto rutusr_022_salir
rutusr_022_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


; usr_lcd_errores
rutusr_021
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf _np_est_inte
   btfsc intcon,gie
   incf _np_est_inte,1
   bcf intcon,gie                   ;desactivar habilitador general de interrupciones.
   bsf portd,7                      ;inhabilitar el teclado
   bsf status,rp0                   ;cambiar a banco 1
   bcf trisb,7                      ;configurar los pines b4 al 7 como salida
   bcf trisb,6
   bcf trisb,5
   bcf trisb,4
   movlw .2
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_nro_msj
   call lcd_mensaje_actual          ;llamada a rutina lcd_mensaje_actual
   btfss _np_msj_act,0
   goto rutusr_021_2_nc
   movlw b'00001100'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movlw b'00000001'
   call lcd_comando                 ;llamada a rutina lcd_comando
rutusr_021_2_nc
   movlw b'10000000'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movlw .69                        ;e
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .82                        ;r
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .82                        ;r
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .79                        ;o
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .82                        ;r
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .32                        ;espacio
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .69                        ;e
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .78                        ;n
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .32                        ;espacio
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .70                        ;f
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .85                        ;u
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .78                        ;n
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .67                        ;c
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .73                        ;i
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .79                        ;o
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .78                        ;n
   call lcd_caracter                ;llamada a rutina lcd_caracter
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisb,4                      ;configurar los pines b4 al 7 como entrada
   bsf trisb,5
   bsf trisb,6
   bsf trisb,7
   bcf status,rp0                   ;cambiar a banco 0
   bcf portd,7                      ;habilitar el teclado
   btfsc _np_est_inte,0
   bsf intcon,gie                   ;activar habilitador general de interrupciones.
rutusr_021_3
   goto rutusr_021_salir
rutusr_021_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


; usr_lcd_pantalla_ini
rutusr_002
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf _np_est_inte
   btfsc intcon,gie
   incf _np_est_inte,1
   bcf intcon,gie                   ;desactivar habilitador general de interrupciones.
   bsf portd,7                      ;inhabilitar el teclado
   bsf status,rp0                   ;cambiar a banco 1
   bcf trisb,7                      ;configurar los pines b4 al 7 como salida
   bcf trisb,6
   bcf trisb,5
   bcf trisb,4
   movlw .1
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_nro_msj
   call lcd_mensaje_actual          ;llamada a rutina lcd_mensaje_actual
   btfss _np_msj_act,0
   goto rutusr_002_2_nc
   movlw b'00001100'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movlw b'00000001'
   call lcd_comando                 ;llamada a rutina lcd_comando
rutusr_002_2_nc
   movlw b'10000000'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movlw .42                        ;*
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .58                        ;:
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .73                        ;i
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .78                        ;n
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .73                        ;i
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .67                        ;c
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .73                        ;i
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .65                        ;a
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .82                        ;r
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .32                        ;espacio
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .76                        ;l
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .65                        ;a
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .86                        ;v
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .65                        ;a
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .68                        ;d
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .79                        ;o
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw b'11000000'
   call lcd_comando                 ;llamada a rutina lcd_comando
   movlw .35                        ;#
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .58                        ;:
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .69                        ;e
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .76                        ;l
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .73                        ;i
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .71                        ;g
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .69                        ;e
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .32                        ;espacio
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .80                        ;p
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .82                        ;r
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .79                        ;o
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .71                        ;g
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .82                        ;r
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .65                        ;a
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .77                        ;m
   call lcd_caracter                ;llamada a rutina lcd_caracter
   movlw .65                        ;a
   call lcd_caracter                ;llamada a rutina lcd_caracter
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisb,4                      ;configurar los pines b4 al 7 como entrada
   bsf trisb,5
   bsf trisb,6
   bsf trisb,7
   bcf status,rp0                   ;cambiar a banco 0
   bcf portd,7                      ;habilitar el teclado
   btfsc _np_est_inte,0
   bsf intcon,gie                   ;activar habilitador general de interrupciones.
rutusr_002_3
   goto rutusr_002_salir
rutusr_002_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


; usr_programa_1
rutusr_009
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf contador_prela              ;determina el timpo por repeticiones
   clrf contador_lava_1             ;determina el timpo por repeticiones
   clrf contador_lava_2             ;determina el timpo por repeticiones
   clrf contador_centr_1            ;determina el timpo por repeticiones
   clrf contador_centr_2            ;determina el timpo por repeticiones
   clrf contador_desag_1            ;determina el timpo por repeticiones
   clrf contador_enjua_1            ;determina el timpo por repeticiones
   clrf contador_enjua_2            ;determina el timpo por repeticiones
   clrf contador_enjua_3            ;determina el timpo por repeticiones
   clrf contador_enjua_4            ;determina el timpo por repeticiones
   bcf banderas_l,media_carga       ;se ejecuta o no con media carga. 1= si
rutusr_009_13
   goto rutusr_009_salir
rutusr_009_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


; usr_programa_2
rutusr_010
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf contador_prela              ;determina el timpo por repeticiones
   clrf contador_lava_1             ;determina el timpo por repeticiones
   clrf contador_lava_2             ;determina el timpo por repeticiones
   clrf contador_centr_1            ;determina el timpo por repeticiones
   clrf contador_centr_2            ;determina el timpo por repeticiones
   clrf contador_desag_1            ;determina el timpo por repeticiones
   clrf contador_enjua_1            ;determina el timpo por repeticiones
   clrf contador_enjua_2            ;determina el timpo por repeticiones
   clrf contador_enjua_3            ;determina el timpo por repeticiones
   clrf contador_enjua_4            ;determina el timpo por repeticiones
   bcf banderas_l,media_carga       ;se ejecuta o no con media carga. 1= si
rutusr_010_13
   goto rutusr_010_salir
rutusr_010_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


; usr_programa_3
rutusr_011
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf contador_prela              ;determina el timpo por repeticiones
   clrf contador_lava_1             ;determina el timpo por repeticiones
   clrf contador_lava_2             ;determina el timpo por repeticiones
   clrf contador_centr_1            ;determina el timpo por repeticiones
   clrf contador_centr_2            ;determina el timpo por repeticiones
   clrf contador_desag_1            ;determina el timpo por repeticiones
   clrf contador_enjua_1            ;determina el timpo por repeticiones
   clrf contador_enjua_2            ;determina el timpo por repeticiones
   clrf contador_enjua_3            ;determina el timpo por repeticiones
   clrf contador_enjua_4            ;determina el timpo por repeticiones
   bcf banderas_l,media_carga       ;se ejecuta o no con media carga. 1= si
rutusr_011_13
   goto rutusr_011_salir
rutusr_011_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


; usr_programa_4
rutusr_012
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf contador_prela              ;determina el timpo por repeticiones
   clrf contador_lava_1             ;determina el timpo por repeticiones
   clrf contador_lava_2             ;determina el timpo por repeticiones
   clrf contador_centr_1            ;determina el timpo por repeticiones
   clrf contador_centr_2            ;determina el timpo por repeticiones
   clrf contador_desag_1            ;determina el timpo por repeticiones
   clrf contador_enjua_1            ;determina el timpo por repeticiones
   clrf contador_enjua_2            ;determina el timpo por repeticiones
   clrf contador_enjua_3            ;determina el timpo por repeticiones
   clrf contador_enjua_4            ;determina el timpo por repeticiones
   bcf banderas_l,media_carga       ;se ejecuta o no con media carga. 1= si
rutusr_012_13
   goto rutusr_012_salir
rutusr_012_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


; usr_programa_5
rutusr_013
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf contador_prela              ;determina el timpo por repeticiones
   clrf contador_lava_1             ;determina el timpo por repeticiones
   clrf contador_lava_2             ;determina el timpo por repeticiones
   clrf contador_centr_1            ;determina el timpo por repeticiones
   clrf contador_centr_2            ;determina el timpo por repeticiones
   clrf contador_desag_1            ;determina el timpo por repeticiones
   clrf contador_enjua_1            ;determina el timpo por repeticiones
   clrf contador_enjua_2            ;determina el timpo por repeticiones
   clrf contador_enjua_3            ;determina el timpo por repeticiones
   clrf contador_enjua_4            ;determina el timpo por repeticiones
   bcf banderas_l,media_carga       ;se ejecuta o no con media carga. 1= si
rutusr_013_13
   goto rutusr_013_salir
rutusr_013_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


; usr_programa_6
rutusr_014
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf contador_prela              ;determina el timpo por repeticiones
   clrf contador_lava_1             ;determina el timpo por repeticiones
   clrf contador_lava_2             ;determina el timpo por repeticiones
   clrf contador_centr_1            ;determina el timpo por repeticiones
   clrf contador_centr_2            ;determina el timpo por repeticiones
   clrf contador_desag_1            ;determina el timpo por repeticiones
   clrf contador_enjua_1            ;determina el timpo por repeticiones
   clrf contador_enjua_2            ;determina el timpo por repeticiones
   clrf contador_enjua_3            ;determina el timpo por repeticiones
   clrf contador_enjua_4            ;determina el timpo por repeticiones
   bcf banderas_l,media_carga       ;se ejecuta o no con media carga. 1= si
rutusr_014_13
   goto rutusr_014_salir
rutusr_014_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


; usr_programa_7
rutusr_015
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf contador_prela              ;determina el timpo por repeticiones
   clrf contador_lava_1             ;determina el timpo por repeticiones
   clrf contador_lava_2             ;determina el timpo por repeticiones
   clrf contador_centr_1            ;determina el timpo por repeticiones
   clrf contador_centr_2            ;determina el timpo por repeticiones
   clrf contador_desag_1            ;determina el timpo por repeticiones
   clrf contador_enjua_1            ;determina el timpo por repeticiones
   clrf contador_enjua_2            ;determina el timpo por repeticiones
   clrf contador_enjua_3            ;determina el timpo por repeticiones
   clrf contador_enjua_4            ;determina el timpo por repeticiones
   bcf banderas_l,media_carga       ;se ejecuta o no con media carga. 1= si
rutusr_015_13
   goto rutusr_015_salir
rutusr_015_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


; usr_programa_8
rutusr_016
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf contador_prela              ;determina el timpo por repeticiones
   clrf contador_lava_1             ;determina el timpo por repeticiones
   clrf contador_lava_2             ;determina el timpo por repeticiones
   clrf contador_centr_1            ;determina el timpo por repeticiones
   clrf contador_centr_2            ;determina el timpo por repeticiones
   clrf contador_desag_1            ;determina el timpo por repeticiones
   clrf contador_enjua_1            ;determina el timpo por repeticiones
   clrf contador_enjua_2            ;determina el timpo por repeticiones
   clrf contador_enjua_3            ;determina el timpo por repeticiones
   clrf contador_enjua_4            ;determina el timpo por repeticiones
   bcf banderas_l,media_carga       ;se ejecuta o no con media carga. 1= si
rutusr_016_13
   goto rutusr_016_salir
rutusr_016_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


; usr_programa_9
rutusr_017
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf contador_prela              ;determina el timpo por repeticiones
   clrf contador_lava_1             ;determina el timpo por repeticiones
   clrf contador_lava_2             ;determina el timpo por repeticiones
   clrf contador_centr_1            ;determina el timpo por repeticiones
   clrf contador_centr_2            ;determina el timpo por repeticiones
   clrf contador_desag_1            ;determina el timpo por repeticiones
   clrf contador_enjua_1            ;determina el timpo por repeticiones
   clrf contador_enjua_2            ;determina el timpo por repeticiones
   clrf contador_enjua_3            ;determina el timpo por repeticiones
   clrf contador_enjua_4            ;determina el timpo por repeticiones
   bcf banderas_l,media_carga       ;se ejecuta o no con media carga. 1= si
rutusr_017_13
   goto rutusr_017_salir
rutusr_017_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


; usr_grabar_programa
rutusr_020
   movlw memo_programa              ;grabar un dato en eeprom
   bcf status,rp0                   ;cambiar a banco 2
   bsf status,rp1
   movwf eeadr
   bcf status,rp1                   ;cambiar a banco 0
   movf programa,w
   bsf status,rp1                   ;cambiar a banco 2
   movwf eedata
   call grabar_eeprom               ;llamada a rutina grabar_eeprom
rutusr_020_3
   goto rutusr_020_salir
rutusr_020_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


; usr_deslavado_1
rutusr_003
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf contador
   clrf contador_gral
   bsf porta,ra2                    ;ingreso de agua
   btfss banderas_l,media_carga     ;si el bit media_carga = 1
   goto rutusr_003_28
rutusr_003_6
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   btfss portd,rd7                  ;si el bit rd7 = 1
   goto rutusr_003_27
rutusr_003_7
   bcf porta,ra2                    ;ingreso de agua terminado
   btfss portd,rd4                  ;si el bit rd4 = 1
   goto rutusr_003_10
   bsf porte,re0                    ;calefactor encendido
rutusr_003_10
   bsf portc,rc0                    ;motor giro lento encendido
rutusr_003_11
   movf contador_gral,w             ;si el reg contador_gral <= contador_prela
   subwf contador_prela,w
   btfss status,c
   goto rutusr_003_24
   clrf contador

   incf contador_gral,1             ;contador_gral = contador_gral + 1
rutusr_003_14
   movf contador,w                  ;si el reg contador <= d'2'
   sublw d'2'
   btfss status,c
   goto rutusr_003_11               ;cierra el ciclo
   bsf porta,ra5                    ;motor giro derecho
   movlw .3                         ;temporizador 3 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc
   bcf porta,ra5                    ;motor giro derecho
   movlw .12                        ;temporizador 12 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc
   bsf porta,ra4_t0cki              ;motor giro izquierdo
   movlw .3                         ;temporizador 3 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc
   bcf porta,ra4_t0cki              ;motor giro izquierdo detenido
   movlw .12                        ;temporizador 12 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc

   incf contador,1                  ;contador = contador + 1
   goto rutusr_003_14               ;cierra el ciclo
rutusr_003_24
   bcf porte,re0                    ;calefactor apagado
   bcf portc,rc0                    ;motor giro lento apagado
rutusr_003_26
   goto rutusr_003_salir
   goto rutusr_003_10               ;cierra el ciclo
rutusr_003_27
   nop
   goto rutusr_003_6                ;cierra el ciclo
rutusr_003_28
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   btfsc portd,rd6                  ;si el bit rd6 = 0
   goto rutusr_003_7                ;cierra el ciclo
   goto rutusr_003_29
rutusr_003_29
   nop
   goto rutusr_003_28               ;cierra el ciclo
rutusr_003_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


; usr_grabar_actual
rutusr_019
   movlw memo_estado                ;grabar un dato en eeprom
   bcf status,rp0                   ;cambiar a banco 2
   bsf status,rp1
   movwf eeadr
   bcf status,rp1                   ;cambiar a banco 0
   movf estado_lavado,w
   bsf status,rp1                   ;cambiar a banco 2
   movwf eedata
   call grabar_eeprom               ;llamada a rutina grabar_eeprom
rutusr_019_3
   goto rutusr_019_salir
rutusr_019_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


; usr_lavado_01
rutusr_004
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf contador
   clrf contador_gral
   btfss banderas_l,prelavado       ;si el bit prelavado = 1
   goto rutusr_004_30
rutusr_004_5
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   btfss banderas_l,media_carga     ;si el bit media_carga = 1
   goto rutusr_004_28
rutusr_004_6
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   btfss portd,rd7                  ;si el bit rd7 = 1
   goto rutusr_004_27
rutusr_004_7
   bcf porta,ra2                    ;ingreso de agua terminado
   btfss portd,rd4                  ;si el bit rd4 = 1
   goto rutusr_004_10
   bsf porte,re0                    ;calefactor encendido
rutusr_004_10
   bsf portc,rc1                    ;motor giro normal encendido
   movf contador_gral,w             ;si el reg contador_gral <= contador_lava_1
   subwf contador_lava_1,w
   btfss status,c
   goto rutusr_004_24
rutusr_004_12

   incf contador_gral,1             ;contador_gral = contador_gral + 1
   clrf contador
rutusr_004_14
   movf contador,w                  ;si el reg contador <= d'2'
   sublw d'2'
   btfss status,c
   goto rutusr_004_12               ;cierra el ciclo
   bsf porta,ra5                    ;motor giro derecho
   movlw .10                        ;temporizador 10 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc
   bcf porta,ra5                    ;motor giro derecho
   movlw .5                         ;temporizador 5 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc
   bsf porta,ra4_t0cki              ;motor giro izquierdo
   movlw .10                        ;temporizador 10 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc
   bcf porta,ra4_t0cki              ;motor giro izquierdo detenido
   movlw .5                         ;temporizador 5 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc

   incf contador,1                  ;contador = contador + 1
   goto rutusr_004_14               ;cierra el ciclo
rutusr_004_24
   bcf porte,re0                    ;calefactor apagado
   bcf portc,rc1                    ;motor giro normal apagado
rutusr_004_26
   goto rutusr_004_salir
   goto rutusr_004_10               ;cierra el ciclo
rutusr_004_27
   nop
   goto rutusr_004_6                ;cierra el ciclo
rutusr_004_28
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   btfsc portd,rd6                  ;si el bit rd6 = 0
   goto rutusr_004_7                ;cierra el ciclo
   goto rutusr_004_29
rutusr_004_29
   nop
   goto rutusr_004_28               ;cierra el ciclo
rutusr_004_30
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf porta,ra2                    ;ingreso de agua
   goto rutusr_004_5                ;cierra el ciclo
rutusr_004_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


; usr_desagote
rutusr_007
rutusr_007_2
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   btfss portd,rd7                  ;si el bit rd7 = 1
   goto rutusr_007_5
   bsf porte,re1                    ;desagote de agua
   movlw .3                         ;temporizador 3 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc
   goto rutusr_007_2                ;cierra el ciclo
rutusr_007_5
   movlw .10                        ;temporizador 10 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc
   bcf porte,re1                    ;desagote de agua
rutusr_007_7
   goto rutusr_007_salir
rutusr_007_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


; usr_enjuague_01
rutusr_006
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf contador_gral
   clrf contador
   bsf porta,ra2                    ;ingreso de agua
   btfss banderas_l,media_carga     ;si el bit media_carga = 1
   goto rutusr_006_25
rutusr_006_6
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   btfss portd,rd7                  ;si el bit rd7 = 1
   goto rutusr_006_24
rutusr_006_7
   bcf porta,ra2                    ;ingreso de agua terminado
   bsf portc,rc1                    ;motor giro normal encendido
rutusr_006_9
   movf contador_gral,w             ;si el reg contador_gral <= contador_enjua_1
   subwf contador_enjua_1,w
   btfss status,c
   goto rutusr_006_22

   incf contador_gral,1             ;contador_gral = contador_gral + 1
   clrf contador
rutusr_006_12
   movf contador,w                  ;si el reg contador <= d'2'
   sublw d'2'
   btfss status,c
   goto rutusr_006_9                ;cierra el ciclo
   bsf porta,ra5                    ;motor giro derecho
   movlw .10                        ;temporizador 10 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc
   bcf porta,ra5                    ;motor giro derecho
   movlw .5                         ;temporizador 5 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc
   bsf porta,ra4_t0cki              ;motor giro izquierdo
   movlw .10                        ;temporizador 10 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc
   bcf porta,ra4_t0cki              ;motor giro izquierdo detenido
   movlw .5                         ;temporizador 5 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc

   incf contador,1                  ;contador = contador + 1
   goto rutusr_006_12               ;cierra el ciclo
rutusr_006_22
   bcf portc,rc1                    ;motor giro normal apagado
rutusr_006_23
   goto rutusr_006_salir
rutusr_006_24
   nop
   goto rutusr_006_6                ;cierra el ciclo
rutusr_006_25
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   btfsc portd,rd6                  ;si el bit rd6 = 0
   goto rutusr_006_7                ;cierra el ciclo
   goto rutusr_006_26
rutusr_006_26
   nop
   goto rutusr_006_25               ;cierra el ciclo
rutusr_006_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


; usr_enjuague_02
rutusr_008
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf contador
   clrf contador_gral
   bsf porta,ra3                    ;ingreso de suavizante
   btfss banderas_l,media_carga     ;si el bit media_carga = 1
   goto rutusr_008_25
rutusr_008_6
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   btfss portd,rd7                  ;si el bit rd7 = 1
   goto rutusr_008_24
rutusr_008_7
   bcf porta,ra3                    ;ingreso de suavizante terminado
   bsf portc,rc1                    ;motor giro normal encendido
rutusr_008_9
   movf contador_gral,w             ;si el reg contador_gral <= contador_enjua_2
   subwf contador_enjua_2,w
   btfss status,c
   goto rutusr_008_22

   incf contador_gral,1             ;contador_gral = contador_gral + 1
   clrf contador
rutusr_008_12
   movf contador,w                  ;si el reg contador <= d'2'
   sublw d'2'
   btfss status,c
   goto rutusr_008_9                ;cierra el ciclo
   bsf porta,ra5                    ;motor giro derecho
   movlw .10                        ;temporizador 10 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc
   bcf porta,ra5                    ;motor giro derecho
   movlw .5                         ;temporizador 5 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc
   bsf porta,ra4_t0cki              ;motor giro izquierdo
   movlw .10                        ;temporizador 10 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc
   bcf porta,ra4_t0cki              ;motor giro izquierdo detenido
   movlw .5                         ;temporizador 5 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc

   incf contador,1                  ;contador = contador + 1
   goto rutusr_008_12               ;cierra el ciclo
rutusr_008_22
   bcf portc,rc1                    ;motor giro normal apagado
rutusr_008_23
   goto rutusr_008_salir
rutusr_008_24
   nop
   goto rutusr_008_6                ;cierra el ciclo
rutusr_008_25
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   btfsc portd,rd6                  ;si el bit rd6 = 0
   goto rutusr_008_7                ;cierra el ciclo
   goto rutusr_008_26
rutusr_008_26
   nop
   goto rutusr_008_25               ;cierra el ciclo
rutusr_008_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


; usr_centrifugado_01
rutusr_005
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf contador
   clrf contador_gral
   bsf portc,rc0                    ;motor giro lento encendido
rutusr_005_5
   movf contador_gral,w             ;si el reg contador_gral <= contador_centr_1
   subwf contador_centr_1,w
   btfss status,c
   goto rutusr_005_18

   incf contador_gral,1             ;contador_gral = contador_gral + 1
   clrf contador
rutusr_005_8
   movf contador,w                  ;si el reg contador <= d'2'
   sublw d'2'
   btfss status,c
   goto rutusr_005_5                ;cierra el ciclo
   bsf porta,ra5                    ;motor giro derecho
   movlw .3                         ;temporizador 3 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc
   bcf porta,ra5                    ;motor giro derecho
   movlw .12                        ;temporizador 12 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc
   bsf porta,ra4_t0cki              ;motor giro izquierdo
   movlw .3                         ;temporizador 3 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc
   bcf porta,ra4_t0cki              ;motor giro izquierdo detenido
   movlw .12                        ;temporizador 12 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc

   incf contador,1                  ;contador = contador + 1
   goto rutusr_005_8                ;cierra el ciclo
rutusr_005_18
   bcf portc,rc0                    ;motor giro lento apagado
   movlw .3                         ;temporizador 3 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc
   bsf porte,re2                    ;centrifugado
   bsf porte,re1                    ;desagote habilitado
   movlw .255                       ;temporizador 255 seg
   call tmp_1_mgc                   ;llamada a rutina tmp_1_mgc
   bcf porte,re1                    ;desagote detenido
   bcf porte,re2                    ;centrifugado
rutusr_005_25
   goto rutusr_005_salir
rutusr_005_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


teclado_matricial
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf porta,0
   bcf portb,1
   bcf portb,2
   bcf portb,3
   clrf _np_temp2
teclado_matricial_t
   incf _np_temp2,1
   btfss status,z
   goto teclado_matricial_t
   movlw d'01'
   movwf _np_temp1
   btfss portb,4
   goto teclado_matricial_c
   btfss portb,5
   goto teclado_matricial_c
   btfss portb,6
   goto teclado_matricial_c
   btfss portb,7
   goto teclado_matricial_c
   goto teclado_matricial_e
teclado_matricial_c
   bsf porta,0
   bsf portb,1
   bsf portb,2
   bsf portb,3
   btfsc _np_temp1,0
   bcf porta,0
   btfsc _np_temp1,1
   bcf portb,1
   btfsc _np_temp1,2
   bcf portb,2
   btfsc _np_temp1,3
   bcf portb,3
   movlw d'01'
   movwf _np_temp3
   btfss portb,4
   goto teclado_matricial_d
   incf _np_temp3,1
   btfss portb,5
   goto teclado_matricial_d
   incf _np_temp3,1
   btfss portb,6
   goto teclado_matricial_d
   incf _np_temp3,1
   btfss portb,7
   goto teclado_matricial_d
   incf _np_temp3,1
   movlw d'4'
   addwf _np_temp2,1
   bcf status,c
   rlf _np_temp1,1
   btfss _np_temp1,4
   goto teclado_matricial_c
   movlw d'64'
   movwf _np_resultado
   movwf _np_presionada
   goto teclado_matricial_f
teclado_matricial_d
   movf _np_temp2,w
   addwf _np_temp3,w
   movwf _np_temp3
   xorwf _np_presionada,w
   btfsc status,z
   goto teclado_matricial_e
   movf _np_temp3,w
   movwf _np_resultado
   movwf _np_presionada
   goto teclado_matricial_f
teclado_matricial_e
   movlw d'64'
   movwf _np_resultado
   movwf _np_presionada
teclado_matricial_f
   bcf porta,0
   bcf portb,1
   bcf portb,2
   bcf portb,3
   clrf _np_temp2
teclado_matricial_th
   incf _np_temp2,1
   btfss status,z
   goto teclado_matricial_th
   return

conv_8_bcd
   ;convertir un registro a formato bcd (u, d y c)
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf _np_banderas2,sub_inte       ;limpiar la bandera de rutina cancelada por interrupcion
   clrf _np_temp3
   clrf _np_temp2
   movlw .100
conv_8_bcd_otro
   subwf _np_temp1,1
   btfss status,c
   goto conv_8_bcd_suma
   incf _np_temp3,1
   goto conv_8_bcd_otro
conv_8_bcd_suma
   addwf _np_temp1,1
   movlw .10
conv_8_bcd_bucle
   subwf _np_temp1,1
   btfss status,c
   goto conv_8_bcd_salir
   incf _np_temp2,1
   goto conv_8_bcd_bucle
conv_8_bcd_salir
   addwf _np_temp1,1
   return

tmp_1_mgc_i
   movwf _np_tiempo_inte
   goto tmp_1_mgc_i_1
tmp_1_mgc_i_bucle2
   nop
   nop
   nop
   nop
   nop
   nop
   nop
tmp_1_mgc_i_1
   movlw .10
   movwf _np_tiempo1_inte
tmp_1_mgc_i_bucle1
   nop
   nop
   movlw .99
   movwf _np_tiempo2_inte
tmp_1_mgc_i_bucle0
   nop
   nop
   nop
   movlw .200
   movwf _np_tiempo3_inte
tmp_1_mgc_i_bucle
   nop
   nop
   decfsz _np_tiempo3_inte,1
   goto tmp_1_mgc_i_bucle
   nop
   nop
   nop
   decfsz _np_tiempo2_inte,1
   goto tmp_1_mgc_i_bucle0
   nop
   nop
   nop
   decfsz _np_tiempo1_inte,1
   goto tmp_1_mgc_i_bucle1
   decfsz _np_tiempo_inte,1
   goto tmp_1_mgc_i_bucle2
   return


lcd_inicio
   movlw b'00000001'
   movwf _np_nro_lcd
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf _np_nro_msj
   movlw .2                         ;temporizador 20 mse
   call tmp_100_mc                  ;llamada a rutina tmp_100_mc
   clrf _np_est_inte
   btfsc intcon,gie
   incf _np_est_inte,1
   bcf intcon,gie                   ;desactivar habilitador general de interrupciones.
   bsf status,rp0                   ;cambiar a banco 1
   bcf trisb,4                      ;configurar los pines b4 al 7 como salida
   bcf trisb,5
   bcf trisb,6
   bcf trisb,7
   bcf status,rp0                   ;cambiar a banco 0
   bsf portd,7                      ;inhabilitar el teclado
   movlw b'00110000'
   call lcd_comando_ini             ;llamada a rutina lcd_comando_ini
   movlw .2                         ;temporizador 20 mse
   call tmp_100_mc                  ;llamada a rutina tmp_100_mc
   movlw b'00110000'
   call lcd_comando_ini             ;llamada a rutina lcd_comando_ini
   movlw .1                         ;temporizador 1 mse
   call tmp_1_mc                    ;llamada a rutina tmp_1_mc
   movlw b'00110000'
   call lcd_comando_ini             ;llamada a rutina lcd_comando_ini
   movlw b'00100000'
   call lcd_comando_ini             ;llamada a rutina lcd_comando_ini
   movlw b'00100000'
   call lcd_comando_ini             ;llamada a rutina lcd_comando_ini
   movlw b'10000000'
   call lcd_comando_ini             ;llamada a rutina lcd_comando_ini
   bsf status,rp0                   ;cambiar a banco 1
   bsf trisb,4                      ;configurar los pines b4 al 7 como entrada
   bsf trisb,5
   bsf trisb,6
   bsf trisb,7
   bcf status,rp0                   ;cambiar a banco 0
   bcf portd,7                      ;habilitar el teclado
   btfsc _np_est_inte,0
   bsf intcon,gie                   ;activar habilitador general de interrupciones.
   return
lcd_busy
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movlw .2                         ;temporizador 2 mse
   call tmp_1_mc                    ;llamada a rutina tmp_1_mc

   return
lcd_comando_ini
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf portb,2
   movwf _np_temp1
   bcf portb,3
   goto lcd_enviar_ini
lcd_comando
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf portb,2
   movwf _np_temp1
   bcf portb,3
   goto lcd_enviar
lcd_caracter
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf portb,2
   movwf _np_temp1
   bsf portb,3
lcd_enviar
   bsf porta,1
   movwf _np_temp1
   bcf portb,4
   bcf portb,5
   bcf portb,6
   bcf portb,7
   btfsc _np_temp1,4
   bsf portb,4
   btfsc _np_temp1,5
   bsf portb,5
   btfsc _np_temp1,6
   bsf portb,6
   btfsc _np_temp1,7
   bsf portb,7
   bcf porta,1
   nop
   nop
   bsf porta,1
   bcf portb,4
   bcf portb,5
   bcf portb,6
   bcf portb,7
   btfsc _np_temp1,0
   bsf portb,4
   btfsc _np_temp1,1
   bsf portb,5
   btfsc _np_temp1,2
   bsf portb,6
   btfsc _np_temp1,3
   bsf portb,7
   bcf porta,1
   nop
   nop
   bsf porta,1
   call lcd_busy                    ;llamada a rutina lcd_busy
   return
lcd_enviar_ini
   bsf porta,1
   movwf _np_temp1
   bcf portb,4
   bcf portb,5
   bcf portb,6
   bcf portb,7
   btfsc _np_temp1,4
   bsf portb,4
   btfsc _np_temp1,5
   bsf portb,5
   btfsc _np_temp1,6
   bsf portb,6
   btfsc _np_temp1,7
   bsf portb,7
   bcf porta,1
   nop
   nop
   bsf porta,1
   call lcd_busy                    ;llamada a rutina lcd_busy
   return
lcd_mensaje_actual
lcd_1
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf _np_msj_act
   movf _np_nro_msj,w
   xorwf _np_lcd_1,w
   btfss status,z
   bsf _np_msj_act,0
   movf _np_nro_msj,w
   movwf _np_lcd_1
   return

tmp_1_mgc
   movwf _np_tiempo
   goto tmp_1_mgc_1
tmp_1_mgc_bucle2
   nop
   nop
   nop
   nop
   nop
   nop
   nop
tmp_1_mgc_1
   movlw .10
   movwf _np_tiempo1
tmp_1_mgc_bucle1
   nop
   nop
   movlw .99
   movwf _np_tiempo2
tmp_1_mgc_bucle0
   nop
   nop
   nop
   movlw .200
   movwf _np_tiempo3
tmp_1_mgc_bucle
   nop
   nop
   decfsz _np_tiempo3,1
   goto tmp_1_mgc_bucle
   nop
   nop
   nop
   decfsz _np_tiempo2,1
   goto tmp_1_mgc_bucle0
   nop
   nop
   nop
   decfsz _np_tiempo1,1
   goto tmp_1_mgc_bucle1
   decfsz _np_tiempo,1
   goto tmp_1_mgc_bucle2
   return


grabar_eeprom
   ;escribir el dato en la eeprom
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf status,c
   btfsc intcon,gie
   bsf status,c
   rlf _np_actint_b,1
   rlf _np_actint_a,1
   bcf intcon,gie
   bsf status,rp0                   ;cambiar a banco 3
   bsf status,rp1
   bcf eecon1,eepgd
   bsf eecon1,wren
   movlw 0x55
   movwf eecon2
   movlw 0xaa
   movwf eecon2
   bsf eecon1,wr
esperar_fin_escritura
   btfsc eecon1,wr
   goto esperar_fin_escritura
   bcf eecon1,eeif
   bcf eecon1,wren
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf status,c
   rrf _np_actint_a,1
   rrf _np_actint_b,1
   btfsc status,c
   bsf intcon,gie
   return

tmp_100_mc
   movwf _np_tiempo
   goto tmp_100_mc_1
tmp_100_mc_bucle2
   nop
   nop
   nop
   nop
   nop
   nop
   nop
tmp_100_mc_1
   movlw .22
   movwf _np_tiempo1
tmp_100_mc_bucle1
   movlw .150
   movwf _np_tiempo2
tmp_100_mc_bucle
   decfsz _np_tiempo2,1
   goto tmp_100_mc_bucle
   decfsz _np_tiempo1,1
   goto tmp_100_mc_bucle1
   nop
   decfsz _np_tiempo,1
   goto tmp_100_mc_bucle2
   return


tmp_1_mc
   movwf _np_tiempo
   goto tmp_1_mc_1
tmp_1_mc_bucle1
   nop
   nop
   nop
   nop
   nop
   nop
   nop
tmp_1_mc_1
   movlw .246
   movwf _np_tiempo1
tmp_1_mc_bucle2
   nop
   decfsz _np_tiempo1,1
   goto tmp_1_mc_bucle2
   nop
   nop
   nop
   nop
   nop
   decfsz _np_tiempo,1
   goto tmp_1_mc_bucle1
   return



;------------------------------------------------------------
;                  DATOS EN MEMORIA EEPROM
;------------------------------------------------------------
   org  0x2100
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   d'00'
   data   d'00'
   data   d'00'
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff
   data   0xff

 End