TODOPIC
Microcontroladores PIC => - Niple - => Mensaje iniciado por: fornell en 08 de Mayo de 2009, 11:30:09
-
hola a todos os escribo por que necesito que me hechen una mano si es posible. Antes de nada utilizo niple completo con llave usb, he estado creando que describo a contnuacion:
Son 2 Circuitos:
1º CIRCUITO: Utilizando un pic 16f873A con cristal de 4Mhz, lcd 16x2, teclado matricial 4x4 y ds75176. El programa debe hacer lo siguiente:
Mostrar mensaje INTROD. PRECIO, despues tecleamos el precio (este debe ser de 4 cifras Obligatoriamente), cuando hemos introducido el precio Mostrar en pantalla PRECIO X.xxx, Cuando X (mayuscula) es diferente a E (hexadecimal) mostrar INTROD. PRODUCTO y Segun si pulsamos F1, F2, F3 o F4 Mostrara el nombre del producto con su precio previamente introducido. Despues de todo es viene la comunicacion RS485 y funciona si RA1 es igual a 1 Mandando 5 registros, Siendo el primero el indice de producto y los cuatro restantes el precio.
Bien despues de todo esto. Lo pruebo en proteus y funciona bien pero en protoboard no anda muy alla. Os adjunto el asambler.
;------------------------------------------------------------
; Código assembler generado por Niple V6.0.1
; Proyecto: teclado lcd
; Autor: ----------
; Fecha: 07/05/2009
; Fabricante: Microchip
; PIC: 16F873A
; Velocidad de reloj: 10 Mhz
; Descripcion: Teclado con comunicacion rs485 y visualizacion en lcd 16x2
;------------------------------------------------------------
LIST P=PIC16F873A
_HS_OSC equ 0x3FFE
_DEBUG_OFF equ 0x3FFF
_WDT_OFF equ 0x3FFB
_PWRTE_ON equ 0x3FF7
_BODEN_OFF equ 0x3FBF
_LVP_OFF equ 0x3F7F
_CPD_OFF equ 0x3FFF
_CP_OFF equ 0x3FFF
_WRT_ENABLE_OFF equ 0x3DFF
__config _HS_OSC & _DEBUG_OFF & _WDT_OFF & _PWRTE_ON & _BODEN_OFF & _LVP_OFF & _CPD_OFF & _WRT_ENABLE_OFF & _CP_OFF
;------------------------------------------------------------
; Declaración de Registros
;------------------------------------------------------------
w equ 0x0000
pcl equ 0x0002
status equ 0x0003
porta equ 0x0005
portb equ 0x0006
portc equ 0x0007
pclath equ 0x000a
intcon equ 0x000b
pir1 equ 0x000c
rcsta equ 0x0018
txreg equ 0x0019
_np_w equ 0x0020
contador_tecla equ 0x0021
tecla equ 0x0022
num_display equ 0x0023
unid equ 0x0024
dece equ 0x0025
cent equ 0x0026
mil equ 0x0027
_np_status equ 0x0028
_np_banderas2 equ 0x0029
_np_temp1 equ 0x002a
_np_temp2 equ 0x002b
_np_temp3 equ 0x002c
_np_resultado equ 0x002f
_np_indice equ 0x0030
_np_tec equ 0x0031
_np_nro_lcd equ 0x0032
_np_msj_act equ 0x0033
_np_nro_msj equ 0x0034
_np_lcd_1 equ 0x0035
_np_tiempo equ 0x0036
_np_tiempo1 equ 0x0038
_np_tiempo2 equ 0x0039
_np_tiempo_inte equ 0x003a
_np_tiempo1_inte equ 0x003c
_np_tiempo2_inte equ 0x003d
_np_tiempo3_inte equ 0x0040
opcion equ 0x0081
trisa equ 0x0085
trisb equ 0x0086
trisc equ 0x0087
txsta equ 0x0098
spbrg equ 0x0099
adcon1 equ 0x009f
;------------------------------------------------------------
; Declaración de Bits
;------------------------------------------------------------
c equ 0 ;carry / borrow bit
gie equ 7 ;habilitador general de interrupciones
ra0 equ 0 ;bit 0 del puerto a
ra1 equ 1 ;bit 1 del puerto a
ra2 equ 2 ;bit 2 delpuerto a
ra3 equ 3 ;bit 3 del puerto a
ra4_t0cki equ 4 ;bit 4 del puerto a o entrada de reloj
ra5 equ 5 ;bit 5 del puerto a
rbie equ 3 ;habilitador de interrupción por cambio de estado puerto b4 a 7
rbif equ 0 ;rb port change interrupt flag bit
rc7 equ 7 ;bit 7 del puerto c
rp0 equ 5 ;registrer bank select bit
rp1 equ 6 ;registrer bank select bit
spen equ 7 ;
txif equ 4 ;bandera de interrupcion por fin de transmisión usart.
z equ 2 ;bit cero
sub_inte equ 0 ;bandera de subrrutina cancelada por interrupcion.
;------------------------------------------------------------
; Inicio
;------------------------------------------------------------
reset org 0
goto paso2
org 4
movwf _np_w
swapf _np_w,1
movf status,w
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
movwf _np_status
btfsc intcon,rbif
goto interrupción_rb47
salir_interrupcion
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
bsf _np_banderas2,sub_inte ;activar la bandera de rutina cancelada por interrupcion
movf _np_status,w
movwf status
swapf _np_w,w
retfie
_np_tabla_teclado
movf _np_indice,0
call _np_tabla_teclado_tabla
movwf _np_resultado
return
_np_tabla_teclado_tabla
addwf pcl,1
retlw 0x00 ; 0
retlw 0x01 ; 1
retlw 0x02 ; 2
retlw 0x03 ; 3
retlw 0xf1 ; f1
retlw 0x04 ; 4
retlw 0x05 ; 5
retlw 0x06 ; 6
retlw 0xf2 ; f2
retlw 0x07 ; 7
retlw 0x08 ; 8
retlw 0x09 ; 9
retlw 0xf3 ; f3
retlw 0x13 ; *
retlw 0x00 ; 0
retlw 0x14 ; #
retlw 0xf4 ; f4
;------------------------------------------------------------
; inicio de la interrupción por rb4 a 7
;------------------------------------------------------------
interrupción_rb47_salir
movf portb,w
bcf intcon,rbif
goto salir_interrupcion
interrupción_rb47
;leer un dato mediante el teclado matricial
call leer_teclado_b0_b1_b2_b3
movf _np_resultado,w
movwf tecla
movlw d'17' ;si el reg tecla < d'17'
subwf tecla,w
btfsc status,c
goto interrupción_rb47_salir
movf tecla,w ;consultar la tabla_np_tabla_teclado
movwf _np_indice
call _np_tabla_teclado
movf _np_resultado,w
movwf tecla
movlw d'4' ;si el reg contador_tecla < d'4'
subwf contador_tecla,w
btfsc status,c
goto inte_rb47_20
incf contador_tecla,1 ;contador_tecla = contador_tecla + 1
movf contador_tecla,w ;si el reg contador_tecla = d'01'
xorlw d'01'
btfss status,z
goto inte_rb47_15
inte_rb47_8
movf tecla,w
movwf unid
call usr_lcd_precio_produc
movf mil,w ;si el reg mil <> 0xe
xorlw 0xe
btfsc status,z
goto interrupción_rb47_salir
movlw .1 ;temporizador 500 mse
call tmp_1_mgc_i
movlw .25
call tmp_100_mc_i
call usr_lcd_intro_produc
inte_rb47_13
goto interrupción_rb47_salir
inte_rb47_15
movf contador_tecla,w ;si el reg contador_tecla = d'02'
xorlw d'02'
btfss status,z
goto inte_rb47_17
inte_rb47_16
movf unid,w
movwf dece
goto inte_rb47_8 ;cierra el ciclo
inte_rb47_17
movf contador_tecla,w ;si el reg contador_tecla = d'03'
xorlw d'03'
btfss status,z
goto inte_rb47_19
inte_rb47_18
movf dece,w
movwf cent
goto inte_rb47_16 ;cierra el ciclo
inte_rb47_19
movf cent,w
movwf mil
goto inte_rb47_18 ;cierra el ciclo
inte_rb47_20
movf tecla,w ;si el reg tecla = 0xf1
xorlw 0xf1
btfss status,z
goto inte_rb47_24
movlw d'1'
movwf num_display
call usr_lcd_sin_95
inte_rb47_23
goto interrupción_rb47_salir
inte_rb47_24
movf tecla,w ;si el reg tecla = 0xf2
xorlw 0xf2
btfss status,z
goto inte_rb47_28
movlw d'2'
movwf num_display
call usr_lcd_sin_98
inte_rb47_27
goto interrupción_rb47_salir
inte_rb47_28
movf tecla,w ;si el reg tecla = 0xf3
xorlw 0xf3
btfss status,z
goto inte_rb47_32
movlw d'3'
movwf num_display
call usr_lcd_diesel
inte_rb47_31
goto interrupción_rb47_salir
inte_rb47_32
movf tecla,w ;si el reg tecla = 0xf4
xorlw 0xf4
btfss status,z
goto interrupción_rb47_salir
movlw d'4'
movwf num_display
call usr_lcd_extra_diesel
inte_rb47_35
goto interrupción_rb47_salir
;------------------------------------------------------------
; programa principal
;------------------------------------------------------------
paso2
ini_reg
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
clrf _np_w
clrf contador_tecla
clrf tecla
clrf num_display
clrf unid
clrf dece
clrf cent
clrf mil
clrf _np_status
clrf _np_banderas2
clrf _np_temp1
clrf _np_temp2
clrf _np_temp3
clrf _np_resultado
clrf _np_indice
clrf _np_tec
clrf _np_nro_lcd
clrf _np_msj_act
clrf _np_nro_msj
clrf _np_lcd_1
clrf _np_tiempo
clrf _np_tiempo1
clrf _np_tiempo2
clrf _np_tiempo_inte
clrf _np_tiempo1_inte
clrf _np_tiempo2_inte
clrf _np_tiempo3_inte
clrf _np_w
n_ini_reg
movlw b'00000010' ;configurar el puerto a como xxsssses
bsf status,rp0 ;cambiar a banco 1
bcf status,rp1
movwf trisa
movlw b'00000111' ;puerto a = e/s digital
movwf adcon1
movlw b'11110000' ;configurar el puerto b como eeeessss
movwf trisb
movlw b'00000000' ;configurar el puerto c como ssssssss
movwf trisc
bcf status,rp0 ;cambiar a banco 0
clrf contador_tecla
clrf tecla
clrf num_display
movlw 0xe
movwf unid
movlw 0xe
movwf dece
movlw 0xe
movwf cent
movlw 0xe
movwf mil
bsf porta,ra0
bsf porta,ra2
bsf porta,ra3
bsf porta,ra4_t0cki
bsf porta,ra5
bsf portc,rc7
movlw b'00000001' ;seleccionar el lcd 1
movwf _np_nro_lcd
clrf _np_lcd_1
call lcd_inicio
call lcd_inicio
call lcd_inicio
call usr_lcd_int_precio
paso20
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
bsf intcon,gie ;activar habilitador general de interrupciones.
bsf intcon,rbie ;activar interrupción por rb4-7.
btfss porta,ra1 ;si el bit ra1 = 0
goto paso23
call usr_transmision
goto paso20 ;cierra el ciclo
paso23
nop
goto paso20 ;cierra el ciclo
;------------------------------------------------------------
; Declaración de Subrutinas
;------------------------------------------------------------
usr_lcd_precio_produc
movlw .6
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
movwf _np_nro_msj
call lcd_mensaje_actual
btfss _np_msj_act,0
goto usr_lcd_precio_produc2nc
movlw b'00001100'
call lcd_comando
movlw b'00000001'
call lcd_comando
usr_lcd_precio_produc2nc
movlw b'10000000'
call lcd_comando
movlw .80 ;p
call lcd_caracter
movlw .82 ;r
call lcd_caracter
movlw .69 ;e
call lcd_caracter
movlw .67 ;c
call lcd_caracter
movlw .73 ;i
call lcd_caracter
movlw .79 ;o
call lcd_caracter
movlw .32 ;espacio
call lcd_caracter
movlw .80 ;p
call lcd_caracter
movlw .82 ;r
call lcd_caracter
movlw .79 ;o
call lcd_caracter
movlw .68 ;d
call lcd_caracter
movlw .85 ;u
call lcd_caracter
movlw .67 ;c
call lcd_caracter
movlw .84 ;t
call lcd_caracter
movlw .79 ;o
call lcd_caracter
movlw b'11000111'
call lcd_comando
movlw .46 ;.
call lcd_caracter
usr_lcd_precio_produc2_var
movlw b'11000110'
call lcd_comando
movf mil,w ;enviar la variable mil al lcd.
addlw .48
call lcd_caracter
movlw b'11001000'
call lcd_comando
movf cent,w ;enviar la variable cent al lcd.
addlw .48
call lcd_caracter
movlw b'11001001'
call lcd_comando
movf dece,w ;enviar la variable dece al lcd.
addlw .48
call lcd_caracter
movlw b'11001010'
call lcd_comando
movf unid,w ;enviar la variable unid al lcd.
addlw .48
call lcd_caracter
usr_lcd_precio_produc3
goto usr_lcd_precio_produc_salir
usr_lcd_precio_produc_salir
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
return
usr_lcd_intro_produc
movlw .1
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
movwf _np_nro_msj
call lcd_mensaje_actual
btfss _np_msj_act,0
goto usr_lcd_intro_produc2nc
movlw b'00001100'
call lcd_comando
movlw b'00000001'
call lcd_comando
usr_lcd_intro_produc2nc
movlw b'10000000'
call lcd_comando
movlw .73 ;i
call lcd_caracter
movlw .78 ;n
call lcd_caracter
movlw .84 ;t
call lcd_caracter
movlw .46 ;.
call lcd_caracter
movlw .32 ;espacio
call lcd_caracter
movlw .80 ;p
call lcd_caracter
movlw .82 ;r
call lcd_caracter
movlw .79 ;o
call lcd_caracter
movlw .68 ;d
call lcd_caracter
movlw .85 ;u
call lcd_caracter
movlw .67 ;c
call lcd_caracter
movlw .84 ;t
call lcd_caracter
movlw .79 ;o
call lcd_caracter
movlw .46 ;.
call lcd_caracter
movlw .46 ;.
call lcd_caracter
usr_lcd_intro_produc3
goto usr_lcd_intro_produc_salir
usr_lcd_intro_produc_salir
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
return
usr_lcd_sin_95
movlw .2
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
movwf _np_nro_msj
call lcd_mensaje_actual
btfss _np_msj_act,0
goto usr_lcd_sin_952nc
movlw b'00001100'
call lcd_comando
movlw b'00000001'
call lcd_comando
usr_lcd_sin_952nc
movlw b'10000000'
call lcd_comando
movlw .83 ;s
call lcd_caracter
movlw .73 ;i
call lcd_caracter
movlw .78 ;n
call lcd_caracter
movlw .32 ;espacio
call lcd_caracter
movlw .80 ;p
call lcd_caracter
movlw .76 ;l
call lcd_caracter
movlw .79 ;o
call lcd_caracter
movlw .77 ;m
call lcd_caracter
movlw .79 ;o
call lcd_caracter
movlw .32 ;espacio
call lcd_caracter
movlw .57 ;9
call lcd_caracter
movlw .53 ;5
call lcd_caracter
movlw b'11000111'
call lcd_comando
movlw .46 ;.
call lcd_caracter
usr_lcd_sin_952_var
movlw b'11000110'
call lcd_comando
movf mil,w ;enviar la variable mil al lcd.
addlw .48
call lcd_caracter
movlw b'11001000'
call lcd_comando
movf cent,w ;enviar la variable cent al lcd.
addlw .48
call lcd_caracter
movlw b'11001001'
call lcd_comando
movf dece,w ;enviar la variable dece al lcd.
addlw .48
call lcd_caracter
movlw b'11001010'
call lcd_comando
movf unid,w ;enviar la variable unid al lcd.
addlw .48
call lcd_caracter
usr_lcd_sin_953
goto usr_lcd_sin_95_salir
usr_lcd_sin_95_salir
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
return
usr_lcd_sin_98
movlw .3
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
movwf _np_nro_msj
call lcd_mensaje_actual
btfss _np_msj_act,0
goto usr_lcd_sin_982nc
movlw b'00001100'
call lcd_comando
movlw b'00000001'
call lcd_comando
usr_lcd_sin_982nc
movlw b'10000000'
call lcd_comando
movlw .83 ;s
call lcd_caracter
movlw .73 ;i
call lcd_caracter
movlw .78 ;n
call lcd_caracter
movlw .32 ;espacio
call lcd_caracter
movlw .80 ;p
call lcd_caracter
movlw .76 ;l
call lcd_caracter
movlw .79 ;o
call lcd_caracter
movlw .77 ;m
call lcd_caracter
movlw .79 ;o
call lcd_caracter
movlw .32 ;espacio
call lcd_caracter
movlw .57 ;9
call lcd_caracter
movlw .56 ;8
call lcd_caracter
movlw b'11000111'
call lcd_comando
movlw .46 ;.
call lcd_caracter
usr_lcd_sin_982_var
movlw b'11000110'
call lcd_comando
movf mil,w ;enviar la variable mil al lcd.
addlw .48
call lcd_caracter
movlw b'11001000'
call lcd_comando
movf cent,w ;enviar la variable cent al lcd.
addlw .48
call lcd_caracter
movlw b'11001001'
call lcd_comando
movf dece,w ;enviar la variable dece al lcd.
addlw .48
call lcd_caracter
movlw b'11001010'
call lcd_comando
movf unid,w ;enviar la variable unid al lcd.
addlw .48
call lcd_caracter
usr_lcd_sin_983
goto usr_lcd_sin_98_salir
usr_lcd_sin_98_salir
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
return
usr_lcd_diesel
movlw .4
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
movwf _np_nro_msj
call lcd_mensaje_actual
btfss _np_msj_act,0
goto usr_lcd_diesel2nc
movlw b'00001100'
call lcd_comando
movlw b'00000001'
call lcd_comando
usr_lcd_diesel2nc
movlw b'10000000'
call lcd_comando
movlw .68 ;d
call lcd_caracter
movlw .73 ;i
call lcd_caracter
movlw .69 ;e
call lcd_caracter
movlw .83 ;s
call lcd_caracter
movlw .69 ;e
call lcd_caracter
movlw .76 ;l
call lcd_caracter
movlw b'11000111'
call lcd_comando
movlw .46 ;.
call lcd_caracter
usr_lcd_diesel2_var
movlw b'11000110'
call lcd_comando
movf mil,w ;enviar la variable mil al lcd.
addlw .48
call lcd_caracter
movlw b'11001000'
call lcd_comando
movf cent,w ;enviar la variable cent al lcd.
addlw .48
call lcd_caracter
movlw b'11001001'
call lcd_comando
movf dece,w ;enviar la variable dece al lcd.
addlw .48
call lcd_caracter
movlw b'11001010'
call lcd_comando
movf unid,w ;enviar la variable unid al lcd.
addlw .48
call lcd_caracter
usr_lcd_diesel3
goto usr_lcd_diesel_salir
usr_lcd_diesel_salir
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
return
usr_lcd_extra_diesel
movlw .5
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
movwf _np_nro_msj
call lcd_mensaje_actual
btfss _np_msj_act,0
goto usr_lcd_extra_diesel2nc
movlw b'00001100'
call lcd_comando
movlw b'00000001'
call lcd_comando
usr_lcd_extra_diesel2nc
movlw b'10000000'
call lcd_comando
movlw .69 ;e
call lcd_caracter
movlw .88 ;x
call lcd_caracter
movlw .84 ;t
call lcd_caracter
movlw .82 ;r
call lcd_caracter
movlw .65 ;a
call lcd_caracter
movlw .32 ;espacio
call lcd_caracter
movlw .68 ;d
call lcd_caracter
movlw .73 ;i
call lcd_caracter
movlw .69 ;e
call lcd_caracter
movlw .83 ;s
call lcd_caracter
movlw .69 ;e
call lcd_caracter
movlw .76 ;l
call lcd_caracter
movlw b'11000111'
call lcd_comando
movlw .46 ;.
call lcd_caracter
usr_lcd_extra_diesel2_var
movlw b'11000110'
call lcd_comando
movf mil,w ;enviar la variable mil al lcd.
addlw .48
call lcd_caracter
movlw b'11001000'
call lcd_comando
movf cent,w ;enviar la variable cent al lcd.
addlw .48
call lcd_caracter
movlw b'11001001'
call lcd_comando
movf dece,w ;enviar la variable dece al lcd.
addlw .48
call lcd_caracter
movlw b'11001010'
call lcd_comando
movf unid,w ;enviar la variable unid al lcd.
addlw .48
call lcd_caracter
usr_lcd_extra_diesel3
goto usr_lcd_extra_diesel_salir
usr_lcd_extra_diesel_salir
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
return
usr_lcd_int_precio
movlw .7
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
movwf _np_nro_msj
call lcd_mensaje_actual
btfss _np_msj_act,0
goto usr_lcd_int_precio2nc
movlw b'00001100'
call lcd_comando
movlw b'00000001'
call lcd_comando
usr_lcd_int_precio2nc
movlw b'10000000'
call lcd_comando
movlw .73 ;i
call lcd_caracter
movlw .78 ;n
call lcd_caracter
movlw .84 ;t
call lcd_caracter
movlw .82 ;r
call lcd_caracter
movlw .79 ;o
call lcd_caracter
movlw .68 ;d
call lcd_caracter
movlw .46 ;.
call lcd_caracter
movlw .32 ;espacio
call lcd_caracter
movlw .80 ;p
call lcd_caracter
movlw .82 ;r
call lcd_caracter
movlw .69 ;e
call lcd_caracter
movlw .67 ;c
call lcd_caracter
movlw .73 ;i
call lcd_caracter
movlw .79 ;o
call lcd_caracter
usr_lcd_int_precio3
goto usr_lcd_int_precio_salir
usr_lcd_int_precio_salir
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
return
usr_transmision
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
movf num_display,w ;enviar el dato num_display
movwf _np_temp1
call rs232_tc6_9600
movf unid,w ;enviar el dato unid
movwf _np_temp1
call rs232_tc6_9600
movf dece,w ;enviar el dato dece
movwf _np_temp1
call rs232_tc6_9600
movf cent,w ;enviar el dato cent
movwf _np_temp1
call rs232_tc6_9600
movf mil,w ;enviar el dato mil
movwf _np_temp1
call rs232_tc6_9600
usr_transmision3
goto usr_transmision_salir
usr_transmision_salir
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
return
leer_teclado_b0_b1_b2_b3
movlw d'100'
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
movwf _np_temp1
leer_teclado_tmp_1
decfsz _np_temp1,1
goto leer_teclado_tmp_1
bcf portb,0
bcf portb,1
bcf portb,2
bcf portb,3
btfss portb,4
goto leer_teclado_pres
btfss portb,5
goto leer_teclado_pres
btfss portb,6
goto leer_teclado_pres
btfss portb,7
goto leer_teclado_pres
clrf _np_tec
leer_teclado_rete
movlw .128
movwf _np_resultado
goto leer_teclado_tmp_2
leer_teclado_pres
movf _np_tec,w
btfss status,z
goto leer_teclado_rete
movlw d'01'
movwf _np_tec
movwf _np_temp1
clrf _np_temp2
leer_teclado_leer_filas
bsf portb,0
bsf portb,1
bsf portb,2
bsf portb,3
btfsc _np_temp1,0
bcf portb,0
btfsc _np_temp1,1
bcf portb,1
btfsc _np_temp1,2
bcf portb,2
btfsc _np_temp1,3
bcf portb,3
movlw d'01'
movwf _np_temp3
btfss portb,4
goto leer_teclado_salir
incf _np_temp3,1
btfss portb,5
goto leer_teclado_salir
incf _np_temp3,1
btfss portb,6
goto leer_teclado_salir
incf _np_temp3,1
btfss portb,7
goto leer_teclado_salir
incf _np_temp3,1
movlw d'4'
addwf _np_temp2,1
bcf status,c
rlf _np_temp1,1
btfss _np_temp1,4
goto leer_teclado_leer_filas
goto leer_teclado_tmp_2
leer_teclado_salir
movf _np_temp2,w
addwf _np_temp3,w
movwf _np_resultado
leer_teclado_tmp_2
bcf portb,0
bcf portb,1
bcf portb,2
bcf portb,3
movlw d'100'
movwf _np_temp1
leer_teclado_retorno
btfss portb,4
goto leer_teclado_ret1
btfss portb,5
goto leer_teclado_ret1
btfss portb,6
goto leer_teclado_ret1
btfss portb,7
goto leer_teclado_ret1
clrf _np_tec
leer_teclado_ret1
decfsz _np_temp1,1
goto leer_teclado_retorno
return
tmp_1_mgc_i
movwf _np_tiempo_inte
goto tmp_1_mgc_i_1
tmp_1_mgc_i_b2
nop
nop
nop
nop
nop
nop
nop
tmp_1_mgc_i_1
movlw .10
movwf _np_tiempo1_inte
tmp_1_mgc_i_b1
nop
nop
movlw .99
movwf _np_tiempo2_inte
tmp_1_mgc_i_bucle0
nop
nop
nop
movlw .200
movwf _np_tiempo3_inte
tmp_1_mgc_i_bucle
nop
nop
decfsz _np_tiempo3_inte,1
goto tmp_1_mgc_i_bucle
nop
nop
nop
decfsz _np_tiempo2_inte,1
goto tmp_1_mgc_i_bucle0
nop
nop
nop
decfsz _np_tiempo1_inte,1
goto tmp_1_mgc_i_b1
decfsz _np_tiempo_inte,1
goto tmp_1_mgc_i_b2
return
tmp_100_mc_i
movwf _np_tiempo_inte
goto tmp_100_mc_i_1
tmp_100_mc_i_b2
nop
nop
nop
nop
nop
nop
nop
tmp_100_mc_i_1
movlw .22
movwf _np_tiempo1_inte
tmp_100_mc_i_b1
movlw .150
movwf _np_tiempo2_inte
tmp_100_mc_i_bucle
decfsz _np_tiempo2_inte,1
goto tmp_100_mc_i_bucle
decfsz _np_tiempo1_inte,1
goto tmp_100_mc_i_b1
nop
decfsz _np_tiempo_inte,1
goto tmp_100_mc_i_b2
return
lcd_inicio
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
movlw .10 ;temporizador 50 mse
call tmp_100_mc
movlw .25
call tmp_1_mc
bcf portc,1
bcf portc,2
bsf portc,3
bcf portc,4
bcf portc,5
bsf portc,1
call lcd_busy
bcf portc,1
bcf portc,2
bsf portc,3
bcf portc,4
bcf portc,5
bsf portc,1
call lcd_busy
movlw b'00101000'
call lcd_comando
movlw b'00101000'
call lcd_comando
movlw .10 ;temporizador 50 mse
call tmp_100_mc
movlw .25
call tmp_1_mc
clrf _np_lcd_1
clrf _np_nro_msj
return
lcd_busy
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
movlw .5 ;temporizador 2 mse
call tmp_1_mc
return
lcd_comando
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
bcf portc,0
movwf _np_temp1
goto lcd_enviar
lcd_caracter
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
bsf portc,0
movwf _np_temp1
lcd_enviar
bcf portc,1
movwf _np_temp1
bcf portc,2
bcf portc,3
bcf portc,4
bcf portc,5
btfsc _np_temp1,4
bsf portc,2
btfsc _np_temp1,5
bsf portc,3
btfsc _np_temp1,6
bsf portc,4
btfsc _np_temp1,7
bsf portc,5
bsf portc,1
call lcd_busy
bcf portc,1
bcf portc,2
bcf portc,3
bcf portc,4
bcf portc,5
btfsc _np_temp1,0
bsf portc,2
btfsc _np_temp1,1
bsf portc,3
btfsc _np_temp1,2
bsf portc,4
btfsc _np_temp1,3
bsf portc,5
bsf portc,1
call lcd_busy
bcf portc,1
call lcd_busy
return
lcd_mensaje_actual
lcd_1
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
clrf _np_msj_act
movf _np_nro_msj,w
xorwf _np_lcd_1,w
btfss status,z
bsf _np_msj_act,0
movf _np_nro_msj,w
movwf _np_lcd_1
return
rs232_tc6_9600
;enviar un dato rs232 por portc,6 (por usart)
movlw b'00100110'
bsf status,rp0 ;cambiar a banco 1
bcf status,rp1
movwf txsta
movlw .64
movwf spbrg
bcf status,rp0 ;cambiar a banco 0
bsf rcsta,spen
movf _np_temp1,w
movwf txreg
rs232_tc6_9600_eperar
btfss pir1,txif
goto rs232_tc6_9600_eperar
return
tmp_100_mc
movwf _np_tiempo
goto tmp_100_mc_1
tmp_100_mc_b2
nop
nop
nop
nop
nop
nop
nop
tmp_100_mc_1
movlw .22
movwf _np_tiempo1
tmp_100_mc_b1
movlw .150
movwf _np_tiempo2
tmp_100_mc_bucle
decfsz _np_tiempo2,1
goto tmp_100_mc_bucle
decfsz _np_tiempo1,1
goto tmp_100_mc_b1
nop
decfsz _np_tiempo,1
goto tmp_100_mc_b2
return
tmp_1_mc
movwf _np_tiempo
goto tmp_1_mc_1
tmp_1_mc_b1
nop
nop
nop
nop
nop
nop
nop
tmp_1_mc_1
movlw .246
movwf _np_tiempo1
tmp_1_mc_b2
nop
decfsz _np_tiempo1,1
goto tmp_1_mc_b2
nop
nop
nop
nop
nop
decfsz _np_tiempo,1
goto tmp_1_mc_b1
return
;------------------------------------------------------------
; DATOS EN MEMORIA EEPROM
;------------------------------------------------------------
org 0x2100
data 0xff
data 0xff
data 0xff
data 0xff
data 0xff
-
2º CIRCUITO: En este caso Utilizo PIC 16f873A, ds75176, 4 digitos de 7SEG.
EL programa de be hacer lo siguiente: Recibir por RS485 5 registros el 1º indice de producto y los 4 restantes el precio, Cuando los recibe los guarda en eprom, a continuacion los lee de eprom y los muestra por el display de 7 seg. Ademas cuando se enciende y apaga o resetea debe leer la eprom mostrado tambien el precio, El proble que no consigo ni que funcione bien el display ni la comunicacion. Os adjunto el asambler. Gracias a todos.
;------------------------------------------------------------
; Código assembler generado por Niple V6.0.1
; Proyecto: display lcd
; Autor: ----------
; Fecha: 07/05/2009
; Fabricante: Microchip
; PIC: 16F873A
; Velocidad de reloj: 4 Mhz
; Descripcion:
;------------------------------------------------------------
LIST P=PIC16F873A
_HS_OSC equ 0x3FFE
_DEBUG_OFF equ 0x3FFF
_WDT_OFF equ 0x3FFB
_PWRTE_ON equ 0x3FF7
_BODEN_OFF equ 0x3FBF
_LVP_OFF equ 0x3F7F
_CPD_OFF equ 0x3FFF
_CP_OFF equ 0x3FFF
_WRT_ENABLE_OFF equ 0x3DFF
__config _HS_OSC & _DEBUG_OFF & _WDT_OFF & _PWRTE_ON & _BODEN_OFF & _LVP_OFF & _CPD_OFF & _WRT_ENABLE_OFF & _CP_OFF
;------------------------------------------------------------
; Declaración de Registros
;------------------------------------------------------------
w equ 0x0000
status equ 0x0003
porta equ 0x0005
portb equ 0x0006
portc equ 0x0007
pclath equ 0x000a
intcon equ 0x000b
pir1 equ 0x000c
rcsta equ 0x0018
rcreg equ 0x001a
_np_w equ 0x0020
num_esclavo equ 0x0021
unid equ 0x0022
dece equ 0x0023
cent equ 0x0024
mil equ 0x0025
_np_espera1 equ 0x0029
_np_espera2 equ 0x002a
_np_config_interrup equ 0x002b
_np_banderas equ 0x002c
_np_status equ 0x002d
_np_tiempo_inte equ 0x002f
_np_tiempo1_inte equ 0x0031
_np_tiempo2_inte equ 0x0032
v_uni equ 0x0033
v_dec equ 0x0034
v_cent equ 0x0035
v_mil equ 0x0036
_np_tiempo equ 0x003b
_np_banderas2 equ 0x003f
_np_dy_c_1 equ 0x0040
_np_dy_c_2 equ 0x0041
_np_disp_valor equ 0x0042
opcion equ 0x0081
trisa equ 0x0085
trisb equ 0x0086
trisc equ 0x0087
pie1 equ 0x008c
txsta equ 0x0098
spbrg equ 0x0099
adcon1 equ 0x009f
eedata equ 0x010c
eeadr equ 0x010d
eecon1 equ 0x018c
eecon2 equ 0x018d
;------------------------------------------------------------
; Declaración de Bits
;------------------------------------------------------------
c equ 0 ;carry / borrow bit
cren equ 4 ;
eeif equ 4 ;eeprom write operation interrupt flag bit
eepgd equ 7 ;
gie equ 7 ;habilitador general de interrupciones
oerr equ 1 ;
peie equ 6 ;ee write complete interrupt enable bit
rcie equ 5 ;
rcif equ 5 ;bandera de interrupcion por fin de recepción usart.
rd equ 0 ;
rp0 equ 5 ;registrer bank select bit
rp1 equ 6 ;registrer bank select bit
spen equ 7 ;
wr equ 1 ;
wren equ 2 ;
z equ 2 ;bit cero
rx_ok equ 0 ;bandera de recepción de dato ok
sub_inte equ 0 ;bandera de subrrutina cancelada por interrupcion.
;------------------------------------------------------------
; Inicio
;------------------------------------------------------------
reset org 0
goto paso2
org 4
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
btfsc pir1,rcif
goto interrupción_rc
salir_interrupcion
bsf _np_banderas2,sub_inte ;activar la bandera de rutina cancelada por interrupcion
movf _np_status,w
movwf status
swapf _np_w,w
retfie
;------------------------------------------------------------
; inicio de la interrupción por rc usart
;------------------------------------------------------------
interrupción_rc_salir
bcf pir1,rcif
goto salir_interrupcion
interrupción_rc
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
bsf _np_banderas,rx_ok ;iniciar la recepcion sin erroes.
bcf rcsta,oerr
clrf _np_espera1
clrf _np_espera2
goto inte_rc_usart_2_rc_1
inte_rc_usart_2_esp_byte_1
incf _np_espera2,1
btfss status,z
goto inte_rc_usart_2_rc_1
incf _np_espera1,1
btfsc status,z
goto inte_rc_usart_2_err
inte_rc_usart_2_rc_1
btfss pir1,rcif
goto inte_rc_usart_2_esp_byte_1
movf rcreg,w
movwf num_esclavo
bcf pir1,rcif
btfsc rcsta,oerr
goto inte_rc_usart_2_err
clrf _np_espera1
clrf _np_espera2
goto inte_rc_usart_2_rc_2
inte_rc_usart_2_esp_byte_2
incf _np_espera2,1
btfss status,z
goto inte_rc_usart_2_rc_2
incf _np_espera1,1
btfsc status,z
goto inte_rc_usart_2_err
inte_rc_usart_2_rc_2
btfss pir1,rcif
goto inte_rc_usart_2_esp_byte_2
movf rcreg,w
movwf unid
bcf pir1,rcif
btfsc rcsta,oerr
goto inte_rc_usart_2_err
clrf _np_espera1
clrf _np_espera2
goto inte_rc_usart_2_rc_3
inte_rc_usart_2_esp_byte_3
incf _np_espera2,1
btfss status,z
goto inte_rc_usart_2_rc_3
incf _np_espera1,1
btfsc status,z
goto inte_rc_usart_2_err
inte_rc_usart_2_rc_3
btfss pir1,rcif
goto inte_rc_usart_2_esp_byte_3
movf rcreg,w
movwf dece
bcf pir1,rcif
btfsc rcsta,oerr
goto inte_rc_usart_2_err
clrf _np_espera1
clrf _np_espera2
goto inte_rc_usart_2_rc_4
inte_rc_usart_2_esp_byte_4
incf _np_espera2,1
btfss status,z
goto inte_rc_usart_2_rc_4
incf _np_espera1,1
btfsc status,z
goto inte_rc_usart_2_err
inte_rc_usart_2_rc_4
btfss pir1,rcif
goto inte_rc_usart_2_esp_byte_4
movf rcreg,w
movwf cent
bcf pir1,rcif
btfsc rcsta,oerr
goto inte_rc_usart_2_err
clrf _np_espera1
clrf _np_espera2
goto inte_rc_usart_2_rc_5
inte_rc_usart_2_esp_byte_5
incf _np_espera2,1
btfss status,z
goto inte_rc_usart_2_rc_5
incf _np_espera1,1
btfsc status,z
goto inte_rc_usart_2_err
inte_rc_usart_2_rc_5
btfss pir1,rcif
goto inte_rc_usart_2_esp_byte_5
movf rcreg,w
movwf mil
bcf pir1,rcif
btfsc rcsta,oerr
goto inte_rc_usart_2_err
goto inte_rc_usart_2_salir
inte_rc_usart_2_err
bcf _np_banderas,rx_ok ;error de comunicaciones.
inte_rc_usart_2_salir
bcf rcsta,oerr
movf num_esclavo,w ;si el reg num_esclavo = d'1'
xorlw d'1'
btfss status,z
goto interrupción_rc_salir
;grabar un dato en el registro 01 de la eeprom
movlw d'01'
bsf status,rp1 ;cambiar a banco 2
movwf eeadr
bcf status,rp1 ;cambiar a banco 0
movf unid,w
bsf status,rp1 ;cambiar a banco 2
movwf eedata
call grabar_eeprom
;grabar un dato en el registro 02 de la eeprom
movlw d'02'
bsf status,rp1 ;cambiar a banco 2
movwf eeadr
bcf status,rp1 ;cambiar a banco 0
movf dece,w
bsf status,rp1 ;cambiar a banco 2
movwf eedata
call grabar_eeprom
;grabar un dato en el registro 03 de la eeprom
movlw d'03'
bsf status,rp1 ;cambiar a banco 2
movwf eeadr
bcf status,rp1 ;cambiar a banco 0
movf dece,w
bsf status,rp1 ;cambiar a banco 2
movwf eedata
call grabar_eeprom
;grabar un dato en el registro 04 de la eeprom
movlw d'04'
bsf status,rp1 ;cambiar a banco 2
movwf eeadr
bcf status,rp1 ;cambiar a banco 0
movf mil,w
bsf status,rp1 ;cambiar a banco 2
movwf eedata
call grabar_eeprom
movlw .1 ;temporizador 10 mse
call tmp_100_mc_i
call inhabilitar_inte
movlw d'01' ;leer un dato del registro 01 de la memoria eeprom
bsf status,rp1 ;cambiar a banco 2
movwf eeadr
bsf status,rp0 ;cambiar a banco 3
bcf eecon1,eepgd
bsf eecon1,rd
bcf status,rp0 ;cambiar a banco 2
movf eedata,w
bcf status,rp1 ;cambiar a banco 0
movwf v_uni
call habilitar_inte
call inhabilitar_inte
movlw d'02' ;leer un dato del registro 02 de la memoria eeprom
bsf status,rp1 ;cambiar a banco 2
movwf eeadr
bsf status,rp0 ;cambiar a banco 3
bcf eecon1,eepgd
bsf eecon1,rd
bcf status,rp0 ;cambiar a banco 2
movf eedata,w
bcf status,rp1 ;cambiar a banco 0
movwf v_dec
call habilitar_inte
call inhabilitar_inte
movlw d'03' ;leer un dato del registro 03 de la memoria eeprom
bsf status,rp1 ;cambiar a banco 2
movwf eeadr
bsf status,rp0 ;cambiar a banco 3
bcf eecon1,eepgd
bsf eecon1,rd
bcf status,rp0 ;cambiar a banco 2
movf eedata,w
bcf status,rp1 ;cambiar a banco 0
movwf v_cent
call habilitar_inte
call inhabilitar_inte
movlw d'04' ;leer un dato del registro 04 de la memoria eeprom
bsf status,rp1 ;cambiar a banco 2
movwf eeadr
bsf status,rp0 ;cambiar a banco 3
bcf eecon1,eepgd
bsf eecon1,rd
bcf status,rp0 ;cambiar a banco 2
movf eedata,w
bcf status,rp1 ;cambiar a banco 0
movwf v_mil
call habilitar_inte
inte_rc_usart_13
goto interrupción_rc_salir
;------------------------------------------------------------
; programa principal
;------------------------------------------------------------
paso2
ini_reg
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
clrf _np_w
clrf num_esclavo
clrf unid
clrf dece
clrf cent
clrf mil
clrf _np_espera1
clrf _np_espera2
clrf _np_config_interrup
clrf _np_banderas
clrf _np_status
clrf _np_tiempo_inte
clrf _np_tiempo1_inte
clrf _np_tiempo2_inte
clrf v_uni
clrf v_dec
clrf v_cent
clrf v_mil
clrf _np_tiempo
clrf _np_banderas2
clrf _np_dy_c_1
clrf _np_dy_c_2
clrf _np_disp_valor
clrf _np_w
n_ini_reg
movlw b'00000000' ;configurar el puerto a como xxssssss
bsf status,rp0 ;cambiar a banco 1
bcf status,rp1
movwf trisa
movlw b'00000111' ;puerto a = e/s digital
movwf adcon1
movlw b'00000000' ;configurar el puerto b como ssssssss
movwf trisb
movlw b'10000000' ;configurar el puerto c como esssssss
movwf trisc
bcf status,rp0 ;cambiar a banco 0
clrf cent
clrf dece
clrf mil
clrf num_esclavo
clrf unid
clrf v_cent
clrf v_dec
clrf v_mil
clrf v_uni
movlw b'00100110'
bsf status,rp0 ;cambiar a banco 1
movwf txsta
movlw .25
movwf spbrg
bcf status,rp0 ;cambiar a banco 0
bsf rcsta,spen ;habilitacion del puerto de comunicacion serial
bsf rcsta,cren
bsf intcon,gie ;activar habilitador general de interrupciones.
bsf intcon,peie ;activar habilitador general de interrupciones por perifericos.
bsf status,rp0 ;cambiar a banco 1
bsf pie1,rcie ;activar interrupción por fin de recepción por usart.
call inhabilitar_inte
movlw d'01' ;leer un dato del registro 01 de la memoria eeprom
bsf status,rp1 ;cambiar a banco 2
movwf eeadr
bsf status,rp0 ;cambiar a banco 3
bcf eecon1,eepgd
bsf eecon1,rd
bcf status,rp0 ;cambiar a banco 2
movf eedata,w
bcf status,rp1 ;cambiar a banco 0
movwf v_uni
call habilitar_inte
call inhabilitar_inte
movlw d'02' ;leer un dato del registro 02 de la memoria eeprom
bsf status,rp1 ;cambiar a banco 2
movwf eeadr
bsf status,rp0 ;cambiar a banco 3
bcf eecon1,eepgd
bsf eecon1,rd
bcf status,rp0 ;cambiar a banco 2
movf eedata,w
bcf status,rp1 ;cambiar a banco 0
movwf v_dec
call habilitar_inte
call inhabilitar_inte
movlw d'03' ;leer un dato del registro 03 de la memoria eeprom
bsf status,rp1 ;cambiar a banco 2
movwf eeadr
bsf status,rp0 ;cambiar a banco 3
bcf eecon1,eepgd
bsf eecon1,rd
bcf status,rp0 ;cambiar a banco 2
movf eedata,w
bcf status,rp1 ;cambiar a banco 0
movwf v_cent
call habilitar_inte
call inhabilitar_inte
movlw d'04' ;leer un dato del registro 04 de la memoria eeprom
bsf status,rp1 ;cambiar a banco 2
movwf eeadr
bsf status,rp0 ;cambiar a banco 3
bcf eecon1,eepgd
bsf eecon1,rd
bcf status,rp0 ;cambiar a banco 2
movf eedata,w
bcf status,rp1 ;cambiar a banco 0
movwf v_mil
call habilitar_inte
paso20
;visualizar datos en displays cátodo común (4511)
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
clrf _np_dy_c_1 ;limpiar el contador de repeticiones
clrf _np_dy_c_2
bcf portc,0 ;apagar display para evitar error de visualizacion
bcf portc,1 ;apagar display para evitar error de visualizacion
bcf portc,2 ;apagar display para evitar error de visualizacion
bcf portc,3 ;apagar display para evitar error de visualizacion
paso20_mostrar
call dy2cb1b2b3b4
movf v_uni,w ;mostrar el valor del registro v_uni
movwf _np_disp_valor
call dy3cb1b2b3b4
bsf portc,0 ;encender el display 1
movlw .2 ;temporizador 20 use
call tmp_10_uc
bcf portc,0 ;apagar el display 1
call dy2cb1b2b3b4
movf v_dec,w ;mostrar el valor del registro v_dec
movwf _np_disp_valor
call dy3cb1b2b3b4
bsf portc,1 ;encender el display 2
movlw .2 ;temporizador 20 use
call tmp_10_uc
bcf portc,1 ;apagar el display 2
call dy2cb1b2b3b4
movf v_cent,w ;mostrar el valor del registro v_cent
movwf _np_disp_valor
call dy3cb1b2b3b4
bsf portc,2 ;encender el display 3
movlw .2 ;temporizador 20 use
call tmp_10_uc
bcf portc,2 ;apagar el display 3
call dy2cb1b2b3b4
movf v_mil,w ;mostrar el valor del registro v_mil
movwf _np_disp_valor
call dy3cb1b2b3b4
bsf portc,3 ;encender el display 4
movlw .2 ;temporizador 20 use
call tmp_10_uc
bcf portc,3 ;apagar el display 4
incf _np_dy_c_2,1
btfsc status,z
incf _np_dy_c_1,1
movlw b'00000011'
subwf _np_dy_c_1,w
btfss status,c
goto paso20_mostrar
movlw b'11101000'
subwf _np_dy_c_2,w
btfss status,c
goto paso20_mostrar
nop
goto paso20 ;cierra el ciclo
;------------------------------------------------------------
; Declaración de Subrutinas
;------------------------------------------------------------
grabar_eeprom
;escribir el dato en la eeprom
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
movf intcon,w
movwf _np_config_interrup
call inhabilitar_inte
bsf status,rp0 ;cambiar a banco 3
bsf status,rp1
bcf eecon1,eepgd
bsf eecon1,wren
movlw 0x55
movwf eecon2
movlw 0xaa
movwf eecon2
bsf eecon1,wr
esperar_fin_escritura
btfsc eecon1,wr
goto esperar_fin_escritura
bcf eecon1,eeif
bcf eecon1,wren
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
movf _np_config_interrup,w
movwf intcon
call habilitar_inte
return
inhabilitar_inte
;guardar la configuracion de las interupciones y deshabilitarlas
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
movf intcon,w
movwf _np_config_interrup
bcf intcon,gie
return
habilitar_inte
;recuperar la configuracion de las interupciones y habilitarlas
bcf status,rp0 ;cambiar a banco 0
bcf status,rp1
movf _np_config_interrup,w
movwf intcon
return
tmp_100_mc_i
movwf _np_tiempo_inte
goto tmp_100_mc_i_1
tmp_100_mc_i_b2
nop
nop
nop
nop
nop
nop
nop
tmp_100_mc_i_1
movlw .22
movwf _np_tiempo1_inte
tmp_100_mc_i_b1
movlw .150
movwf _np_tiempo2_inte
tmp_100_mc_i_bucle
decfsz _np_tiempo2_inte,1
goto tmp_100_mc_i_bucle
decfsz _np_tiempo1_inte,1
goto tmp_100_mc_i_b1
nop
decfsz _np_tiempo_inte,1
goto tmp_100_mc_i_b2
return
dy2cb1b2b3b4
;limpiar datos en displays cátodo común
bcf portb,1 ;limpiar el bus de datos
bcf portb,2
bcf portb,3
bcf portb,4
return
dy3cb1b2b3b4
;visualizar datos en displays cátodo común
btfsc _np_disp_valor,0 ;asignar el nuevo valor al bus de datos
bsf portb,1
btfsc _np_disp_valor,1
bsf portb,2
btfsc _np_disp_valor,2
bsf portb,3
btfsc _np_disp_valor,3
bsf portb,4
return
tmp_10_uc
movwf _np_tiempo
goto tmp_10_uc_10
tmp_10_uc_bucle
nop
nop
nop
nop
nop
nop
nop
tmp_10_uc_10
decfsz _np_tiempo,1
goto tmp_10_uc_bucle
return
;------------------------------------------------------------
; DATOS EN MEMORIA EEPROM
;------------------------------------------------------------
org 0x2100
data 0xff
data 0xff
data 0xff
data 0xff
data 0xff
data 0xff
data 0xff
data 0xff