;------------------------------------------------------------
; Código assembler generado por Niple V6.6.2
; Proyecto: 
; Autor: RUIZ MARTIN FERMIN CARMELO
; Fecha: 04/04/2022
; PIC: 16F887
; Velocidad de reloj: 4 Mhz
; Descripcion: 
;------------------------------------------------------------


 LIST    P=PIC16F887


_XT_OSC               equ  0x3FF9
_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
_XT_OSC               equ  0x3FF9
_WRT_OFF              equ  0x3FFF
_BOR21V               equ  0x3EFF
_config1              equ  0x2007
_config2              equ  0x2008

 __config _config1, _XT_OSC & _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
tmr0                  equ  0x0001
pcl                   equ  0x0002
status                equ  0x0003
fsr                   equ  0x0004
porta                 equ  0x0005
portb                 equ  0x0006
portc                 equ  0x0007
portd                 equ  0x0008
porte                 equ  0x0009
pclath                equ  0x000a
intcon                equ  0x000b
adresh                equ  0x001e
adcon0                equ  0x001f
_np_w                 equ  0x0020
_np_camb_pag          equ  0x0021
_np_pag_1             equ  0x0022
_np_pag_2             equ  0x0023
_np_temp1             equ  0x0024
_np_temp2             equ  0x0025
_np_temp3             equ  0x0026
_np_temp4             equ  0x0027
_np_temp5             equ  0x0028
_np_temp6             equ  0x0029
_np_temp7             equ  0x002a
_np_temp8             equ  0x002b
_np_temp9             equ  0x002c
_np_temp10            equ  0x002d
_np_temp11            equ  0x002e
_np_temp12            equ  0x002f
_np_temp13            equ  0x0030
_np_temp14            equ  0x0031
_np_temp15            equ  0x0032
_np_bcd_temp1         equ  0x0037
_np_bcd_temp2         equ  0x0038
_np_bcd_temp3         equ  0x0039
_np_bcd_temp4         equ  0x003a
_np_bcd_temp5         equ  0x003b
_np_bcd_temp6         equ  0x003c
_np_bcd_temp7         equ  0x003d
_np_bcd_temp8         equ  0x003e
_np_bcd_temp9         equ  0x003f
_np_bcd_temp10        equ  0x0040
_np_bcd_temp11        equ  0x0041
_np_bcd_temp12        equ  0x0042
_np_bcd_temp13        equ  0x0043
_np_bcd_temp14        equ  0x0044
_np_bcd_temp15        equ  0x0045
_np_actint_a          equ  0x0046
_np_actint_b          equ  0x0047
_np_disp_nro          equ  0x0048
_np_disp_valor        equ  0x0049
_np_display_01        equ  0x004a
_np_display_02        equ  0x004b
_np_display_03        equ  0x004c
_np_dy_c_1            equ  0x004d
_np_dy_c_2            equ  0x004e
_np_i2c_addr          equ  0x004f
_np_i2c_addr1         equ  0x0050
_np_i2c_buf           equ  0x0051
_np_i2c_contdat       equ  0x0052
_np_i2c_cte           equ  0x0053
_np_i2c_rxbuf         equ  0x0056
_np_i2c_slave         equ  0x0057
_np_i2c_temp1         equ  0x0058
_np_i2c_txbuf         equ  0x0059
_np_indice            equ  0x005a
_np_lcd_1             equ  0x005c
_np_mpx_aut           equ  0x005d
_np_mpx_h             equ  0x005e
_np_mpx_l             equ  0x005f
_np_msj_act           equ  0x0060
_np_nro_lcd           equ  0x0061
_np_nro_msj           equ  0x0062
_np_resultado         equ  0x0063
_np_status            equ  0x0064
_np_t0_cint1_h        equ  0x0065
_np_t0_cint1_l        equ  0x0066
_np_t0_cint_h         equ  0x0067
_np_t0_cint_l         equ  0x0068
_np_t0_ini            equ  0x0069
_np_t1_bak            equ  0x006a
_np_t2_bak            equ  0x006b
_np_t3_bak            equ  0x006c
_np_t_bak             equ  0x006d
_np_tiempo            equ  0x006e
_np_tiempo1           equ  0x006f
_np_tiempo1_inte      equ  0x0070
_np_tiempo2           equ  0x0071
_np_tiempo2_inte      equ  0x0072
_np_tiempo3           equ  0x0073
_np_tiempo3_inte      equ  0x0074
_np_tiempo_inte       equ  0x0075
_np_timers            equ  0x0076
cuenta_7seg           equ  0x0079
cuenta_7seg_uni       equ  0x007a
cuenta_7seg_dec       equ  0x007b
cuenta_7seg_cen       equ  0x007c
cuenta_eeprom         equ  0x007d
grados                equ  0x007e
in_ana_1_l            equ  0x007f
opcion                equ  0x0081
trisa                 equ  0x0085
trisb                 equ  0x0086
trisc                 equ  0x0087
trisd                 equ  0x0088
trise                 equ  0x0089
osccon                equ  0x008f
adresl                equ  0x009e
adcon1                equ  0x009f
in_ana_1_h            equ  0x00a1
in_ana_1_uni          equ  0x00a2
in_ana_1_dec          equ  0x00a3
in_ana_1_cen          equ  0x00a4
in_ana_1_u_mil        equ  0x00a5
in_ana_1_d_mil        equ  0x00a6
in_ana_2_l            equ  0x00a7
in_ana_2_h            equ  0x00a8
in_ana_2_uni          equ  0x00a9
in_ana_2_dec          equ  0x00aa
in_ana_2_cen          equ  0x00ab
in_ana_2_u_mil        equ  0x00ac
in_ana_2_d_mil        equ  0x00ad
in_ana_3_l            equ  0x00ae
in_ana_3_h            equ  0x00af
in_ana_3_uni          equ  0x00b0
in_ana_3_dec          equ  0x00b1
in_ana_3_cen          equ  0x00b2
in_ana_3_u_mil        equ  0x00b3
in_ana_3_d_mil        equ  0x00b4
in_ana_4_l            equ  0x00b5
in_ana_4_h            equ  0x00b6
in_ana_4_uni          equ  0x00b7
in_ana_4_dec          equ  0x00b8
in_ana_4_cen          equ  0x00b9
in_ana_4_u_mil        equ  0x00ba
in_ana_4_d_mil        equ  0x00bb
in_digitales          equ  0x00bc
np_banderas           equ  0x00bd
np_banderas2          equ  0x00be
seleccion             equ  0x00bf
temperatura_l         equ  0x00c0
temperatura_h         equ  0x00c1
temperatura_signo     equ  0x00c2
temperatura_uni       equ  0x00c3
temperatura_dec       equ  0x00c4
temperatura_cen       equ  0x00c5
temperatura_u_mil     equ  0x00c6
temperatura_d_mil     equ  0x00c7
cm1con0               equ  0x0107
cm2con0               equ  0x0108
ansel                 equ  0x0188
anselh                equ  0x0189


;------------------------------------------------------------
;                  Declaración de Bits
;------------------------------------------------------------
adfm                  equ  7   ;-
adon                  equ  0   ;-
c                     equ  0   ;-
c1ch0                 equ  0   ;-
c1ch1                 equ  1   ;-
c1oe                  equ  5   ;-
c1r                   equ  2   ;-
c2ch0                 equ  0   ;-
c2ch1                 equ  1   ;-
c2oe                  equ  5   ;-
c2r                   equ  2   ;-
ds18b20_01_dq         equ  3   ;sensor de temperatura ds18b20.
gie                   equ  7   ;-
go_done               equ  1   ;-
inte                  equ  4   ;-
intedg                equ  6   ;-
intf                  equ  1   ;-
ps0                   equ  0   ;-
ps1                   equ  1   ;-
ps2                   equ  2   ;-
psa                   equ  3   ;-
rc4                   equ  4   ;-
rc5                   equ  5   ;-
rp0                   equ  5   ;-
rp1                   equ  6   ;-
t0cs                  equ  5   ;-
t0ie                  equ  5   ;-
t0if                  equ  2   ;-
t0se                  equ  4   ;-
to                    equ  4   ;-
vcfg0                 equ  4   ;-
vcfg1                 equ  5   ;-
z                     equ  2   ;-
i2c_falla             equ  4   ;bandera de falla en la comunicacion i2c.
i2c_outack            equ  5   ;bit de respuesta de dispositivo i2c.
segmento_1            equ  4   ;-
segmento_2            equ  5   ;-
segmento_3            equ  0   ;-
segmento_a            equ  0   ;-
segmento_b            equ  1   ;-
segmento_c            equ  2   ;-
segmento_d            equ  3   ;-
segmento_e            equ  0   ;-
segmento_f            equ  1   ;-
segmento_g            equ  2   ;-
signo_temperatura     equ  0   ;bit de signo de ds18b20.
sub_inte              equ  0   ;bandera de subrrutina cancelada por interrupcion.
tiempo_t0             equ  0   ;bandera de temporizacion por tmr0


;------------------------------------------------------------
;               Declaración de Registros EEPROM
;------------------------------------------------------------


;------------------------------------------------------------
;                        Inicio
;------------------------------------------------------------

   org 0x00
   bsf status,rp0                   ;cambiar a banco 1
   bcf opcion,psa
   goto paso2
   org 0x04
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   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
   bcf status,c                     ;guardar la pagina de memoria actual
   btfsc pclath,4
   bsf status,c
   rlf _np_pag_2,1
   rlf _np_pag_1,1
   bcf status,c
   btfsc pclath,3
   bsf status,c
   rlf _np_pag_2,1
   rlf _np_pag_1,1
   bsf status,c
   rlf _np_camb_pag,1
   bcf pclath,3
   bcf pclath,4
   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
intes
int_1
   btfss intcon,inte
   goto int_2
   btfsc intcon,intf
   goto inte_rb0
int_2
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   btfss intcon,t0ie
   goto salir__intes
   btfsc intcon,t0if
   goto inte_t0
int_3
salir__intes

   bsf status,rp0                   ;cambiar a banco 1
   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
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf status,c                     ;restaurar la pagina de memoria
   rrf _np_camb_pag,1
   btfss status,c
   retfie
   btfsc _np_pag_2,0
   bsf pclath,3
   btfss _np_pag_2,0
   bcf pclath,3
   btfsc _np_pag_2,1
   bsf pclath,4
   btfss _np_pag_2,1
   bcf pclath,4
   bcf status,c
   rrf _np_pag_1,1
   rrf _np_pag_2,1
   bcf status,c
   rrf _np_pag_1,1
   rrf _np_pag_2,1
   movf _np_status,w
   movwf status
   swapf _np_w,w
   retfie


catodo_comun

   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_indice,0
   clrf _np_resultado
   sublw .9
   btfss status,c
   goto catodo_comun_s
   movf _np_indice,0
   movwf _np_temp1
   movlw low catodo_comun_tabla
   addwf _np_temp1,1
   movlw high catodo_comun_tabla
   btfsc status,c
   addlw .1
   movwf pclath
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_indice,0
   call catodo_comun_tabla
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_resultado
catodo_comun_s
   goto retorno_rutinas_pag_0
catodo_comun_tabla
   addwf pcl,1
   retlw b'01111110'                ; 
   retlw b'00001100'                ; 
   retlw b'10110110'                ; 
   retlw b'10011110'                ; 
   retlw b'11001100'                ; 
   retlw b'11011010'                ; 
   retlw b'11111010'                ; 
   retlw b'00001110'                ; 
   retlw b'11111110'                ; 
   retlw b'11001110'                ; 







   ;------------------------------------------------------------
   ;                      inicio de la interrupción por rb0
   ;------------------------------------------------------------
inte_rb0_salir
   bcf intcon,intf
   goto intes
inte_rb0


   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   movf seleccion,w
   xorlw d'5'
   btfss status,z
   goto inte_rb02_b
   movlw d'1'
   movwf seleccion
   goto inte_rb02_c
inte_rb02_b
   incf seleccion,1
inte_rb02_c
inte_rb03
   goto inte_rb0_salir

   ;------------------------------------------------------------
   ;                      inicio de la interrupción por tmr0
   ;------------------------------------------------------------
inte_t0_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf intcon,t0if
   goto intes
inte_t0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_t0_ini,w
   movwf tmr0
   bcf _np_timers,tiempo_t0
   decfsz _np_t0_cint_l,1
   goto inte_t02_no
   movf _np_t0_cint_h,w
   btfsc status,z
   goto inte_t02_si
   decf _np_t0_cint_h,1
   goto inte_t02_no
inte_t02_si
   bsf _np_timers,tiempo_t0
   movf _np_t0_cint1_l,w
   movwf _np_t0_cint_l
   movf _np_t0_cint1_h,w
   movwf _np_t0_cint_h
inte_t02_no
   btfss _np_timers,tiempo_t0       ;si el tiempo_t0 = 0
   goto inte_t0_salir
   ;visualizar datos en displays cátodo común
   movf cuenta_7seg_uni,w           ;mostrar el valor del registro cuenta_7seg_uni
   movwf _np_display_01
   movf cuenta_7seg_dec,w           ;mostrar el valor del registro cuenta_7seg_dec
   movwf _np_display_02
   movf cuenta_7seg_cen,w           ;mostrar el valor del registro cuenta_7seg_cen
   movwf _np_display_03
   clrf _np_dy_c_2
   clrf _np_dy_c_1
inte_t04_c
   incf _np_disp_nro,1
   movf _np_disp_nro,w
   xorlw .4
   btfsc status,z
   clrf _np_disp_nro
   movf _np_disp_nro,w
   xorlw .0
   btfsc status,z
   incf _np_disp_nro,1
   movf _np_disp_nro,w
   xorlw .1
   btfsc status,z
   goto inte_t04_d1
   movf _np_disp_nro,w
   xorlw .2
   btfsc status,z
   goto inte_t04_d2
   movf _np_disp_nro,w
   xorlw .3
   btfsc status,z
   goto inte_t04_d3
inte_t04_ini
   call dy2_disp_7_seg_01_p0        ;llamada a rutina dy2_disp_7_seg_01
inte_t04_d1
   call dy2_disp_7_seg_01_p0        ;llamada a rutina dy2_disp_7_seg_01
   movf cuenta_7seg_uni,w           ;mostrar el valor del registro cuenta_7seg_uni
   movwf _np_disp_valor
   call dy3_disp_7_seg_01_p0        ;llamada a rutina dy3_disp_7_seg_01
   bsf porta,4                      ;encender el display 1
   goto inte_t04_s
inte_t04_d2
   call dy2_disp_7_seg_01_p0        ;llamada a rutina dy2_disp_7_seg_01
   movf cuenta_7seg_dec,w           ;mostrar el valor del registro cuenta_7seg_dec
   movwf _np_disp_valor
   call dy3_disp_7_seg_01_p0        ;llamada a rutina dy3_disp_7_seg_01
   bsf porta,5                      ;encender el display 2
   goto inte_t04_s
inte_t04_d3
   call dy2_disp_7_seg_01_p0        ;llamada a rutina dy2_disp_7_seg_01
   movf cuenta_7seg_cen,w           ;mostrar el valor del registro cuenta_7seg_cen
   movwf _np_disp_valor
   call dy3_disp_7_seg_01_p0        ;llamada a rutina dy3_disp_7_seg_01
   bsf porte,0                      ;encender el display 3
   goto inte_t04_s
inte_t04_s

   movlw .5
   call tmp_1_mc_i_p0               ;llamada a rutina tmp_1_mc_i
   incf _np_dy_c_2
   btfsc status,z
   incf _np_dy_c_1
   movf _np_dy_c_2,w
   xorlw b'00000010'
   btfss status,z
   goto inte_t04_c
   movf _np_dy_c_1,w
   xorlw b'00000000'
   btfss status,z
   goto inte_t04_c
inte_t05
   goto inte_t0_salir

;------------------------------------------------------------
;                      programa principal
;------------------------------------------------------------
paso2
   clrf _np_w
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf _np_camb_pag
   clrf _np_pag_1
   clrf _np_pag_2
   clrf _np_temp1
   clrf _np_temp2
   clrf _np_temp3
   clrf _np_temp4
   clrf _np_temp5
   clrf _np_temp6
   clrf _np_temp7
   clrf _np_temp8
   clrf _np_temp9
   clrf _np_temp10
   clrf _np_temp11
   clrf _np_temp12
   clrf _np_temp13
   clrf _np_temp14
   clrf _np_temp15
   clrf _np_bcd_temp1
   clrf _np_bcd_temp2
   clrf _np_bcd_temp3
   clrf _np_bcd_temp4
   clrf _np_bcd_temp5
   clrf _np_bcd_temp6
   clrf _np_bcd_temp7
   clrf _np_bcd_temp8
   clrf _np_bcd_temp9
   clrf _np_bcd_temp10
   clrf _np_bcd_temp11
   clrf _np_bcd_temp12
   clrf _np_bcd_temp13
   clrf _np_bcd_temp14
   clrf _np_bcd_temp15
   clrf _np_actint_a
   clrf _np_actint_b
   clrf _np_disp_nro
   clrf _np_disp_valor
   clrf _np_display_01
   clrf _np_display_02
   clrf _np_display_03
   clrf _np_dy_c_1
   clrf _np_dy_c_2
   clrf _np_i2c_addr
   clrf _np_i2c_addr1
   clrf _np_i2c_buf
   clrf _np_i2c_contdat
   clrf _np_i2c_cte
   clrf _np_i2c_rxbuf
   clrf _np_i2c_slave
   clrf _np_i2c_temp1
   clrf _np_i2c_txbuf
   clrf _np_indice
   clrf _np_lcd_1
   clrf _np_mpx_aut
   clrf _np_mpx_h
   clrf _np_mpx_l
   clrf _np_msj_act
   clrf _np_nro_lcd
   clrf _np_nro_msj
   clrf _np_resultado
   clrf _np_status
   clrf _np_t0_cint1_h
   clrf _np_t0_cint1_l
   clrf _np_t0_cint_h
   clrf _np_t0_cint_l
   clrf _np_t0_ini
   clrf _np_t1_bak
   clrf _np_t2_bak
   clrf _np_t3_bak
   clrf _np_t_bak
   clrf _np_tiempo
   clrf _np_tiempo1
   clrf _np_tiempo1_inte
   clrf _np_tiempo2
   clrf _np_tiempo2_inte
   clrf _np_tiempo3
   clrf _np_tiempo3_inte
   clrf _np_tiempo_inte
   clrf _np_timers
   clrf cuenta_7seg
   clrf cuenta_7seg_uni
   clrf cuenta_7seg_dec
   clrf cuenta_7seg_cen
   clrf cuenta_eeprom
   clrf grados
   clrf in_ana_1_l
   bsf status,rp0                   ;cambiar a banco 1
   clrf in_ana_1_h
   clrf in_ana_1_uni
   clrf in_ana_1_dec
   clrf in_ana_1_cen
   clrf in_ana_1_u_mil
   clrf in_ana_1_d_mil
   clrf in_ana_2_l
   clrf in_ana_2_h
   clrf in_ana_2_uni
   clrf in_ana_2_dec
   clrf in_ana_2_cen
   clrf in_ana_2_u_mil
   clrf in_ana_2_d_mil
   clrf in_ana_3_l
   clrf in_ana_3_h
   clrf in_ana_3_uni
   clrf in_ana_3_dec
   clrf in_ana_3_cen
   clrf in_ana_3_u_mil
   clrf in_ana_3_d_mil
   clrf in_ana_4_l
   clrf in_ana_4_h
   clrf in_ana_4_uni
   clrf in_ana_4_dec
   clrf in_ana_4_cen
   clrf in_ana_4_u_mil
   clrf in_ana_4_d_mil
   clrf in_digitales
   clrf np_banderas
   clrf np_banderas2
   clrf seleccion
   clrf temperatura_l
   clrf temperatura_h
   clrf temperatura_signo
   clrf temperatura_uni
   clrf temperatura_dec
   clrf temperatura_cen
   clrf temperatura_u_mil
   clrf temperatura_d_mil
   bcf status,rp0                   ;cambiar a banco 0
   clrf porta
   clrf porte
   movlw b'00000000'                ;configurar el puerto e como xxxxxsss
   bsf status,rp0                   ;cambiar a banco 1
   movwf trise
   movlw b'00001111'                ;configurar el puerto a como xxssaaaa
   movwf trisa
   bsf status,rp1                   ;cambiar a banco 3
   bsf ansel,0
   bsf ansel,1
   bsf ansel,2
   bcf status,rp1                   ;cambiar a banco 1
   bcf adcon1,vcfg1
   bsf status,rp1                   ;cambiar a banco 3
   bsf ansel,3
   bcf status,rp1                   ;cambiar a banco 1
   bcf adcon1,vcfg0
   bcf status,rp0                   ;cambiar a banco 2
   bsf status,rp1
   bcf cm1con0,c1oe
   bsf status,rp0                   ;cambiar a banco 3
   bcf ansel,4
   bcf status,rp0                   ;cambiar a banco 2
   bcf cm2con0,c2oe
   bsf status,rp0                   ;cambiar a banco 3
   bcf ansel,5
   bcf ansel,6
   bcf ansel,7

   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf adcon0,adon                  ;activar activar el módulo de conv a/d
   clrf portb
   movlw b'11111111'                ;configurar el puerto b como eeeeeeee
   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'00000000'                ;configurar el puerto c como ssssssss
   bsf status,rp0                   ;cambiar a banco 1
   movwf trisc
   bcf status,rp0                   ;cambiar a banco 0
   clrf portd
   movlw b'00000000'                ;configurar el puerto d como ssssssss
   bsf status,rp0                   ;cambiar a banco 1
   movwf trisd

   bcf status,rp0                   ;cambiar a banco 0
   clrf tmr0
   bsf status,rp0                   ;cambiar a banco 1
   bcf opcion,psa                   ;asignacion del preescalado al tmr0
   bcf opcion,t0cs                  ;origen de la señal de reloj de tmr0 = reloj interno
   bsf opcion,ps0                   ;configurar preescalado a 4
   bcf opcion,ps1
   bcf opcion,ps2
   movlw .6
   bcf status,rp0                   ;cambiar a banco 0
   movwf tmr0
   movwf _np_t0_ini
   clrf _np_t0_cint_h
   clrf _np_t0_cint1_h
   movlw b'00011001'
   movwf _np_t0_cint_l
   movwf _np_t0_cint1_l
   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.
   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_p0               ;llamada a rutina lcd_inicio
   call rutusr_007_p0               ;llamada a rutina usr_inicializacion
comienzo
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf intcon,gie

   bsf status,rp0                   ;cambiar a banco 1
   movf seleccion,w                 ;si seleccion = d'1'
   xorlw d'1'
   btfss status,z
   goto paso16
   call rutusr_012_p0               ;llamada a rutina usr_valores_digitales
   goto comienzo
   goto comienzo
paso16
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1

   bsf status,rp0                   ;cambiar a banco 1
   movf seleccion,w                 ;si seleccion = d'2'
   xorlw d'2'
   btfss status,z
   goto paso18
   call rutusr_011_p0               ;llamada a rutina usr_valores_analogicos
   goto comienzo
   goto comienzo
paso18
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1

   bsf status,rp0                   ;cambiar a banco 1
   movf seleccion,w                 ;si seleccion = d'3'
   xorlw d'3'
   btfss status,z
   goto paso21
   call rutusr_013_p0               ;llamada a rutina usr_temp_sensor
   ;bloque inhabilitado
   goto comienzo
   goto comienzo
paso21
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1

   bsf status,rp0                   ;cambiar a banco 1
   movf seleccion,w                 ;si seleccion = d'4'
   xorlw d'4'
   btfss status,z
   goto paso23
   call rutusr_014_p0               ;llamada a rutina usr_7segmentos
   goto comienzo
   goto comienzo
paso23
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1

   bsf status,rp0                   ;cambiar a banco 1
   movf seleccion,w                 ;si seleccion = d'5'
   xorlw d'5'
   btfss status,z
   goto paso26
   call rutusr_008_p0               ;llamada a rutina usr_grabar_eeprom
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   clrf seleccion
   goto comienzo
   goto comienzo
paso26
   movlw b'00000001'
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_nro_lcd

   call rutusr_005_p0               ;llamada a rutina usr_lcd_ver_espera_seleccion
   goto comienzo
   goto comienzo


;------------------------------------------------------------
;                  Declaración de Subrutinas
;------------------------------------------------------------

; usr_inicializacion
rutusr_007
   movlw d'175'
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf grados
   bsf status,rp0                   ;cambiar a banco 1
   clrf in_digitales
   bcf status,rp0                   ;cambiar a banco 0
   bcf portc,5
   movlw b'01000000'
   movwf _np_i2c_slave
   bsf status,rp0                   ;cambiar a banco 1
   movf in_digitales,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_i2c_txbuf
   call pcf8574_c4_c5_p0            ;llamada a rutina pcf8574_c4_c5
   bcf porta,segmento_1
   bcf porta,segmento_2
   bcf porte,segmento_3
rutusr_007_5
   goto rutusr_007__salir
rutusr_007__salir

   goto retorno_rutinas_pag_0



; usr_grabar_eeprom
rutusr_008
   movlw b'00000001'
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_nro_lcd

   call rutusr_009_p0               ;llamada a rutina usr_lcd_ver_grabar_eeprom
   clrf cuenta_eeprom
rutusr_008_3

   incf cuenta_eeprom,1

   movlw b'10100000'
   movwf _np_i2c_slave
   clrf _np_i2c_addr1
   movf cuenta_eeprom,w
   movwf _np_i2c_addr
   movf cuenta_eeprom,w
   movwf _np_i2c_txbuf
   call mem_24c256_c4_c5_p0         ;llamada a rutina mem_24c256_c4_c5

   movlw d'20'                      ;si cuenta_eeprom >= d'20'
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   subwf cuenta_eeprom,w
   btfss status,c
   goto rutusr_008_3
   movlw b'00000001'
   movwf _np_nro_lcd

   call rutusr_010_p0               ;llamada a rutina usr_lcd_ver_grabado_eeprom

   movlw .30
   call tmp_100_mc_p0               ;llamada a rutina tmp_100_mc
rutusr_008_7
   goto rutusr_008__salir
rutusr_008__salir

   goto retorno_rutinas_pag_0



; usr_lcd_ver_grabar_eeprom
rutusr_009
   bcf status,c
   btfsc intcon,gie
   bsf status,c
   rlf _np_actint_b,1
   rlf _np_actint_a,1
   bcf intcon,gie

   movlw .6
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_nro_msj
   call lcd_mensaje_actual_p0       ;llamada a rutina lcd_mensaje_actual
   btfss _np_msj_act,0
   goto rutusr_009_2_nc
   movlw b'00001100'
   call lcd_comando_p0              ;llamada a rutina lcd_comando
   movlw b'00000001'
   call lcd_comando_p0              ;llamada a rutina lcd_comando
rutusr_009_2_nc
   movlw b'10000000'
   call lcd_comando_p0              ;llamada a rutina lcd_comando
   movlw .71                        ;g
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .82                        ;r
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .65                        ;a
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .66                        ;b
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .65                        ;a
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .78                        ;n
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .68                        ;d
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .79                        ;o
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .32                        ;espacio
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .69                        ;e
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .69                        ;e
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .80                        ;p
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .82                        ;r
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .79                        ;o
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .77                        ;m
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw b'11000010'
   call lcd_comando_p0              ;llamada a rutina lcd_comando
   movlw .69                        ;e
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .83                        ;s
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .80                        ;p
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .69                        ;e
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .82                        ;r
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .69                        ;e
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .46                        ;.
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .46                        ;.
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .46                        ;.
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .46                        ;.
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .46                        ;.
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   movlw .46                        ;.
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   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

rutusr_009_3
   goto rutusr_009__salir
rutusr_009__salir

   goto retorno_rutinas_pag_0



; usr_valores_digitales
rutusr_012
   ;leer un dato del puerto b
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf portb,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_digitales
   movlw b'00000001'
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_nro_lcd

   call rutusr_003_p0               ;llamada a rutina usr_lcd_ver_digitales
   bcf portc,5
   movlw b'01000000'
   movwf _np_i2c_slave
   bsf status,rp0                   ;cambiar a banco 1
   movf in_digitales,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_i2c_txbuf
   call pcf8574_c4_c5_p0            ;llamada a rutina pcf8574_c4_c5
rutusr_012_6
   goto rutusr_012__salir
rutusr_012__salir

   goto retorno_rutinas_pag_0



; usr_temp_sensor
rutusr_013
   call ds18b20_d3_leer_p0          ;llamada a rutina ds18b20_d3_leer
   movf _np_temp1,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf temperatura_h
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_temp2,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf temperatura_l
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_temp6,w
   btfss status,z
   goto slt_1_no
   goto slt_1_si
slt_1_no
   bsf status,rp0                   ;cambiar a banco 1
   bcf temperatura_signo,signo_temperatura
   goto slt_1_s
slt_1_si
   bsf status,rp0                   ;cambiar a banco 1
   bsf temperatura_signo,signo_temperatura
slt_1_s
   movf temperatura_h,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_bcd_temp1
   bsf status,rp0                   ;cambiar a banco 1
   movf temperatura_l,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_bcd_temp2
   call conv_16_bcd_p0              ;llamada a rutina conv_16_bcd
   call dy4_disp_7_seg_01_p0        ;llamada a rutina dy4_disp_7_seg_01
   movf _np_bcd_temp3,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf temperatura_uni
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_bcd_temp4,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf temperatura_dec
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_bcd_temp5,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf temperatura_cen
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_bcd_temp6,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf temperatura_u_mil
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_bcd_temp7,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf temperatura_d_mil
   movlw b'00000001'
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_nro_lcd

   call rutusr_004_p0               ;llamada a rutina usr_lcd_ver_temperatura
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   btfss temperatura_signo,signo_temperatura;si el signo_temperatura = 10
   goto rutusr_013_7
   bcf status,c
   btfsc intcon,gie
   bsf status,c
   rlf _np_actint_b,1
   rlf _np_actint_a,1
   bcf intcon,gie

   movlw b'11000100'
   call lcd_comando_p0              ;llamada a rutina lcd_comando
   movlw .43                        ;+
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   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

rutusr_013_9

   movlw .10
   call tmp_100_mc_p0               ;llamada a rutina tmp_100_mc
rutusr_013_8
   goto rutusr_013__salir
rutusr_013_7
   bcf status,c
   btfsc intcon,gie
   bsf status,c
   rlf _np_actint_b,1
   rlf _np_actint_a,1
   bcf intcon,gie

   movlw b'11000100'
   call lcd_comando_p0              ;llamada a rutina lcd_comando
   movlw .45                        ;-
   call lcd_caracter_p0             ;llamada a rutina lcd_caracter
   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

   goto rutusr_013_9                ;cierra el ciclo
rutusr_013__salir

   goto retorno_rutinas_pag_0



; usr_7segmentos
rutusr_014
   movlw b'00000001'
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_nro_lcd

   call rutusr_006_p0               ;llamada a rutina usr_lcd_ver_7segmentos

   bcf intcon,t0if                  ;limpiar la bandera antes de activarla
   bsf intcon,t0ie                  ;activar interrupción por tmr0.
   bsf intcon,gie                   ;activar habilitador general de interrupciones.
rutusr_014_4

   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   incf cuenta_7seg,1
   movf cuenta_7seg,w
   movwf _np_bcd_temp1
   call conv_8_bcd_p0               ;llamada a rutina conv_8_bcd
   call dy4_disp_7_seg_01_p0        ;llamada a rutina dy4_disp_7_seg_01
   movf _np_bcd_temp1,w
   movwf cuenta_7seg_uni
   movf _np_bcd_temp2,w
   movwf cuenta_7seg_dec
   movf _np_bcd_temp3,w
   movwf cuenta_7seg_cen
   movf cuenta_7seg_uni,w           ;consultar la tablacatodo_comun
   movwf _np_indice
   call catodo_comun_p0             ;llamada a rutina catodo_comun
   movf _np_resultado,w
   movwf cuenta_7seg_uni
   movf cuenta_7seg_dec,w           ;consultar la tablacatodo_comun
   movwf _np_indice
   call catodo_comun_p0             ;llamada a rutina catodo_comun
   movf _np_resultado,w
   movwf cuenta_7seg_dec
   movf cuenta_7seg_cen,w           ;consultar la tablacatodo_comun
   movwf _np_indice
   call catodo_comun_p0             ;llamada a rutina catodo_comun
   movf _np_resultado,w
   movwf cuenta_7seg_cen

   movlw d'235'                     ;si cuenta_7seg >= d'235'
   subwf cuenta_7seg,w
   btfss status,c
   goto rutusr_014_12
   clrf cuenta_7seg
   movf cuenta_7seg,w
   movwf _np_bcd_temp1
   call conv_8_bcd_p0               ;llamada a rutina conv_8_bcd
   call dy4_disp_7_seg_01_p0        ;llamada a rutina dy4_disp_7_seg_01
   movf _np_bcd_temp1,w
   movwf cuenta_7seg_uni
   movf _np_bcd_temp2,w
   movwf cuenta_7seg_dec
   movf _np_bcd_temp3,w
   movwf cuenta_7seg_cen
rutusr_014_12

   movlw .3
   call tmp_1_mc_p0                 ;llamada a rutina tmp_1_mc

   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   movf seleccion,w                 ;si seleccion <> d'4'
   xorlw d'4'
   btfsc status,z
   goto rutusr_014_4
   bcf status,rp0                   ;cambiar a banco 0
   bcf porta,segmento_1
   bcf porta,segmento_2
   bcf porte,segmento_3

   bcf intcon,t0ie                  ;desactivar interrupción por tmr0.
rutusr_014_9
   goto rutusr_014__salir
   goto rutusr_014_12               ;cierra el ciclo
rutusr_014__salir

   goto retorno_rutinas_pag_0







;------------------------------------------------------------
;        Llamar las Rutinas de otras paginas de memoria
;------------------------------------------------------------

cpila0
   bcf status,rp0                   ;Cambiar a banco 0
   bcf status,rp1
   bcf status,c                     ;llamar a rutina de pagina de memoria 1
   rlf _np_pag_2,1
   rlf _np_pag_1,1
   bcf status,c
   rlf _np_pag_2,1
   rlf _np_pag_1,1
   bsf status,c
   rlf _np_camb_pag,1
   return

ncpila0
   bcf status,rp0                   ;Cambiar a banco 0
   bcf status,rp1
   bcf status,c
   rlf _np_camb_pag,1
   return

rutusr_003_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bsf pclath,4
   goto rutusr_003

rutusr_004_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bsf pclath,4
   goto rutusr_004

rutusr_005_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bsf pclath,4
   goto rutusr_005

rutusr_006_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bsf pclath,4
   goto rutusr_006

rutusr_007_p0
   call ncpila0
   goto rutusr_007

rutusr_008_p0
   call ncpila0
   goto rutusr_008

rutusr_009_p0
   call ncpila0
   goto rutusr_009

rutusr_010_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bsf pclath,4
   goto rutusr_010

rutusr_011_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf pclath,3
   bsf pclath,4
   goto rutusr_011

rutusr_012_p0
   call ncpila0
   goto rutusr_012

rutusr_013_p0
   call ncpila0
   goto rutusr_013

rutusr_014_p0
   call ncpila0
   goto rutusr_014

pcf8574_c4_c5_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto pcf8574_c4_c5

conv_16_bcd_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto conv_16_bcd

ds18b20_d3_leer_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto ds18b20_d3_leer

conv_8_bcd_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto conv_8_bcd

catodo_comun_p0
   call ncpila0
   goto catodo_comun

dy2_disp_7_seg_01_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto dy2_disp_7_seg_01

dy3_disp_7_seg_01_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto dy3_disp_7_seg_01

tmp_1_mc_i_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto tmp_1_mc_i

lcd_inicio_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto lcd_inicio

tmp_100_mc_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto tmp_100_mc

mem_24c256_c4_c5_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto mem_24c256_c4_c5

lcd_mensaje_actual_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto lcd_mensaje_actual

lcd_comando_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto lcd_comando

lcd_caracter_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto lcd_caracter

dy4_disp_7_seg_01_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto dy4_disp_7_seg_01

tmp_1_mc_p0
   call cpila0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto tmp_1_mc


retorno_rutinas_pag_0
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf status,c
   rrf _np_camb_pag,1
   btfss status,c
   return
   btfsc _np_pag_2,0
   bsf pclath,3
   btfss _np_pag_2,0
   bcf pclath,3
   btfsc _np_pag_2,1
   bsf pclath,4
   btfss _np_pag_2,1
   bcf pclath,4
   bcf status,c
   rrf _np_pag_1,1
   rrf _np_pag_2,1
   bcf status,c
   rrf _np_pag_1,1
   rrf _np_pag_2,1
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


;============================================================
   org 0x0800                       ;página 1
;============================================================


;------------------------------------------------------------
;                  Declaración de Subrutinas
;------------------------------------------------------------

pcf8574_c4_c5
   movlw d'1'
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_i2c_cte
   btfss _np_i2c_slave,0
   goto e_pcf8574_c4_c5
leer_pcf8574_c4_c5
   bsf status,rp0                   ;cambiar a banco 1
   bcf trisc,5
   bcf status,rp0                   ;cambiar a banco 0
   bsf portc,5
   bsf portc,4
   nop
   nop
   nop
   nop
   bcf portc,5
   nop
   nop
   nop
   nop
   bcf portc,4
   nop
   bsf status,rp0                   ;cambiar a banco 1
   bcf np_banderas,i2c_falla
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_i2c_slave,w
   movwf _np_i2c_buf
   call i2ctc4_c5_p1                ;llamada a rutina i2ctc4_c5
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf np_banderas,i2c_outack
   call i2crc4_c5_p1                ;llamada a rutina i2crc4_c5
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bcf trisc,5
   bcf status,rp0                   ;cambiar a banco 0
   bcf portc,5
   bsf portc,4
   nop
   nop
   nop
   nop
   bsf portc,5
   nop
   nop
   nop
   nop
   goto retorno_rutinas_pag_1
e_pcf8574_c4_c5
   bsf status,rp0                   ;cambiar a banco 1
   bcf trisc,5
   bcf status,rp0                   ;cambiar a banco 0
   bsf portc,5
   bsf portc,4
   nop
   nop
   nop
   nop
   bcf portc,5
   nop
   nop
   nop
   nop
   bcf portc,4
   nop
   bsf status,rp0                   ;cambiar a banco 1
   bcf np_banderas,i2c_falla
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_i2c_slave,w
   movwf _np_i2c_buf
   call i2ctc4_c5_p1                ;llamada a rutina i2ctc4_c5
   movf _np_i2c_txbuf,w
   movwf _np_i2c_buf
   call i2ctc4_c5_p1                ;llamada a rutina i2ctc4_c5
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bcf trisc,5
   bcf status,rp0                   ;cambiar a banco 0
   bcf portc,5
   bsf portc,4
   nop
   nop
   nop
   nop
   bsf portc,5
   nop
   nop
   nop
   nop

   movlw .3
   call tmp_1_mc_p1                 ;llamada a rutina tmp_1_mc
   goto retorno_rutinas_pag_1



i2ctc4_c5
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bcf trisc,5
   bcf status,rp0                   ;cambiar a banco 0

   movlw d'08'
   movwf _np_i2c_temp1
i2ctc4_c5_lp
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   btfsc _np_i2c_buf,7
   bsf portc,5
   btfss _np_i2c_buf,7
   bcf portc,5
   nop
   nop
   nop
   nop
   bsf portc,4
   nop
   nop
   nop
   nop
   nop
   bcf portc,4
   nop
   rlf _np_i2c_buf,1
   decfsz _np_i2c_temp1,1
   goto i2ctc4_c5_lp
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisc,5
   bcf status,rp0                   ;cambiar a banco 0

   bsf portc,4
   nop
   nop
   nop
   nop
   bcf portc,4
   nop
   nop
   nop
   nop
   goto retorno_rutinas_pag_1

i2crc4_c5
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisc,5
   bcf status,rp0                   ;cambiar a banco 0

   clrf _np_i2c_rxbuf
   movlw d'08'
   movwf _np_i2c_temp1
   bcf status,0
i2crc4_c5_lp
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   rlf _np_i2c_rxbuf,1
   bsf portc,4
   nop
   nop
   nop
   nop
   btfss portc,5
   bcf _np_i2c_rxbuf,0
   btfsc portc,5
   bsf _np_i2c_rxbuf,0
   bcf portc,4
   nop
   decfsz _np_i2c_temp1,1
   goto i2crc4_c5_lp
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bcf trisc,5
   bcf status,rp0                   ;cambiar a banco 0

   goto retorno_rutinas_pag_1


conv_16_bcd
   ;convertir un registro (16 bits) a formato bcd (u, d, c, um y dm)
   nop
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf _np_bcd_temp7
   clrf _np_bcd_temp6
   clrf _np_bcd_temp5
   clrf _np_bcd_temp4
   clrf _np_bcd_temp3
   clrf _np_bcd_temp12
   clrf _np_bcd_temp11
   clrf _np_bcd_temp10
   clrf _np_bcd_temp9
   clrf _np_bcd_temp8
   incf _np_bcd_temp8,1
   movlw .16
   movwf _np_bcd_temp13
conv_16_bcd_rot
   nop
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   btfss _np_bcd_temp2,0
   goto conv_16_bcd_n_s
   call conv_16_bcd_s               ;llamada a rutina conv_16_bcd_s
conv_16_bcd_n_s
   call conv_16_bcd_r_d             ;llamada a rutina conv_16_bcd_r_d
   bcf status,c
   rrf _np_bcd_temp1,1
   rrf _np_bcd_temp2,1
   decfsz _np_bcd_temp13,1
   goto conv_16_bcd_rot
   call dy4_disp_7_seg_01_p1        ;llamada a rutina dy4_disp_7_seg_01
   goto retorno_rutinas_pag_1
conv_16_bcd_s
   call conv_16_bcd_s_1             ;llamada a rutina conv_16_bcd_s_1
   call conv_16_bcd_s_2             ;llamada a rutina conv_16_bcd_s_2
   call conv_16_bcd_s_3             ;llamada a rutina conv_16_bcd_s_3
   call conv_16_bcd_s_4             ;llamada a rutina conv_16_bcd_s_4
   call conv_16_bcd_s_5             ;llamada a rutina conv_16_bcd_s_5
   return
conv_16_bcd_s_1
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_bcd_temp8,w
   addwf _np_bcd_temp3,1
   movf _np_bcd_temp3,w
   sublw .9
   btfss status,c
   goto conv_16_bcd_s_1a
   return
conv_16_bcd_s_1a
   movlw .10
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   subwf _np_bcd_temp3,1
   incf _np_bcd_temp4,1
   return
conv_16_bcd_s_2
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_bcd_temp9,w
   addwf _np_bcd_temp4,1
   movf _np_bcd_temp4,w
   sublw .9
   btfss status,c
   goto conv_16_bcd_s_2a
   return
conv_16_bcd_s_2a
   movlw .10
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   subwf _np_bcd_temp4,1
   incf _np_bcd_temp5,1
   return
conv_16_bcd_s_3
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_bcd_temp10,w
   addwf _np_bcd_temp5,1
   movf _np_bcd_temp5,w
   sublw .9
   btfss status,c
   goto conv_16_bcd_s_3a
   return
conv_16_bcd_s_3a
   movlw .10
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   subwf _np_bcd_temp5,1
   incf _np_bcd_temp6,1
   return
conv_16_bcd_s_4
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_bcd_temp11,w
   addwf _np_bcd_temp6,1
   movf _np_bcd_temp6,w
   sublw .9
   btfss status,c
   goto conv_16_bcd_s_4a
   return
conv_16_bcd_s_4a
   movlw .10
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   subwf _np_bcd_temp6,1
   incf _np_bcd_temp7,1
   return
conv_16_bcd_s_5
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_bcd_temp12,w
   addwf _np_bcd_temp7,1
   movf _np_bcd_temp7,w
   sublw .9
   btfss status,c
   goto conv_16_bcd_s_5a
   return
conv_16_bcd_s_5a
   movlw .10
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   subwf _np_bcd_temp7,1
   return
conv_16_bcd_r_d
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf _np_bcd_temp15
conv_16_bcd_d1
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_bcd_temp8,w
   movwf _np_bcd_temp14
   call conv_16_bcd_d               ;llamada a rutina conv_16_bcd_d
   movf _np_bcd_temp14,w
   movwf _np_bcd_temp8
conv_16_bcd_d2
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_bcd_temp9,w
   movwf _np_bcd_temp14
   call conv_16_bcd_d               ;llamada a rutina conv_16_bcd_d
   movf _np_bcd_temp14,w
   movwf _np_bcd_temp9
conv_16_bcd_d3
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_bcd_temp10,w
   movwf _np_bcd_temp14
   call conv_16_bcd_d               ;llamada a rutina conv_16_bcd_d
   movf _np_bcd_temp14,w
   movwf _np_bcd_temp10
conv_16_bcd_d4
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_bcd_temp11,w
   movwf _np_bcd_temp14
   call conv_16_bcd_d               ;llamada a rutina conv_16_bcd_d
   movf _np_bcd_temp14,w
   movwf _np_bcd_temp11
conv_16_bcd_d5
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_bcd_temp12,w
   movwf _np_bcd_temp14
   call conv_16_bcd_d               ;llamada a rutina conv_16_bcd_d
   movf _np_bcd_temp14,w
   movwf _np_bcd_temp12
   return
conv_16_bcd_d
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf status,c
   rlf _np_bcd_temp14,1
   movf _np_bcd_temp15,w
   btfss status,z
   incf _np_bcd_temp14,1
   movf _np_bcd_temp14,w
   sublw .9
   btfss status,c
   goto conv_16_bcd_d_m
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf _np_bcd_temp15
   return
conv_16_bcd_d_m
   movlw .10
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   subwf _np_bcd_temp14,1
   incf _np_bcd_temp15,1
   return

ds18b20_d3_leer
   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


   clrf _np_temp7
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bcf trisd,3
   bcf status,rp0                   ;cambiar a banco 0
   bcf portd,3

   movlw .119
   movwf _np_tiempo
tempo_001_a
   nop
   nop
   decfsz _np_tiempo,1
   goto tempo_001_a
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisd,3
   bcf status,rp0                   ;cambiar a banco 0

   movlw .23
   movwf _np_tiempo
tempo_002_a
   nop
   nop
   decfsz _np_tiempo,1
   goto tempo_002_a
   btfss portd,3
   incf _np_temp7,1

   movlw .79
   movwf _np_tiempo
tempo_003_a
   nop
   nop
   decfsz _np_tiempo,1
   goto tempo_003_a
   movlw 0xcc
   movwf _np_temp2
   call ds18b20_d3_d                ;llamada a rutina ds18b20_d3_d
   movlw 0x44
   movwf _np_temp2
   call ds18b20_d3_d                ;llamada a rutina ds18b20_d3_d
   clrf _np_temp7
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bcf trisd,3
   bcf status,rp0                   ;cambiar a banco 0
   bcf portd,3

   movlw .119
   movwf _np_tiempo
tempo_004_a
   nop
   nop
   decfsz _np_tiempo,1
   goto tempo_004_a
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisd,3
   bcf status,rp0                   ;cambiar a banco 0

   movlw .23
   movwf _np_tiempo
tempo_005_a
   nop
   nop
   decfsz _np_tiempo,1
   goto tempo_005_a
   btfss portd,3
   incf _np_temp7,1

   movlw .79
   movwf _np_tiempo
tempo_006_a
   nop
   nop
   decfsz _np_tiempo,1
   goto tempo_006_a
   movlw 0xcc
   movwf _np_temp2
   call ds18b20_d3_d                ;llamada a rutina ds18b20_d3_d
   movlw 0xbe
   movwf _np_temp2
   call ds18b20_d3_d                ;llamada a rutina ds18b20_d3_d
   call ds18b20_d3_e                ;llamada a rutina ds18b20_d3_e
   movf _np_temp1,w
   movwf _np_temp5
   call ds18b20_d3_e                ;llamada a rutina ds18b20_d3_e
   movf _np_temp1,w
   movwf _np_temp4
ds18b20_d3_n
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf status,c
   movf _np_temp5,w
   xorlw b'11111111'
   btfss status,z
   bcf status,c
   btfsc status,c
   movf _np_temp4,w
   btfsc status,c
   xorlw b'11111111'
   btfsc status,z
   goto ds18b20_d3_o
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf _np_temp6
   btfss _np_temp4,7
   goto ds18b20_d3_ps
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf _np_temp6,0
   comf _np_temp5,1
   comf _np_temp4,1
   incf _np_temp5,1
   btfsc status,z
   incf _np_temp4,1
ds18b20_d3_ps
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf _np_temp4,7
   bcf _np_temp4,6
   bcf _np_temp4,5
   bcf _np_temp4,4
   bcf _np_temp4,3
   movf _np_temp5,w
   andlw b'00001111'
   movwf _np_temp7
   btfsc _np_temp6,0
   incf _np_temp7,1
   movf _np_temp7,w
   movwf _np_temp1
   btfsc status,z
   goto ds18b20_d3_se
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf _np_temp1,4
   bcf _np_temp1,5
   bcf _np_temp1,6
   bcf _np_temp1,7
   movlw .0
   movwf _np_temp7
   decf _np_temp1,1
   btfsc status,z
   goto ds18b20_d3_se
   movlw .1
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_temp7
   decf _np_temp1,1
   btfsc status,z
   goto ds18b20_d3_se
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   decf _np_temp1,1
   btfsc status,z
   goto ds18b20_d3_se
   movlw .2
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_temp7
   decf _np_temp1,1
   btfsc status,z
   goto ds18b20_d3_se
   movlw .3
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_temp7
   decf _np_temp1,1
   btfsc status,z
   goto ds18b20_d3_se
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   decf _np_temp1,1
   btfsc status,z
   goto ds18b20_d3_se
   movlw .4
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_temp7
   decf _np_temp1,1
   btfsc status,z
   goto ds18b20_d3_se
   movlw .5
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_temp7
   decf _np_temp1,1
   btfsc status,z
   goto ds18b20_d3_se
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   decf _np_temp1,1
   btfsc status,z
   goto ds18b20_d3_se
   movlw .6
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_temp7
   decf _np_temp1,1
   btfsc status,z
   goto ds18b20_d3_se
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   decf _np_temp1,1
   btfsc status,z
   goto ds18b20_d3_se
   movlw .7
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_temp7
   decf _np_temp1,1
   btfsc status,z
   goto ds18b20_d3_se
   movlw .8
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_temp7
   decf _np_temp1,1
   btfsc status,z
   goto ds18b20_d3_se
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   decf _np_temp1,1
   btfsc status,z
   goto ds18b20_d3_se
   movlw .9
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_temp7
   decf _np_temp1,1
   btfsc status,z
   goto ds18b20_d3_se
   movlw .10
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_temp7
ds18b20_d3_se
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf status,c
   rrf _np_temp4,1
   rrf _np_temp5,1
   bcf status,c
   rrf _np_temp4,1
   rrf _np_temp5,1
   bcf status,c
   rrf _np_temp4,1
   rrf _np_temp5,1
   bcf status,c
   rrf _np_temp4,1
   rrf _np_temp5,1
   movf _np_temp5,w
   movwf _np_temp2
   movwf _np_temp3
   bcf status,c
   rlf _np_temp5,1
   rlf _np_temp4,1
   bcf status,c
   rlf _np_temp5,1
   rlf _np_temp4,1
   bcf status,c
   rlf _np_temp5,1
   rlf _np_temp4,1
   bcf status,c
   rlf _np_temp3,w
   addwf _np_temp5,1
   btfsc status,c
   incf _np_temp4,1
ds18b20_d3_o
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_temp7,w
   addwf _np_temp5,1
   btfsc status,c
   incf _np_temp4,1
   movf _np_temp4,w
   movwf _np_temp1
   movf _np_temp5,w
   movwf _np_temp2
   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

   goto retorno_rutinas_pag_1
ds18b20_d3_d
   movlw .8
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_temp1
   bsf portd,3
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bcf trisd,3
   bcf status,rp0                   ;cambiar a banco 0
ds18b20_d3_j
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   rrf _np_temp2,1
   btfss status,c
   goto ds18b20_d3_f
   goto ds18b20_d3_g
ds18b20_d3_h
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   decfsz _np_temp1,1
   goto ds18b20_d3_j
   return
ds18b20_d3_f
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf portd,3

   movlw .9
   movwf _np_tiempo
tempo_007_a
   nop
   nop
   decfsz _np_tiempo,1
   goto tempo_007_a
   bsf portd,3
   goto ds18b20_d3_h
ds18b20_d3_g
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf portd,3
   nop
   nop
   nop
   nop
   nop
   bsf portd,3

   movlw .7
   movwf _np_tiempo
tempo_008_a
   nop
   nop
   decfsz _np_tiempo,1
   goto tempo_008_a
   goto ds18b20_d3_h
ds18b20_d3_e
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf _np_temp1
   movlw .8
   movwf _np_temp2
ds18b20_d3_i
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf portd,3
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bcf trisd,3
   bcf status,rp0                   ;cambiar a banco 0
   nop
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisd,3
   bcf status,rp0                   ;cambiar a banco 0
   nop
   nop
   nop
   nop
   nop
   nop
   nop
   btfss portd,3
   bcf status,c
   btfsc portd,3
   bsf status,c
   rrf _np_temp1,1

   movlw .11
   movwf _np_tiempo
tempo_009_a
   nop
   nop
   decfsz _np_tiempo,1
   goto tempo_009_a
   decfsz _np_temp2,1
   goto ds18b20_d3_i
   return

conv_8_bcd
   ;convertir un registro a formato bcd (u, d y c)
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf _np_bcd_temp3
   clrf _np_bcd_temp2
   movlw .100
conv_8_bcd_otro
   subwf _np_bcd_temp1,1
   btfss status,c
   goto conv_8_bcd_suma
   incf _np_bcd_temp3,1
   goto conv_8_bcd_otro
conv_8_bcd_suma
   addwf _np_bcd_temp1,1
   movlw .10
conv_8_bcd_bucle
   nop
   subwf _np_bcd_temp1,1
   btfss status,c
   goto conv_8_bcd_salir
   incf _np_bcd_temp2,1
   goto conv_8_bcd_bucle
conv_8_bcd_salir
   addwf _np_bcd_temp1,1
   goto retorno_rutinas_pag_1

dy2_disp_7_seg_01
   ;visualizar datos en displays cátodo común
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf porta,4
   bcf porta,5
   bcf porte,0
   bcf portc,0                      ;limpiar el bus de datos
   bcf portc,1
   bcf portc,2
   bcf portc,3
   bcf portd,0
   bcf portd,1
   bcf portd,2
   goto retorno_rutinas_pag_1

dy3_disp_7_seg_01
   ;visualizar datos en displays cátodo común
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   btfsc _np_disp_valor,1           ;asignar el nuevo valor al bus de datos
   bsf portc,0
   btfsc _np_disp_valor,2
   bsf portc,1
   btfsc _np_disp_valor,3
   bsf portc,2
   btfsc _np_disp_valor,4
   bsf portc,3
   btfsc _np_disp_valor,5
   bsf portd,0
   btfsc _np_disp_valor,6
   bsf portd,1
   btfsc _np_disp_valor,7
   bsf portd,2
   goto retorno_rutinas_pag_1

tmp_1_mc_i
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_tiempo_inte
   goto tmp_1_mc_i_1
tmp_1_mc_i_bucle1
   nop
   nop
   nop
   nop
   nop
   nop
   nop
tmp_1_mc_i_1
   movlw .246
   movwf _np_tiempo1_inte
tmp_1_mc_i_bucle2
   nop
   decfsz _np_tiempo1_inte,1
   goto tmp_1_mc_i_bucle2
   nop
   nop
   nop
   nop
   nop
   decfsz _np_tiempo_inte,1
   goto tmp_1_mc_i_bucle1
   goto retorno_rutinas_pag_1


lcd_inicio
   movlw b'00000001'
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_nro_lcd
   clrf _np_nro_msj

   movlw .2
   call tmp_100_mc_p1               ;llamada a rutina tmp_100_mc
   bcf status,c
   btfsc intcon,gie
   bsf status,c
   rlf _np_actint_b,1
   rlf _np_actint_a,1
   bcf intcon,gie

   movlw b'00110000'
   call lcd_comando_ini_p1          ;llamada a rutina lcd_comando_ini

   movlw .2
   call tmp_100_mc_p1               ;llamada a rutina tmp_100_mc
   movlw b'00110000'
   call lcd_comando_ini_p1          ;llamada a rutina lcd_comando_ini

   movlw .1
   call tmp_1_mc_p1                 ;llamada a rutina tmp_1_mc
   movlw b'00110000'
   call lcd_comando_ini_p1          ;llamada a rutina lcd_comando_ini
   movlw b'00100000'
   call lcd_comando_ini_p1          ;llamada a rutina lcd_comando_ini
   movlw b'00100000'
   call lcd_comando_ini_p1          ;llamada a rutina lcd_comando_ini
   movlw b'10000000'
   call lcd_comando_ini_p1          ;llamada a rutina lcd_comando_ini
   bcf status,c
   rrf _np_actint_a,1
   rrf _np_actint_b,1
   btfsc status,c
   bsf intcon,gie

   goto retorno_rutinas_pag_1
lcd_busy

   movlw .2
   call tmp_1_mc_p1                 ;llamada a rutina tmp_1_mc
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return
lcd_comando_ini
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_temp1
   bcf porte,1
   goto lcd_enviar_ini
lcd_comando
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_temp1
   bcf porte,1
   goto lcd_enviar
lcd_caracter
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_temp1
   movf _np_temp1,w
   btfsc status,z
   movlw .20
   bsf porte,1
lcd_enviar
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf porte,2
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_temp1
   bcf portd,4
   bcf portd,5
   bcf portd,6
   bcf portd,7
   btfsc _np_temp1,4
   goto slt_3_no
   goto slt_3_si
slt_3_no
   bsf portd,4
   goto slt_3_s
slt_3_si
   nop
slt_3_s
   btfsc _np_temp1,5
   goto slt_4_no
   goto slt_4_si
slt_4_no
   bsf portd,5
   goto slt_4_s
slt_4_si
   nop
slt_4_s
   btfsc _np_temp1,6
   goto slt_5_no
   goto slt_5_si
slt_5_no
   bsf portd,6
   goto slt_5_s
slt_5_si
   nop
slt_5_s
   btfsc _np_temp1,7
   goto slt_6_no
   goto slt_6_si
slt_6_no
   bsf portd,7
   goto slt_6_s
slt_6_si
   nop
slt_6_s
   bcf porte,2
   nop
   nop
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf porte,2
   bcf portd,4
   bcf portd,5
   bcf portd,6
   bcf portd,7
   btfsc _np_temp1,0
   goto slt_7_no
   goto slt_7_si
slt_7_no
   bsf portd,4
   goto slt_7_s
slt_7_si
   nop
slt_7_s
   btfsc _np_temp1,1
   goto slt_8_no
   goto slt_8_si
slt_8_no
   bsf portd,5
   goto slt_8_s
slt_8_si
   nop
slt_8_s
   btfsc _np_temp1,2
   goto slt_9_no
   goto slt_9_si
slt_9_no
   bsf portd,6
   goto slt_9_s
slt_9_si
   nop
slt_9_s
   btfsc _np_temp1,3
   goto slt_10_no
   goto slt_10_si
slt_10_no
   bsf portd,7
   goto slt_10_s
slt_10_si
   nop
slt_10_s
   bcf porte,2
   nop
   nop
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf porte,2
   call lcd_busy                    ;llamada a rutina lcd_busy
   goto retorno_rutinas_pag_1
lcd_enviar_ini
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf porte,2
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_temp1
   bcf portd,4
   bcf portd,5
   bcf portd,6
   bcf portd,7
   btfsc _np_temp1,4
   goto slt_11_no
   goto slt_11_si
slt_11_no
   bsf portd,4
   goto slt_11_s
slt_11_si
   nop
slt_11_s
   btfsc _np_temp1,5
   goto slt_12_no
   goto slt_12_si
slt_12_no
   bsf portd,5
   goto slt_12_s
slt_12_si
   nop
slt_12_s
   btfsc _np_temp1,6
   goto slt_13_no
   goto slt_13_si
slt_13_no
   bsf portd,6
   goto slt_13_s
slt_13_si
   nop
slt_13_s
   btfsc _np_temp1,7
   goto slt_14_no
   goto slt_14_si
slt_14_no
   bsf portd,7
   goto slt_14_s
slt_14_si
   nop
slt_14_s
   bcf porte,2
   nop
   nop
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf porte,2
   call lcd_busy                    ;llamada a rutina lcd_busy
   goto retorno_rutinas_pag_1
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
   goto retorno_rutinas_pag_1



tmp_100_mc
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_tiempo
   goto tmp_100_mc_1
tmp_100_mc_bucle2

tmp_100_mc_1
   nop
   nop
   nop
   nop
   nop
   nop
   nop
   movlw .22
   movwf _np_tiempo1
tmp_100_mc_bucle1
   nop

   movlw .10
   movwf _np_mpx_aut
   call dy4_disp_7_seg_01_p1        ;llamada a rutina dy4_disp_7_seg_01
   movlw .75
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_tiempo2
tmp_100_mc_bucle
   nop
   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
   goto retorno_rutinas_pag_1

mem_24c256_c4_c5
   movlw d'1'
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_i2c_cte
   btfss _np_i2c_slave,0
   goto e_mem_24c256_c4_c5
l_mem_24c256_c4_c5   ;leer la memoria mem_24c256

   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bcf trisc,5
   bcf status,rp0                   ;cambiar a banco 0

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,5

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   bcf portc,5

   nop
   nop
   nop
   nop
   nop
   nop
   bcf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   bsf status,rp0                   ;cambiar a banco 1
   bcf np_banderas,i2c_falla
   bcf status,rp0                   ;cambiar a banco 0
   bcf _np_i2c_slave,0
   movf _np_i2c_slave,w
   movwf _np_i2c_buf
   call mem_24c256_txb_c4_c5        ;llamada a rutina mem_24c256_txb_c4_c5

   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisc,5
   bcf status,rp0                   ;cambiar a banco 0

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   bcf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   movf _np_i2c_addr1,w
   movwf _np_i2c_buf
   call mem_24c256_txb_c4_c5        ;llamada a rutina mem_24c256_txb_c4_c5

   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisc,5
   bcf status,rp0                   ;cambiar a banco 0

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   bcf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   movf _np_i2c_addr,w
   movwf _np_i2c_buf
   call mem_24c256_txb_c4_c5        ;llamada a rutina mem_24c256_txb_c4_c5

   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisc,5
   bcf status,rp0                   ;cambiar a banco 0

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   bcf portc,4

   nop
   nop
   nop
   nop
   nop
   nop

   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bcf trisc,5
   bcf status,rp0                   ;cambiar a banco 0

   nop
   nop
   nop
   nop
   nop
   nop
   bcf portc,5

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,5

   nop
   nop
   nop
   nop
   nop
   nop

   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bcf trisc,5
   bcf status,rp0                   ;cambiar a banco 0

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,5

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   bcf portc,5

   nop
   nop
   nop
   nop
   nop
   nop
   bcf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   bsf _np_i2c_slave,0
   movf _np_i2c_slave,w
   movwf _np_i2c_buf
   call mem_24c256_txb_c4_c5        ;llamada a rutina mem_24c256_txb_c4_c5

   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisc,5
   bcf status,rp0                   ;cambiar a banco 0

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   bcf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   call mem_24c256_rxb_c4_c5        ;llamada a rutina mem_24c256_rxb_c4_c5

   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bcf trisc,5
   bcf status,rp0                   ;cambiar a banco 0

   nop
   nop
   nop
   nop
   nop
   nop
   bcf portc,5

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,5

   nop
   nop
   nop
   nop
   nop
   nop
   goto retorno_rutinas_pag_1
e_mem_24c256_c4_c5   ;escribir la memoria mem_24c256

   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bcf trisc,5
   bcf status,rp0                   ;cambiar a banco 0

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,5

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   bcf portc,5

   nop
   nop
   nop
   nop
   nop
   nop
   bcf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   bcf _np_i2c_slave,0
   movf _np_i2c_slave,w
   movwf _np_i2c_buf
   call mem_24c256_txb_c4_c5        ;llamada a rutina mem_24c256_txb_c4_c5

   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisc,5
   bcf status,rp0                   ;cambiar a banco 0

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   bcf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   movf _np_i2c_addr1,w
   movwf _np_i2c_buf
   call mem_24c256_txb_c4_c5        ;llamada a rutina mem_24c256_txb_c4_c5

   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisc,5
   bcf status,rp0                   ;cambiar a banco 0

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   bcf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   movf _np_i2c_addr,w
   movwf _np_i2c_buf
   call mem_24c256_txb_c4_c5        ;llamada a rutina mem_24c256_txb_c4_c5

   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisc,5
   bcf status,rp0                   ;cambiar a banco 0

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   bcf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   movf _np_i2c_txbuf,w
   movwf _np_i2c_buf
   call mem_24c256_txb_c4_c5        ;llamada a rutina mem_24c256_txb_c4_c5

   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisc,5
   bcf status,rp0                   ;cambiar a banco 0

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   bcf portc,4

   nop
   nop
   nop
   nop
   nop
   nop

   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bcf trisc,5
   bcf status,rp0                   ;cambiar a banco 0

   nop
   nop
   nop
   nop
   nop
   nop
   bcf portc,5

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,5

   nop
   nop
   nop
   nop
   nop
   nop

   movlw .11
   call tmp_1_mc_p1                 ;llamada a rutina tmp_1_mc
   goto retorno_rutinas_pag_1


mem_24c256_txb_c4_c5
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bcf trisc,5
   bcf status,rp0                   ;cambiar a banco 0
   movlw d'08'
   movwf _np_i2c_temp1
mem_24c256_txb_c4_c5_lp
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   btfsc _np_i2c_buf,7
   goto slt_15_no
   goto slt_15_si
slt_15_no
   bsf portc,5
   goto slt_15_s
slt_15_si
   bcf portc,5
slt_15_s

   nop
   nop
   nop
   nop
   nop
   nop
   bsf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   bcf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   rlf _np_i2c_buf,1
   decfsz _np_i2c_temp1,1
   goto mem_24c256_txb_c4_c5_lp
   return

mem_24c256_rxb_c4_c5
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   bsf trisc,5
   bcf status,rp0                   ;cambiar a banco 0
   clrf _np_i2c_rxbuf
   movlw d'08'
   movwf _np_i2c_temp1
mem_24c256_rxb_c4_c5_lp
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf status,0
   rlf _np_i2c_rxbuf,1
   bsf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   btfss portc,5
   goto slt_16_no
   goto slt_16_si
slt_16_no
   bcf _np_i2c_rxbuf,0
   goto slt_16_s
slt_16_si
   bsf _np_i2c_rxbuf,0
slt_16_s

   nop
   nop
   nop
   nop
   nop
   nop
   bcf portc,4

   nop
   nop
   nop
   nop
   nop
   nop
   decfsz _np_i2c_temp1,1
   goto mem_24c256_rxb_c4_c5_lp
   return







dy4_disp_7_seg_01
   ;visualizar datos en displays cátodo común
sub_29_reini
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   incf _np_disp_nro,1
   movf _np_disp_nro,w
   xorlw .4
   btfsc status,z
   clrf _np_disp_nro
   movf _np_disp_nro,w
   btfsc status,z
   incf _np_disp_nro,1
   movf _np_disp_nro,w
   xorlw .1
   btfsc status,z
   goto sub_29_d1
   movf _np_disp_nro,w
   xorlw .2
   btfsc status,z
   goto sub_29_d2
   movf _np_disp_nro,w
   xorlw .3
   btfsc status,z
   goto sub_29_d3
sub_29_ini
   call dy2_disp_7_seg_01_p1        ;llamada a rutina dy2_disp_7_seg_01
   goto sub_29_reini
sub_29_d1
   call dy2_disp_7_seg_01_p1        ;llamada a rutina dy2_disp_7_seg_01
   movf _np_display_01,w
   movwf _np_disp_valor
   call dy3_disp_7_seg_01_p1        ;llamada a rutina dy3_disp_7_seg_01
   bsf porta,4                      ;encender el display 1
   goto sub_29_salir
sub_29_d2
   call dy2_disp_7_seg_01_p1        ;llamada a rutina dy2_disp_7_seg_01
   movf _np_display_02,w
   movwf _np_disp_valor
   call dy3_disp_7_seg_01_p1        ;llamada a rutina dy3_disp_7_seg_01
   bsf porta,5                      ;encender el display 2
   goto sub_29_salir
sub_29_d3
   call dy2_disp_7_seg_01_p1        ;llamada a rutina dy2_disp_7_seg_01
   movf _np_display_03,w
   movwf _np_disp_valor
   call dy3_disp_7_seg_01_p1        ;llamada a rutina dy3_disp_7_seg_01
   bsf porte,0                      ;encender el display 3
   goto sub_29_salir
sub_29_salir
   decfsz _np_mpx_aut,1
   goto $-1
   goto retorno_rutinas_pag_1

tmp_1_mc
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   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
   goto retorno_rutinas_pag_1
























































;------------------------------------------------------------
;        Llamar las Rutinas de otras paginas de memoria
;------------------------------------------------------------

cpila1
   bcf status,rp0                   ;Cambiar a banco 0
   bcf status,rp1
   bcf status,c                     ;llamar a rutina de pagina de memoria 0
   rlf _np_pag_2,1
   rlf _np_pag_1,1
   bsf status,c
   rlf _np_pag_2,1
   rlf _np_pag_1,1
   bsf status,c
   rlf _np_camb_pag,1
   return

ncpila1
   bcf status,rp0                   ;Cambiar a banco 0
   bcf status,rp1
   bcf status,c
   rlf _np_camb_pag,1
   return

dy2_disp_7_seg_01_p1
   call ncpila1
   goto dy2_disp_7_seg_01

dy3_disp_7_seg_01_p1
   call ncpila1
   goto dy3_disp_7_seg_01

tmp_100_mc_p1
   call ncpila1
   goto tmp_100_mc

dy4_disp_7_seg_01_p1
   call ncpila1
   goto dy4_disp_7_seg_01

tmp_1_mc_p1
   call ncpila1
   goto tmp_1_mc

i2ctc4_c5_p1
   call ncpila1
   goto i2ctc4_c5

i2crc4_c5_p1
   call ncpila1
   goto i2crc4_c5

lcd_comando_ini_p1
   call ncpila1
   goto lcd_comando_ini


retorno_rutinas_pag_1
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf status,c
   rrf _np_camb_pag,1
   btfss status,c
   return
   btfsc _np_pag_2,0
   bsf pclath,3
   btfss _np_pag_2,0
   bcf pclath,3
   btfsc _np_pag_2,1
   bsf pclath,4
   btfss _np_pag_2,1
   bcf pclath,4
   bcf status,c
   rrf _np_pag_1,1
   rrf _np_pag_2,1
   bcf status,c
   rrf _np_pag_1,1
   rrf _np_pag_2,1
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


;============================================================
   org 0x1000                       ;página 2

;============================================================


;------------------------------------------------------------
;                  Declaración de Subrutinas
;------------------------------------------------------------

; usr_valores_analogicos
rutusr_011
rutusr_011_4
   movlw b'01000001'
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf adcon0
   clrf in_ana_1_l
   bsf status,rp0                   ;cambiar a banco 1
   clrf in_ana_1_h

   bsf adcon1,adfm                  ;alinear el resultado a la derecha
   bcf status,rp0                   ;cambiar a banco 0
   clrf _np_temp3
   clrf _np_temp4
   clrf _np_temp6
   clrf _np_temp7
   clrf _np_temp8
   clrf _np_temp9
   movlw .4
   movwf _np_temp5
rutusr_011_4_ciclos
   movlw .10
   movwf _np_temp1
rutusr_011_4_t
   decfsz _np_temp1,1
   goto rutusr_011_4_t
   bsf adcon0,go_done
   nop
   nop
rutusr_011_4_f
   btfsc adcon0,go_done
   goto rutusr_011_4_f
   bsf status,rp0                   ;cambiar a banco 1
   movf adresl,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf in_ana_1_l
   movf adresh,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_1_h
   bcf status,rp0                   ;cambiar a banco 0
   movf in_ana_1_l,w
   addwf _np_temp4,1
   btfsc status,c
   incf _np_temp3,1
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_1_h,w
   bcf status,rp0                   ;cambiar a banco 0
   addwf _np_temp3,1
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_1_h,w
   bcf status,rp0                   ;cambiar a banco 0
   subwf _np_temp6,w
   btfss status,c
   goto rutusr_011_4_max
   btfss status,z
   goto rutusr_011_4_max_n
   movf in_ana_1_l,w
   btfsc status,c
   subwf _np_temp7,w
   btfsc status,c
   goto rutusr_011_4_max_n
rutusr_011_4_max
   movf in_ana_1_l,w
   movwf _np_temp7
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_1_h,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_temp6
rutusr_011_4_max_n
   bsf status,c
   movf _np_temp8,w
   xorlw b'00000000'
   btfss status,z
   bcf status,c
   movf _np_temp9,w
   xorlw b'00000000'
   btfss status,z
   bcf status,c
   btfsc status,c
   goto rutusr_011_4_min_2
   movf _np_temp8,w
   bsf status,rp0                   ;cambiar a banco 1
   subwf in_ana_1_h,w
   btfss status,c
   goto rutusr_011_4_min_1
   btfss status,z
   bsf status,c
   btfss status,z
   goto rutusr_011_4_min_1
   btfsc status,c
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_temp9,w
   btfsc status,c
   subwf in_ana_1_l,w
rutusr_011_4_min_1
   btfsc status,c
   goto rutusr_011_4_min_n
rutusr_011_4_min_2
   movf in_ana_1_l,w
   movwf _np_temp9
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_1_h,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_temp8
rutusr_011_4_min_n

   movlw .1
   call tmp_1_mc_p2                 ;llamada a rutina tmp_1_mc
   decfsz _np_temp5,1
   goto rutusr_011_4_ciclos
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf _np_temp10
   movf _np_temp7,w
   movwf _np_temp11
   movf _np_temp6,w
   movwf _np_temp12
   comf _np_temp4,w
   addwf _np_temp11,w
   movwf _np_temp4
   bcf status,z
   btfsc status,c
   incf _np_temp12,1
   btfsc status,z
   bsf _np_temp10,0
   comf _np_temp3,w
   addwf _np_temp12,w
   movwf _np_temp3
   btfsc status,z
   bsf _np_temp10,0
   bcf status,c
   btfsc _np_temp10,0
   bsf status,c
   comf _np_temp4,1
   comf _np_temp3,1
   clrf _np_temp10
   movf _np_temp9,w
   movwf _np_temp11
   movf _np_temp8,w
   movwf _np_temp12
   comf _np_temp4,w
   addwf _np_temp11,w
   movwf _np_temp4
   bcf status,z
   btfsc status,c
   incf _np_temp12,1
   btfsc status,z
   bsf _np_temp10,0
   comf _np_temp3,w
   addwf _np_temp12,w
   movwf _np_temp3
   btfsc status,z
   bsf _np_temp10,0
   bcf status,c
   btfsc _np_temp10,0
   bsf status,c
   comf _np_temp4,1
   comf _np_temp3,1
   bcf status,c
   rrf _np_temp3,1
   rrf _np_temp4,1
   movf _np_temp4,w
   movwf _np_temp1
   movf _np_temp3,w
   movwf _np_temp2
   clrf _np_temp3
   clrf _np_temp4
   movlw b'11101000'
   movwf _np_temp5
   movlw b'00000001'
   movwf _np_temp6
   movlw b'00000000'
   movwf _np_temp7
   movlw b'00000000'
   movwf _np_temp8

   clrf _np_temp10
   clrf _np_temp11
   clrf _np_temp12
   clrf _np_temp13
   movlw .32
   movwf _np_temp9
rutusr_011_4_m__a
   btfss _np_temp5,0
   goto rutusr_011_4_m__b
   movf _np_temp1,w
   addwf _np_temp10,1
   bcf status,z
   btfsc status,c
   incf _np_temp11,1
   btfsc status,z
   incf _np_temp12,1
   btfsc status,z
   incf _np_temp13,1
   movf _np_temp2,w
   addwf _np_temp11,1
   bcf status,z
   btfsc status,c
   incf _np_temp12,1
   btfsc status,z
   incf _np_temp13,1
   movf _np_temp3,w
   addwf _np_temp12,1
   btfsc status,c
   incf _np_temp13,1
   movf _np_temp4,w
   addwf _np_temp13,1
rutusr_011_4_m__b
   bcf status,c
   rlf _np_temp1,1
   rlf _np_temp2,1
   rlf _np_temp3,1
   rlf _np_temp4,1
   bcf status,c
   btfsc _np_temp5,0
   bsf status,c
   rrf _np_temp8,1
   rrf _np_temp7,1
   rrf _np_temp6,1
   rrf _np_temp5,1
   decfsz _np_temp9,1
   goto rutusr_011_4_m__a
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_temp10,w
   movwf _np_temp1
   movf _np_temp11,w
   movwf _np_temp2
   movf _np_temp12,w
   movwf _np_temp3
   movf _np_temp13,w
   movwf _np_temp4
   movlw b'11101000'
   movwf _np_temp5
   movlw b'00000011'
   movwf _np_temp6
   movlw b'00000000'
   movwf _np_temp7
   movlw b'00000000'
   movwf _np_temp8

rutusr_011_4_d__d32_auto_c1
   clrf _np_temp9
   clrf _np_temp10
   clrf _np_temp11
   clrf _np_temp12
   movlw .32
   movwf _np_temp13
rutusr_011_4_d__d32_auto_a
   call rutusr_011_4_d__d32_auto_d  ;llamada a rutina rutusr_011_4_d__d32_auto_d
   movf _np_temp8,w
   subwf _np_temp12,w
   btfss status,z
   goto rutusr_011_4_d__d32_auto_b
   movf _np_temp7,w
   subwf _np_temp11,w
   btfss status,z
   goto rutusr_011_4_d__d32_auto_b
   movf _np_temp6,w
   subwf _np_temp10,w
   btfss status,z
   goto rutusr_011_4_d__d32_auto_b
   movf _np_temp5,w
   subwf _np_temp9,w
rutusr_011_4_d__d32_auto_b
   btfss status,c
   goto rutusr_011_4_d__d32_auto_c  ;-
   movf _np_temp5,w
   subwf _np_temp9,1
   movf _np_temp6,w
   btfss status,c
   incfsz _np_temp6,w
   subwf _np_temp10,1
   movf _np_temp7,w
   btfss status,c
   incfsz _np_temp7,w
   subwf _np_temp11,1
   movf _np_temp8,w
   btfss status,c
   incfsz _np_temp8,w
   subwf _np_temp12,1
   bcf status,c
   bsf _np_temp1,0
rutusr_011_4_d__d32_auto_c
   decfsz _np_temp13,1
   goto rutusr_011_4_d__d32_auto_a
   goto rutusr_011_4_d__d32_auto_s
rutusr_011_4_d__d32_auto_d
   rlf _np_temp1,1
   rlf _np_temp2,1
   rlf _np_temp3,1
   rlf _np_temp4,1
   rlf _np_temp9,1
   rlf _np_temp10,1
   rlf _np_temp11,1
   rlf _np_temp12,1
   return
rutusr_011_4_d__d32_auto_s
   bcf _np_temp4,7
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   incf _np_temp1,1
   btfsc status,z
   incf _np_temp2,1
   movf _np_temp1,w
   movwf in_ana_1_l
   movf _np_temp2,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_1_h
   movf in_ana_1_h,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_bcd_temp1
   movf in_ana_1_l,w
   movwf _np_bcd_temp2
   call conv_16_bcd_p2              ;llamada a rutina conv_16_bcd
   call dy4_disp_7_seg_01_p2        ;llamada a rutina dy4_disp_7_seg_01
   movf _np_bcd_temp3,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_1_uni
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_bcd_temp4,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_1_dec
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_bcd_temp5,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_1_cen
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_bcd_temp6,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_1_u_mil
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_bcd_temp7,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_1_d_mil
   movlw b'01000101'
   bcf status,rp0                   ;cambiar a banco 0
   movwf adcon0
   bsf status,rp0                   ;cambiar a banco 1
   clrf in_ana_2_l
   clrf in_ana_2_h

   bsf adcon1,adfm                  ;alinear el resultado a la derecha
   bcf status,rp0                   ;cambiar a banco 0
   clrf _np_temp3
   clrf _np_temp4
   clrf _np_temp6
   clrf _np_temp7
   clrf _np_temp8
   clrf _np_temp9
   movlw .4
   movwf _np_temp5
rutusr_011_6_ciclos
   movlw .10
   movwf _np_temp1
rutusr_011_6_t
   decfsz _np_temp1,1
   goto rutusr_011_6_t
   bsf adcon0,go_done
   nop
   nop
rutusr_011_6_f
   btfsc adcon0,go_done
   goto rutusr_011_6_f
   bsf status,rp0                   ;cambiar a banco 1
   movf adresl,w
   movwf in_ana_2_l
   bcf status,rp0                   ;cambiar a banco 0
   movf adresh,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_2_h
   movf in_ana_2_l,w
   bcf status,rp0                   ;cambiar a banco 0
   addwf _np_temp4,1
   btfsc status,c
   incf _np_temp3,1
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_2_h,w
   bcf status,rp0                   ;cambiar a banco 0
   addwf _np_temp3,1
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_2_h,w
   bcf status,rp0                   ;cambiar a banco 0
   subwf _np_temp6,w
   btfss status,c
   goto rutusr_011_6_max
   btfss status,z
   goto rutusr_011_6_max_n
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_2_l,w
   btfsc status,c
   bcf status,rp0                   ;cambiar a banco 0
   subwf _np_temp7,w
   btfsc status,c
   goto rutusr_011_6_max_n
rutusr_011_6_max
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_2_l,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_temp7
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_2_h,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_temp6
rutusr_011_6_max_n
   bsf status,c
   movf _np_temp8,w
   xorlw b'00000000'
   btfss status,z
   bcf status,c
   movf _np_temp9,w
   xorlw b'00000000'
   btfss status,z
   bcf status,c
   btfsc status,c
   goto rutusr_011_6_min_2
   movf _np_temp8,w
   bsf status,rp0                   ;cambiar a banco 1
   subwf in_ana_2_h,w
   btfss status,c
   goto rutusr_011_6_min_1
   btfss status,z
   bsf status,c
   btfss status,z
   goto rutusr_011_6_min_1
   btfsc status,c
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_temp9,w
   btfsc status,c
   bsf status,rp0                   ;cambiar a banco 1
   subwf in_ana_2_l,w
rutusr_011_6_min_1
   btfsc status,c
   goto rutusr_011_6_min_n
rutusr_011_6_min_2
   movf in_ana_2_l,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_temp9
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_2_h,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_temp8
rutusr_011_6_min_n

   movlw .1
   call tmp_1_mc_p2                 ;llamada a rutina tmp_1_mc
   decfsz _np_temp5,1
   goto rutusr_011_6_ciclos
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf _np_temp10
   movf _np_temp7,w
   movwf _np_temp11
   movf _np_temp6,w
   movwf _np_temp12
   comf _np_temp4,w
   addwf _np_temp11,w
   movwf _np_temp4
   bcf status,z
   btfsc status,c
   incf _np_temp12,1
   btfsc status,z
   bsf _np_temp10,0
   comf _np_temp3,w
   addwf _np_temp12,w
   movwf _np_temp3
   btfsc status,z
   bsf _np_temp10,0
   bcf status,c
   btfsc _np_temp10,0
   bsf status,c
   comf _np_temp4,1
   comf _np_temp3,1
   clrf _np_temp10
   movf _np_temp9,w
   movwf _np_temp11
   movf _np_temp8,w
   movwf _np_temp12
   comf _np_temp4,w
   addwf _np_temp11,w
   movwf _np_temp4
   bcf status,z
   btfsc status,c
   incf _np_temp12,1
   btfsc status,z
   bsf _np_temp10,0
   comf _np_temp3,w
   addwf _np_temp12,w
   movwf _np_temp3
   btfsc status,z
   bsf _np_temp10,0
   bcf status,c
   btfsc _np_temp10,0
   bsf status,c
   comf _np_temp4,1
   comf _np_temp3,1
   bcf status,c
   rrf _np_temp3,1
   rrf _np_temp4,1
   movf _np_temp4,w
   movwf _np_temp1
   movf _np_temp3,w
   movwf _np_temp2
   clrf _np_temp3
   clrf _np_temp4
   movlw b'11101000'
   movwf _np_temp5
   movlw b'00000001'
   movwf _np_temp6
   movlw b'00000000'
   movwf _np_temp7
   movlw b'00000000'
   movwf _np_temp8

   clrf _np_temp10
   clrf _np_temp11
   clrf _np_temp12
   clrf _np_temp13
   movlw .32
   movwf _np_temp9
rutusr_011_6_m__a
   btfss _np_temp5,0
   goto rutusr_011_6_m__b
   movf _np_temp1,w
   addwf _np_temp10,1
   bcf status,z
   btfsc status,c
   incf _np_temp11,1
   btfsc status,z
   incf _np_temp12,1
   btfsc status,z
   incf _np_temp13,1
   movf _np_temp2,w
   addwf _np_temp11,1
   bcf status,z
   btfsc status,c
   incf _np_temp12,1
   btfsc status,z
   incf _np_temp13,1
   movf _np_temp3,w
   addwf _np_temp12,1
   btfsc status,c
   incf _np_temp13,1
   movf _np_temp4,w
   addwf _np_temp13,1
rutusr_011_6_m__b
   bcf status,c
   rlf _np_temp1,1
   rlf _np_temp2,1
   rlf _np_temp3,1
   rlf _np_temp4,1
   bcf status,c
   btfsc _np_temp5,0
   bsf status,c
   rrf _np_temp8,1
   rrf _np_temp7,1
   rrf _np_temp6,1
   rrf _np_temp5,1
   decfsz _np_temp9,1
   goto rutusr_011_6_m__a
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_temp10,w
   movwf _np_temp1
   movf _np_temp11,w
   movwf _np_temp2
   movf _np_temp12,w
   movwf _np_temp3
   movf _np_temp13,w
   movwf _np_temp4
   movlw b'11101000'
   movwf _np_temp5
   movlw b'00000011'
   movwf _np_temp6
   movlw b'00000000'
   movwf _np_temp7
   movlw b'00000000'
   movwf _np_temp8

rutusr_011_6_d__d32_auto_c1
   clrf _np_temp9
   clrf _np_temp10
   clrf _np_temp11
   clrf _np_temp12
   movlw .32
   movwf _np_temp13
rutusr_011_6_d__d32_auto_a
   call rutusr_011_6_d__d32_auto_d  ;llamada a rutina rutusr_011_6_d__d32_auto_d
   movf _np_temp8,w
   subwf _np_temp12,w
   btfss status,z
   goto rutusr_011_6_d__d32_auto_b
   movf _np_temp7,w
   subwf _np_temp11,w
   btfss status,z
   goto rutusr_011_6_d__d32_auto_b
   movf _np_temp6,w
   subwf _np_temp10,w
   btfss status,z
   goto rutusr_011_6_d__d32_auto_b
   movf _np_temp5,w
   subwf _np_temp9,w
rutusr_011_6_d__d32_auto_b
   btfss status,c
   goto rutusr_011_6_d__d32_auto_c  ;-
   movf _np_temp5,w
   subwf _np_temp9,1
   movf _np_temp6,w
   btfss status,c
   incfsz _np_temp6,w
   subwf _np_temp10,1
   movf _np_temp7,w
   btfss status,c
   incfsz _np_temp7,w
   subwf _np_temp11,1
   movf _np_temp8,w
   btfss status,c
   incfsz _np_temp8,w
   subwf _np_temp12,1
   bcf status,c
   bsf _np_temp1,0
rutusr_011_6_d__d32_auto_c
   decfsz _np_temp13,1
   goto rutusr_011_6_d__d32_auto_a
   goto rutusr_011_6_d__d32_auto_s
rutusr_011_6_d__d32_auto_d
   rlf _np_temp1,1
   rlf _np_temp2,1
   rlf _np_temp3,1
   rlf _np_temp4,1
   rlf _np_temp9,1
   rlf _np_temp10,1
   rlf _np_temp11,1
   rlf _np_temp12,1
   return
rutusr_011_6_d__d32_auto_s
   bcf _np_temp4,7
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   incf _np_temp1,1
   btfsc status,z
   incf _np_temp2,1
   movf _np_temp1,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_2_l
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_temp2,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_2_h
   movf in_ana_2_h,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_bcd_temp1
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_2_l,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_bcd_temp2
   call conv_16_bcd_p2              ;llamada a rutina conv_16_bcd
   call dy4_disp_7_seg_01_p2        ;llamada a rutina dy4_disp_7_seg_01
   movf _np_bcd_temp3,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_2_uni
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_bcd_temp4,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_2_dec
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_bcd_temp5,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_2_cen
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_bcd_temp6,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_2_u_mil
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_bcd_temp7,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_2_d_mil
   movlw b'01001001'
   bcf status,rp0                   ;cambiar a banco 0
   movwf adcon0
   bsf status,rp0                   ;cambiar a banco 1
   clrf in_ana_3_l
   clrf in_ana_3_h

   bsf adcon1,adfm                  ;alinear el resultado a la derecha
   bcf status,rp0                   ;cambiar a banco 0
   clrf _np_temp3
   clrf _np_temp4
   clrf _np_temp6
   clrf _np_temp7
   clrf _np_temp8
   clrf _np_temp9
   movlw .4
   movwf _np_temp5
rutusr_011_5_ciclos
   movlw .10
   movwf _np_temp1
rutusr_011_5_t
   decfsz _np_temp1,1
   goto rutusr_011_5_t
   bsf adcon0,go_done
   nop
   nop
rutusr_011_5_f
   btfsc adcon0,go_done
   goto rutusr_011_5_f
   bsf status,rp0                   ;cambiar a banco 1
   movf adresl,w
   movwf in_ana_3_l
   bcf status,rp0                   ;cambiar a banco 0
   movf adresh,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_3_h
   movf in_ana_3_l,w
   bcf status,rp0                   ;cambiar a banco 0
   addwf _np_temp4,1
   btfsc status,c
   incf _np_temp3,1
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_3_h,w
   bcf status,rp0                   ;cambiar a banco 0
   addwf _np_temp3,1
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_3_h,w
   bcf status,rp0                   ;cambiar a banco 0
   subwf _np_temp6,w
   btfss status,c
   goto rutusr_011_5_max
   btfss status,z
   goto rutusr_011_5_max_n
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_3_l,w
   btfsc status,c
   bcf status,rp0                   ;cambiar a banco 0
   subwf _np_temp7,w
   btfsc status,c
   goto rutusr_011_5_max_n
rutusr_011_5_max
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_3_l,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_temp7
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_3_h,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_temp6
rutusr_011_5_max_n
   bsf status,c
   movf _np_temp8,w
   xorlw b'00000000'
   btfss status,z
   bcf status,c
   movf _np_temp9,w
   xorlw b'00000000'
   btfss status,z
   bcf status,c
   btfsc status,c
   goto rutusr_011_5_min_2
   movf _np_temp8,w
   bsf status,rp0                   ;cambiar a banco 1
   subwf in_ana_3_h,w
   btfss status,c
   goto rutusr_011_5_min_1
   btfss status,z
   bsf status,c
   btfss status,z
   goto rutusr_011_5_min_1
   btfsc status,c
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_temp9,w
   btfsc status,c
   bsf status,rp0                   ;cambiar a banco 1
   subwf in_ana_3_l,w
rutusr_011_5_min_1
   btfsc status,c
   goto rutusr_011_5_min_n
rutusr_011_5_min_2
   movf in_ana_3_l,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_temp9
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_3_h,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_temp8
rutusr_011_5_min_n

   movlw .1
   call tmp_1_mc_p2                 ;llamada a rutina tmp_1_mc
   decfsz _np_temp5,1
   goto rutusr_011_5_ciclos
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf _np_temp10
   movf _np_temp7,w
   movwf _np_temp11
   movf _np_temp6,w
   movwf _np_temp12
   comf _np_temp4,w
   addwf _np_temp11,w
   movwf _np_temp4
   bcf status,z
   btfsc status,c
   incf _np_temp12,1
   btfsc status,z
   bsf _np_temp10,0
   comf _np_temp3,w
   addwf _np_temp12,w
   movwf _np_temp3
   btfsc status,z
   bsf _np_temp10,0
   bcf status,c
   btfsc _np_temp10,0
   bsf status,c
   comf _np_temp4,1
   comf _np_temp3,1
   clrf _np_temp10
   movf _np_temp9,w
   movwf _np_temp11
   movf _np_temp8,w
   movwf _np_temp12
   comf _np_temp4,w
   addwf _np_temp11,w
   movwf _np_temp4
   bcf status,z
   btfsc status,c
   incf _np_temp12,1
   btfsc status,z
   bsf _np_temp10,0
   comf _np_temp3,w
   addwf _np_temp12,w
   movwf _np_temp3
   btfsc status,z
   bsf _np_temp10,0
   bcf status,c
   btfsc _np_temp10,0
   bsf status,c
   comf _np_temp4,1
   comf _np_temp3,1
   bcf status,c
   rrf _np_temp3,1
   rrf _np_temp4,1
   movf _np_temp4,w
   movwf _np_temp1
   movf _np_temp3,w
   movwf _np_temp2
   clrf _np_temp3
   clrf _np_temp4
   movlw b'11101000'
   movwf _np_temp5
   movlw b'00000001'
   movwf _np_temp6
   movlw b'00000000'
   movwf _np_temp7
   movlw b'00000000'
   movwf _np_temp8

   clrf _np_temp10
   clrf _np_temp11
   clrf _np_temp12
   clrf _np_temp13
   movlw .32
   movwf _np_temp9
rutusr_011_5_m__a
   btfss _np_temp5,0
   goto rutusr_011_5_m__b
   movf _np_temp1,w
   addwf _np_temp10,1
   bcf status,z
   btfsc status,c
   incf _np_temp11,1
   btfsc status,z
   incf _np_temp12,1
   btfsc status,z
   incf _np_temp13,1
   movf _np_temp2,w
   addwf _np_temp11,1
   bcf status,z
   btfsc status,c
   incf _np_temp12,1
   btfsc status,z
   incf _np_temp13,1
   movf _np_temp3,w
   addwf _np_temp12,1
   btfsc status,c
   incf _np_temp13,1
   movf _np_temp4,w
   addwf _np_temp13,1
rutusr_011_5_m__b
   bcf status,c
   rlf _np_temp1,1
   rlf _np_temp2,1
   rlf _np_temp3,1
   rlf _np_temp4,1
   bcf status,c
   btfsc _np_temp5,0
   bsf status,c
   rrf _np_temp8,1
   rrf _np_temp7,1
   rrf _np_temp6,1
   rrf _np_temp5,1
   decfsz _np_temp9,1
   goto rutusr_011_5_m__a
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_temp10,w
   movwf _np_temp1
   movf _np_temp11,w
   movwf _np_temp2
   movf _np_temp12,w
   movwf _np_temp3
   movf _np_temp13,w
   movwf _np_temp4
   movlw b'11101000'
   movwf _np_temp5
   movlw b'00000011'
   movwf _np_temp6
   movlw b'00000000'
   movwf _np_temp7
   movlw b'00000000'
   movwf _np_temp8

rutusr_011_5_d__d32_auto_c1
   clrf _np_temp9
   clrf _np_temp10
   clrf _np_temp11
   clrf _np_temp12
   movlw .32
   movwf _np_temp13
rutusr_011_5_d__d32_auto_a
   call rutusr_011_5_d__d32_auto_d  ;llamada a rutina rutusr_011_5_d__d32_auto_d
   movf _np_temp8,w
   subwf _np_temp12,w
   btfss status,z
   goto rutusr_011_5_d__d32_auto_b
   movf _np_temp7,w
   subwf _np_temp11,w
   btfss status,z
   goto rutusr_011_5_d__d32_auto_b
   movf _np_temp6,w
   subwf _np_temp10,w
   btfss status,z
   goto rutusr_011_5_d__d32_auto_b
   movf _np_temp5,w
   subwf _np_temp9,w
rutusr_011_5_d__d32_auto_b
   btfss status,c
   goto rutusr_011_5_d__d32_auto_c  ;-
   movf _np_temp5,w
   subwf _np_temp9,1
   movf _np_temp6,w
   btfss status,c
   incfsz _np_temp6,w
   subwf _np_temp10,1
   movf _np_temp7,w
   btfss status,c
   incfsz _np_temp7,w
   subwf _np_temp11,1
   movf _np_temp8,w
   btfss status,c
   incfsz _np_temp8,w
   subwf _np_temp12,1
   bcf status,c
   bsf _np_temp1,0
rutusr_011_5_d__d32_auto_c
   decfsz _np_temp13,1
   goto rutusr_011_5_d__d32_auto_a
   goto rutusr_011_5_d__d32_auto_s
rutusr_011_5_d__d32_auto_d
   rlf _np_temp1,1
   rlf _np_temp2,1
   rlf _np_temp3,1
   rlf _np_temp4,1
   rlf _np_temp9,1
   rlf _np_temp10,1
   rlf _np_temp11,1
   rlf _np_temp12,1
   return
rutusr_011_5_d__d32_auto_s
   bcf _np_temp4,7
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   incf _np_temp1,1
   btfsc status,z
   incf _np_temp2,1
   movf _np_temp1,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_3_l
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_temp2,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_3_h
   movf in_ana_3_h,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_bcd_temp1
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_3_l,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_bcd_temp2
   call conv_16_bcd_p2              ;llamada a rutina conv_16_bcd
   call dy4_disp_7_seg_01_p2        ;llamada a rutina dy4_disp_7_seg_01
   movf _np_bcd_temp3,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_3_uni
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_bcd_temp4,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_3_dec
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_bcd_temp5,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_3_cen
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_bcd_temp6,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_3_u_mil
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_bcd_temp7,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_3_d_mil
   movlw b'01001101'
   bcf status,rp0                   ;cambiar a banco 0
   movwf adcon0
   bsf status,rp0                   ;cambiar a banco 1
   clrf in_ana_4_l
   clrf in_ana_4_h

   bsf adcon1,adfm                  ;alinear el resultado a la derecha
   bcf status,rp0                   ;cambiar a banco 0
   clrf _np_temp3
   clrf _np_temp4
   clrf _np_temp6
   clrf _np_temp7
   clrf _np_temp8
   clrf _np_temp9
   movlw .4
   movwf _np_temp5
rutusr_011_7_ciclos
   movlw .10
   movwf _np_temp1
rutusr_011_7_t
   decfsz _np_temp1,1
   goto rutusr_011_7_t
   bsf adcon0,go_done
   nop
   nop
rutusr_011_7_f
   btfsc adcon0,go_done
   goto rutusr_011_7_f
   bsf status,rp0                   ;cambiar a banco 1
   movf adresl,w
   movwf in_ana_4_l
   bcf status,rp0                   ;cambiar a banco 0
   movf adresh,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_4_h
   movf in_ana_4_l,w
   bcf status,rp0                   ;cambiar a banco 0
   addwf _np_temp4,1
   btfsc status,c
   incf _np_temp3,1
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_4_h,w
   bcf status,rp0                   ;cambiar a banco 0
   addwf _np_temp3,1
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_4_h,w
   bcf status,rp0                   ;cambiar a banco 0
   subwf _np_temp6,w
   btfss status,c
   goto rutusr_011_7_max
   btfss status,z
   goto rutusr_011_7_max_n
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_4_l,w
   btfsc status,c
   bcf status,rp0                   ;cambiar a banco 0
   subwf _np_temp7,w
   btfsc status,c
   goto rutusr_011_7_max_n
rutusr_011_7_max
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_4_l,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_temp7
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_4_h,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_temp6
rutusr_011_7_max_n
   bsf status,c
   movf _np_temp8,w
   xorlw b'00000000'
   btfss status,z
   bcf status,c
   movf _np_temp9,w
   xorlw b'00000000'
   btfss status,z
   bcf status,c
   btfsc status,c
   goto rutusr_011_7_min_2
   movf _np_temp8,w
   bsf status,rp0                   ;cambiar a banco 1
   subwf in_ana_4_h,w
   btfss status,c
   goto rutusr_011_7_min_1
   btfss status,z
   bsf status,c
   btfss status,z
   goto rutusr_011_7_min_1
   btfsc status,c
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_temp9,w
   btfsc status,c
   bsf status,rp0                   ;cambiar a banco 1
   subwf in_ana_4_l,w
rutusr_011_7_min_1
   btfsc status,c
   goto rutusr_011_7_min_n
rutusr_011_7_min_2
   movf in_ana_4_l,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_temp9
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_4_h,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_temp8
rutusr_011_7_min_n

   movlw .1
   call tmp_1_mc_p2                 ;llamada a rutina tmp_1_mc
   decfsz _np_temp5,1
   goto rutusr_011_7_ciclos
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf _np_temp10
   movf _np_temp7,w
   movwf _np_temp11
   movf _np_temp6,w
   movwf _np_temp12
   comf _np_temp4,w
   addwf _np_temp11,w
   movwf _np_temp4
   bcf status,z
   btfsc status,c
   incf _np_temp12,1
   btfsc status,z
   bsf _np_temp10,0
   comf _np_temp3,w
   addwf _np_temp12,w
   movwf _np_temp3
   btfsc status,z
   bsf _np_temp10,0
   bcf status,c
   btfsc _np_temp10,0
   bsf status,c
   comf _np_temp4,1
   comf _np_temp3,1
   clrf _np_temp10
   movf _np_temp9,w
   movwf _np_temp11
   movf _np_temp8,w
   movwf _np_temp12
   comf _np_temp4,w
   addwf _np_temp11,w
   movwf _np_temp4
   bcf status,z
   btfsc status,c
   incf _np_temp12,1
   btfsc status,z
   bsf _np_temp10,0
   comf _np_temp3,w
   addwf _np_temp12,w
   movwf _np_temp3
   btfsc status,z
   bsf _np_temp10,0
   bcf status,c
   btfsc _np_temp10,0
   bsf status,c
   comf _np_temp4,1
   comf _np_temp3,1
   bcf status,c
   rrf _np_temp3,1
   rrf _np_temp4,1
   movf _np_temp4,w
   movwf _np_temp1
   movf _np_temp3,w
   movwf _np_temp2
   clrf _np_temp3
   clrf _np_temp4
   movlw b'11101000'
   movwf _np_temp5
   movlw b'00000001'
   movwf _np_temp6
   movlw b'00000000'
   movwf _np_temp7
   movlw b'00000000'
   movwf _np_temp8

   clrf _np_temp10
   clrf _np_temp11
   clrf _np_temp12
   clrf _np_temp13
   movlw .32
   movwf _np_temp9
rutusr_011_7_m__a
   btfss _np_temp5,0
   goto rutusr_011_7_m__b
   movf _np_temp1,w
   addwf _np_temp10,1
   bcf status,z
   btfsc status,c
   incf _np_temp11,1
   btfsc status,z
   incf _np_temp12,1
   btfsc status,z
   incf _np_temp13,1
   movf _np_temp2,w
   addwf _np_temp11,1
   bcf status,z
   btfsc status,c
   incf _np_temp12,1
   btfsc status,z
   incf _np_temp13,1
   movf _np_temp3,w
   addwf _np_temp12,1
   btfsc status,c
   incf _np_temp13,1
   movf _np_temp4,w
   addwf _np_temp13,1
rutusr_011_7_m__b
   bcf status,c
   rlf _np_temp1,1
   rlf _np_temp2,1
   rlf _np_temp3,1
   rlf _np_temp4,1
   bcf status,c
   btfsc _np_temp5,0
   bsf status,c
   rrf _np_temp8,1
   rrf _np_temp7,1
   rrf _np_temp6,1
   rrf _np_temp5,1
   decfsz _np_temp9,1
   goto rutusr_011_7_m__a
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movf _np_temp10,w
   movwf _np_temp1
   movf _np_temp11,w
   movwf _np_temp2
   movf _np_temp12,w
   movwf _np_temp3
   movf _np_temp13,w
   movwf _np_temp4
   movlw b'11101000'
   movwf _np_temp5
   movlw b'00000011'
   movwf _np_temp6
   movlw b'00000000'
   movwf _np_temp7
   movlw b'00000000'
   movwf _np_temp8

rutusr_011_7_d__d32_auto_c1
   clrf _np_temp9
   clrf _np_temp10
   clrf _np_temp11
   clrf _np_temp12
   movlw .32
   movwf _np_temp13
rutusr_011_7_d__d32_auto_a
   call rutusr_011_7_d__d32_auto_d  ;llamada a rutina rutusr_011_7_d__d32_auto_d
   movf _np_temp8,w
   subwf _np_temp12,w
   btfss status,z
   goto rutusr_011_7_d__d32_auto_b
   movf _np_temp7,w
   subwf _np_temp11,w
   btfss status,z
   goto rutusr_011_7_d__d32_auto_b
   movf _np_temp6,w
   subwf _np_temp10,w
   btfss status,z
   goto rutusr_011_7_d__d32_auto_b
   movf _np_temp5,w
   subwf _np_temp9,w
rutusr_011_7_d__d32_auto_b
   btfss status,c
   goto rutusr_011_7_d__d32_auto_c  ;-
   movf _np_temp5,w
   subwf _np_temp9,1
   movf _np_temp6,w
   btfss status,c
   incfsz _np_temp6,w
   subwf _np_temp10,1
   movf _np_temp7,w
   btfss status,c
   incfsz _np_temp7,w
   subwf _np_temp11,1
   movf _np_temp8,w
   btfss status,c
   incfsz _np_temp8,w
   subwf _np_temp12,1
   bcf status,c
   bsf _np_temp1,0
rutusr_011_7_d__d32_auto_c
   decfsz _np_temp13,1
   goto rutusr_011_7_d__d32_auto_a
   goto rutusr_011_7_d__d32_auto_s
rutusr_011_7_d__d32_auto_d
   rlf _np_temp1,1
   rlf _np_temp2,1
   rlf _np_temp3,1
   rlf _np_temp4,1
   rlf _np_temp9,1
   rlf _np_temp10,1
   rlf _np_temp11,1
   rlf _np_temp12,1
   return
rutusr_011_7_d__d32_auto_s
   bcf _np_temp4,7
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   incf _np_temp1,1
   btfsc status,z
   incf _np_temp2,1
   movf _np_temp1,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_4_l
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_temp2,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_4_h
   movf in_ana_4_h,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_bcd_temp1
   bsf status,rp0                   ;cambiar a banco 1
   movf in_ana_4_l,w
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_bcd_temp2
   call conv_16_bcd_p2              ;llamada a rutina conv_16_bcd
   call dy4_disp_7_seg_01_p2        ;llamada a rutina dy4_disp_7_seg_01
   movf _np_bcd_temp3,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_4_uni
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_bcd_temp4,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_4_dec
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_bcd_temp5,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_4_cen
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_bcd_temp6,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_4_u_mil
   bcf status,rp0                   ;cambiar a banco 0
   movf _np_bcd_temp7,w
   bsf status,rp0                   ;cambiar a banco 1
   movwf in_ana_4_d_mil
   movlw b'00000001'
   bcf status,rp0                   ;cambiar a banco 0
   movwf _np_nro_lcd

   call rutusr_002_p2               ;llamada a rutina usr_lcd_ver_analogicas

   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   movf seleccion,w                 ;si seleccion <> d'2'
   xorlw d'2'
   btfsc status,z
   goto rutusr_011_4
   bcf status,rp0                   ;cambiar a banco 0
   bcf porta,segmento_1
   bcf porta,segmento_2
   bcf porte,segmento_3
rutusr_011_8
   goto rutusr_011__salir
rutusr_011__salir

   goto retorno_rutinas_pag_2





;------------------------------------------------------------
;        Llamar las Rutinas de otras paginas de memoria
;------------------------------------------------------------

cpila2
   bcf status,rp0                   ;Cambiar a banco 0
   bcf status,rp1
   bsf status,c                     ;llamar a rutina de pagina de memoria 0
   rlf _np_pag_2,1
   rlf _np_pag_1,1
   bcf status,c
   rlf _np_pag_2,1
   rlf _np_pag_1,1
   bsf status,c
   rlf _np_camb_pag,1
   return

ncpila2
   bcf status,rp0                   ;Cambiar a banco 0
   bcf status,rp1
   bcf status,c
   rlf _np_camb_pag,1
   return

rutusr_002_p2
   call cpila2
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bsf pclath,4
   goto rutusr_002

conv_16_bcd_p2
   call cpila2
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto conv_16_bcd

dy4_disp_7_seg_01_p2
   call cpila2
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto dy4_disp_7_seg_01

tmp_1_mc_p2
   call cpila2
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto tmp_1_mc


retorno_rutinas_pag_2
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf status,c
   rrf _np_camb_pag,1
   btfss status,c
   return
   btfsc _np_pag_2,0
   bsf pclath,3
   btfss _np_pag_2,0
   bcf pclath,3
   btfsc _np_pag_2,1
   bsf pclath,4
   btfss _np_pag_2,1
   bcf pclath,4
   bcf status,c
   rrf _np_pag_1,1
   rrf _np_pag_2,1
   bcf status,c
   rrf _np_pag_1,1
   rrf _np_pag_2,1
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


;************************************************************
   org 0x1800                       ;página 3
;**************************************************


;------------------------------------------------------------
;                  Declaración de Subrutinas
;------------------------------------------------------------

; usr_lcd_ver_analogicas
rutusr_002
   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

   movlw .1
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_nro_msj
   call lcd_mensaje_actual_p3       ;llamada a rutina lcd_mensaje_actual
   btfss _np_msj_act,0
   goto rutusr_002_2_nc
   movlw b'00001100'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw b'00000001'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
rutusr_002_2_nc
   movlw b'10000000'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .118                       ;v
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .97                        ;a
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .108                       ;l
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .111                       ;o
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .114                       ;r
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .61                        ;=
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'10001000'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .46                        ;.
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'10001101'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .46                        ;.
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11000000'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .97                        ;a
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .110                       ;n
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .97                        ;a
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .108                       ;l
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .111                       ;o
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .103                       ;g
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .61                        ;=
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11001000'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .46                        ;.
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11001101'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .46                        ;.
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
rutusr_002_2_var
   movlw b'10000111'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   movf in_ana_1_cen,w              ;enviar la variable in_ana_1_cen al lcd.
   addlw .48
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'10001001'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   movf in_ana_1_dec,w              ;enviar la variable in_ana_1_dec al lcd.
   addlw .48
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'10001010'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   movf in_ana_1_uni,w              ;enviar la variable in_ana_1_uni al lcd.
   addlw .48
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'10001100'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   movf in_ana_2_cen,w              ;enviar la variable in_ana_2_cen al lcd.
   addlw .48
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'10001110'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   movf in_ana_2_dec,w              ;enviar la variable in_ana_2_dec al lcd.
   addlw .48
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'10001111'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   movf in_ana_2_uni,w              ;enviar la variable in_ana_2_uni al lcd.
   addlw .48
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11000111'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   movf in_ana_3_cen,w              ;enviar la variable in_ana_3_cen al lcd.
   addlw .48
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11001001'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   movf in_ana_3_dec,w              ;enviar la variable in_ana_3_dec al lcd.
   addlw .48
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11001010'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   movf in_ana_3_uni,w              ;enviar la variable in_ana_3_uni al lcd.
   addlw .48
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11001100'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   movf in_ana_4_cen,w              ;enviar la variable in_ana_4_cen al lcd.
   addlw .48
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11001110'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   movf in_ana_4_dec,w              ;enviar la variable in_ana_4_dec al lcd.
   addlw .48
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11001111'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   movf in_ana_4_uni,w              ;enviar la variable in_ana_4_uni al lcd.
   addlw .48
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   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

rutusr_002_3
   goto rutusr_002__salir
rutusr_002__salir

   goto retorno_rutinas_pag_3



; usr_lcd_ver_digitales
rutusr_003
   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

   movlw .2
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_nro_msj
   call lcd_mensaje_actual_p3       ;llamada a rutina lcd_mensaje_actual
   btfss _np_msj_act,0
   goto rutusr_003_2_nc
   movlw b'00001100'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw b'00000001'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
rutusr_003_2_nc
   movlw b'10000000'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .101                       ;e
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .110                       ;n
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .116                       ;t
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .114                       ;r
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .97                        ;a
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .100                       ;d
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .97                        ;a
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .115                       ;s
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .32                        ;espacio
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .100                       ;d
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .105                       ;i
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .103                       ;g
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .105                       ;i
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .116                       ;t
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .46                        ;.
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
rutusr_003_2_var
   movlw b'11000011'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .48                        ;enviar la variable bits in_digitales al lcd.
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   btfsc in_digitales,7             ;enviar la variable bit.
   movlw .49                        ;enviar la variable bits in_digitales al lcd.
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11000100'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .48                        ;enviar la variable bits in_digitales al lcd.
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   btfsc in_digitales,6             ;enviar la variable bit.
   movlw .49                        ;enviar la variable bits in_digitales al lcd.
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11000101'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .48                        ;enviar la variable bits in_digitales al lcd.
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   btfsc in_digitales,5             ;enviar la variable bit.
   movlw .49                        ;enviar la variable bits in_digitales al lcd.
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11000110'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .48                        ;enviar la variable bits in_digitales al lcd.
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   btfsc in_digitales,4             ;enviar la variable bit.
   movlw .49                        ;enviar la variable bits in_digitales al lcd.
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11000111'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .48                        ;enviar la variable bits in_digitales al lcd.
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   btfsc in_digitales,3             ;enviar la variable bit.
   movlw .49                        ;enviar la variable bits in_digitales al lcd.
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11001000'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .48                        ;enviar la variable bits in_digitales al lcd.
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   btfsc in_digitales,2             ;enviar la variable bit.
   movlw .49                        ;enviar la variable bits in_digitales al lcd.
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11001001'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .48                        ;enviar la variable bits in_digitales al lcd.
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   btfsc in_digitales,1             ;enviar la variable bit.
   movlw .49                        ;enviar la variable bits in_digitales al lcd.
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11001010'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .48                        ;enviar la variable bits in_digitales al lcd.
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   btfsc in_digitales,0             ;enviar la variable bit.
   movlw .49                        ;enviar la variable bits in_digitales al lcd.
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   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

rutusr_003_3
   goto rutusr_003__salir
rutusr_003__salir

   goto retorno_rutinas_pag_3



; usr_lcd_ver_temperatura
rutusr_004
   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

   movlw .3
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_nro_msj
   call lcd_mensaje_actual_p3       ;llamada a rutina lcd_mensaje_actual
   btfss _np_msj_act,0
   goto rutusr_004_2_nc
   movlw b'00001100'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw b'00000001'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
rutusr_004_2_nc
   movlw b'10000010'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .116                       ;t
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .101                       ;e
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .109                       ;m
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .112                       ;p
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .101                       ;e
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .114                       ;r
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .97                        ;a
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .116                       ;t
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .117                       ;u
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .114                       ;r
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .97                        ;a
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11001001'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .67                        ;c
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
rutusr_004_2_var
   movlw b'11000101'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   movf temperatura_u_mil,w         ;enviar la variable temperatura_u_mil al lcd.
   addlw .48
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11000110'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   movf temperatura_cen,w           ;enviar la variable temperatura_cen al lcd.
   addlw .48
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11000111'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   bsf status,rp0                   ;cambiar a banco 1
   bcf status,rp1
   movf temperatura_dec,w           ;enviar la variable temperatura_dec al lcd.
   addlw .48
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11001000'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movf grados,w                    ;enviar la variable grados al lcd.
   addlw .48
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   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

rutusr_004_3
   goto rutusr_004__salir
rutusr_004__salir

   goto retorno_rutinas_pag_3



; usr_lcd_ver_espera_seleccion
rutusr_005
   bcf status,c
   btfsc intcon,gie
   bsf status,c
   rlf _np_actint_b,1
   rlf _np_actint_a,1
   bcf intcon,gie

   movlw .4
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_nro_msj
   call lcd_mensaje_actual_p3       ;llamada a rutina lcd_mensaje_actual
   btfss _np_msj_act,0
   goto rutusr_005_2_nc
   movlw b'00001100'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw b'00000001'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
rutusr_005_2_nc
   movlw b'10000011'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .101                       ;e
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .115                       ;s
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .112                       ;p
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .101                       ;e
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .114                       ;r
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .97                        ;a
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .110                       ;n
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .100                       ;d
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .111                       ;o
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11000011'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .115                       ;s
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .101                       ;e
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .108                       ;l
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .101                       ;e
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .99                        ;c
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .99                        ;c
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .105                       ;i
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .111                       ;o
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .110                       ;n
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   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

rutusr_005_3
   goto rutusr_005__salir
rutusr_005__salir

   goto retorno_rutinas_pag_3



; usr_lcd_ver_7segmentos
rutusr_006
   bcf status,c
   btfsc intcon,gie
   bsf status,c
   rlf _np_actint_b,1
   rlf _np_actint_a,1
   bcf intcon,gie

   movlw .5
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_nro_msj
   call lcd_mensaje_actual_p3       ;llamada a rutina lcd_mensaje_actual
   btfss _np_msj_act,0
   goto rutusr_006_2_nc
   movlw b'00001100'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw b'00000001'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
rutusr_006_2_nc
   movlw b'10000101'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .115                       ;s
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .105                       ;i
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .101                       ;e
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .116                       ;t
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .101                       ;e
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11000011'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .115                       ;s
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .101                       ;e
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .103                       ;g
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .109                       ;m
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .101                       ;e
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .110                       ;n
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .116                       ;t
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .111                       ;o
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .115                       ;s
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   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

rutusr_006_3
   goto rutusr_006__salir
rutusr_006__salir

   goto retorno_rutinas_pag_3



; usr_lcd_ver_grabado_eeprom
rutusr_010
   bcf status,c
   btfsc intcon,gie
   bsf status,c
   rlf _np_actint_b,1
   rlf _np_actint_a,1
   bcf intcon,gie

   movlw .7
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_nro_msj
   call lcd_mensaje_actual_p3       ;llamada a rutina lcd_mensaje_actual
   btfss _np_msj_act,0
   goto rutusr_010_2_nc
   movlw b'00001100'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw b'00000001'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
rutusr_010_2_nc
   movlw b'10000100'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .69                        ;e
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .69                        ;e
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .80                        ;p
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .82                        ;r
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .79                        ;o
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .77                        ;m
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .32                        ;espacio
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw b'11000100'
   call lcd_comando_p3              ;llamada a rutina lcd_comando
   movlw .71                        ;g
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .82                        ;r
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .65                        ;a
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .66                        ;b
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .65                        ;a
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .68                        ;d
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   movlw .65                        ;a
   call lcd_caracter_p3             ;llamada a rutina lcd_caracter
   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

rutusr_010_3
   goto rutusr_010__salir
rutusr_010__salir

   goto retorno_rutinas_pag_3





;------------------------------------------------------------
;        Llamar las Rutinas de otras paginas de memoria
;------------------------------------------------------------

cpila3
   bcf status,rp0                   ;Cambiar a banco 0
   bcf status,rp1
   bsf status,c                     ;llamar a rutina de pagina de memoria 0
   rlf _np_pag_2,1
   rlf _np_pag_1,1
   bsf status,c
   rlf _np_pag_2,1
   rlf _np_pag_1,1
   bsf status,c
   rlf _np_camb_pag,1
   return

ncpila3
   bcf status,rp0                   ;Cambiar a banco 0
   bcf status,rp1
   bcf status,c
   rlf _np_camb_pag,1
   return

lcd_mensaje_actual_p3
   call cpila3
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto lcd_mensaje_actual

lcd_comando_p3
   call cpila3
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto lcd_comando

lcd_caracter_p3
   call cpila3
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bsf pclath,3
   bcf pclath,4
   goto lcd_caracter


retorno_rutinas_pag_3
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf status,c
   rrf _np_camb_pag,1
   btfss status,c
   return
   btfsc _np_pag_2,0
   bsf pclath,3
   btfss _np_pag_2,0
   bcf pclath,3
   btfsc _np_pag_2,1
   bsf pclath,4
   btfss _np_pag_2,1
   bcf pclath,4
   bcf status,c
   rrf _np_pag_1,1
   rrf _np_pag_2,1
   bcf status,c
   rrf _np_pag_1,1
   rrf _np_pag_2,1
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return



;------------------------------------------------------------
;        Llamar las Rutinas de otras paginas de memoria
;------------------------------------------------------------

cpila7

   return

ncpila7
   bcf status,rp0                   ;Cambiar a banco 0
   bcf status,rp1
   bcf status,c
   rlf _np_camb_pag,1
   return

ds18b20_d3_leer_p7

   goto ds18b20_d3_leer


retorno_rutinas_pag_7
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   bcf status,c
   rrf _np_camb_pag,1
   btfss status,c
   return
   btfsc _np_pag_2,0
   bsf pclath,3
   btfss _np_pag_2,0
   bcf pclath,3
   btfsc _np_pag_2,1
   bsf pclath,4
   btfss _np_pag_2,1
   bcf pclath,4
   bcf status,c
   rrf _np_pag_1,1
   rrf _np_pag_2,1
   bcf status,c
   rrf _np_pag_1,1
   rrf _np_pag_2,1
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   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   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
   data   0xff
   data   0xff
   data   0xff

 End