Autor Tema: Problemas con LCD  (Leído 2334 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado mcataldo

  • PIC10
  • *
  • Mensajes: 10
Problemas con LCD
« en: 06 de Noviembre de 2009, 10:50:33 »
Hola a todos, soy novato en programación de pics y en mi programa uso lcd y tengo una rutina para controlarlo, pero no sé que problema tiene, pues al simularlo en proteus el lcd no me muestra nada. Cuento con tres rutinas de mansajes; uno que se muestra siempre y los otros dos cuando ocurre cierta interrupción. Por favor, si alguien encuentra el error me lo indica. Por si acaso estoy usando sólo un lcd 16x2 vt162b/b. Además como puedo hacer para que el mensaje que pongo en el lcd producto de la interrupción quede durante unos segundos habiendo acabado la interrupción? Postearé las rutinas de mensaje y los trozos donde se las llama.
Gracias

inte_rb47_9
   movlw b'00000001'                ;seleccionar el lcd 1
   movwf _np_nro_lcd
   call usr_lcd_temp_maxima
   call tiempo_1_255_mega_c_inte
   goto inte_rb47_7                 ;cierra el ciclo

inte_rb47_18
   movlw b'00000001'                ;seleccionar el lcd 1
   movwf _np_nro_lcd
   call usr_lcd_temp_minima
   call tiempo_1_255_mega_c_inte
   goto inte_rb47_7                 ;cierra el ciclo

movlw b'00000001'                ;seleccionar el lcd 1
   movwf _np_nro_lcd
   clrf _np_lcd_1
   call lcd_inicio
   call lcd_inicio
   call lcd_inicio
   movlw b'00000001'                ;seleccionar el lcd 1
   movwf _np_nro_lcd
   call usr_lcd_estado
   goto paso26                      ;cierra el ciclo

usr_lcd_temp_maxima
   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_temp_maxima2_no_config
   movlw b'00001100'
   call lcd_comando
   movlw b'00000001'
   call lcd_comando
usr_lcd_temp_maxima2_no_config
   movlw b'10000000'
   call lcd_comando
   movlw .72                        ;h
   call lcd_caracter
   movlw .97                        ;a
   call lcd_caracter
   movlw .32                        ;espacio
   call lcd_caracter
   movlw .97                        ;a
   call lcd_caracter
   movlw .108                       ;l
   call lcd_caracter
   movlw .99                        ;c
   call lcd_caracter
   movlw .97                        ;a
   call lcd_caracter
   movlw .110                       ;n
   call lcd_caracter
   movlw .122                       ;z
   call lcd_caracter
   movlw .97                        ;a
   call lcd_caracter
   movlw .100                       ;d
   call lcd_caracter
   movlw .111                       ;o
   call lcd_caracter
   movlw .32                        ;espacio
   call lcd_caracter
   movlw .108                       ;l
   call lcd_caracter
   movlw .97                        ;a
   call lcd_caracter
   movlw b'11000000'
   call lcd_comando
   movlw .116                       ;t
   call lcd_caracter
   movlw .101                       ;e
   call lcd_caracter
   movlw .109                       ;m
   call lcd_caracter
   movlw .112                       ;p
   call lcd_caracter
   movlw .46                        ;.
   call lcd_caracter
   movlw .32                        ;espacio
   call lcd_caracter
   movlw .109                       ;m
   call lcd_caracter
   movlw .97                        ;a
   call lcd_caracter
   movlw .120                       ;x
   call lcd_caracter
   movlw .105                       ;i
   call lcd_caracter
   movlw .109                       ;m
   call lcd_caracter
   movlw .97                        ;a
   call lcd_caracter
   movlw .46                        ;.
   call lcd_caracter
usr_lcd_temp_maxima3
   goto usr_lcd_temp_maxima_salir
usr_lcd_temp_maxima_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


usr_lcd_temp_minima
   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_temp_minima2_no_config
   movlw b'00001100'
   call lcd_comando
   movlw b'00000001'
   call lcd_comando
usr_lcd_temp_minima2_no_config
   movlw b'10000000'
   call lcd_comando
   movlw .72                        ;h
   call lcd_caracter
   movlw .97                        ;a
   call lcd_caracter
   movlw .32                        ;espacio
   call lcd_caracter
   movlw .97                        ;a
   call lcd_caracter
   movlw .108                       ;l
   call lcd_caracter
   movlw .99                        ;c
   call lcd_caracter
   movlw .97                        ;a
   call lcd_caracter
   movlw .110                       ;n
   call lcd_caracter
   movlw .122                       ;z
   call lcd_caracter
   movlw .97                        ;a
   call lcd_caracter
   movlw .100                       ;d
   call lcd_caracter
   movlw .111                       ;o
   call lcd_caracter
   movlw .32                        ;espacio
   call lcd_caracter
   movlw .108                       ;l
   call lcd_caracter
   movlw .97                        ;a
   call lcd_caracter
   movlw b'11000000'
   call lcd_comando
   movlw .116                       ;t
   call lcd_caracter
   movlw .101                       ;e
   call lcd_caracter
   movlw .109                       ;m
   call lcd_caracter
   movlw .112                       ;p
   call lcd_caracter
   movlw .46                        ;.
   call lcd_caracter
   movlw .32                        ;espacio
   call lcd_caracter
   movlw .109                       ;m
   call lcd_caracter
   movlw .105                       ;i
   call lcd_caracter
   movlw .110                       ;n
   call lcd_caracter
   movlw .105                       ;i
   call lcd_caracter
   movlw .109                       ;m
   call lcd_caracter
   movlw .97                        ;a
   call lcd_caracter
   movlw .46                        ;.
   call lcd_caracter
usr_lcd_temp_minima3
   goto usr_lcd_temp_minima_salir
usr_lcd_temp_minima_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return


usr_lcd_estado
   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_estado2_no_config
   movlw b'00001100'
   call lcd_comando
   movlw b'00000001'
   call lcd_comando
usr_lcd_estado2_no_config
   movlw b'10000000'
   call lcd_comando
   movlw .84                        ;t
   call lcd_caracter
   movlw .114                       ;r
   call lcd_caracter
   movlw .101                       ;e
   call lcd_caracter
   movlw .102                       ;f
   call lcd_caracter
   movlw .58                        ;:
   call lcd_caracter
   movlw b'10000111'
   call lcd_comando
   movlw .186                       ;º
   call lcd_caracter
   movlw .84                        ;t
   call lcd_caracter
   movlw .99                        ;c
   call lcd_caracter
   movlw .97                        ;a
   call lcd_caracter
   movlw .108                       ;l
   call lcd_caracter
   movlw .58                        ;:
   call lcd_caracter
   movlw b'10001111'
   call lcd_comando
   movlw .186                       ;º
   call lcd_caracter
   movlw b'11000000'
   call lcd_comando
   movlw .84                        ;t
   call lcd_caracter
   movlw .109                       ;m
   call lcd_caracter
   movlw .105                       ;i
   call lcd_caracter
   movlw .110                       ;n
   call lcd_caracter
   movlw .58                        ;:
   call lcd_caracter
   movlw b'11000111'
   call lcd_comando
   movlw .186                       ;º
   call lcd_caracter
   movlw .84                        ;t
   call lcd_caracter
   movlw .109                       ;m
   call lcd_caracter
   movlw .97                        ;a
   call lcd_caracter
   movlw .120                       ;x
   call lcd_caracter
   movlw .58                        ;:
   call lcd_caracter
   movlw b'11001111'
   call lcd_comando
   movlw .186                       ;º
   call lcd_caracter
usr_lcd_estado2_var
   movlw b'10000101'
   call lcd_comando
   movf disp_sp_d,w                 ;enviar la variable disp_sp_d al lcd.
   addlw .48
   call lcd_caracter
   movlw b'10000110'
   call lcd_comando
   movf disp_sp_u,w                 ;enviar la variable disp_sp_u al lcd.
   addlw .48
   call lcd_caracter
   movlw b'10001101'
   call lcd_comando
   movf disp_c_d,w                  ;enviar la variable disp_c_d al lcd.
   addlw .48
   call lcd_caracter
   movlw b'10001110'
   call lcd_comando
   movf disp_c_u,w                  ;enviar la variable disp_c_u al lcd.
   addlw .48
   call lcd_caracter
   movlw b'11000101'
   call lcd_comando
   movf disp_min_d,w                ;enviar la variable disp_min_d al lcd.
   addlw .48
   call lcd_caracter
   movlw b'11000110'
   call lcd_comando
   movf disp_min_u,w                ;enviar la variable disp_min_u al lcd.
   addlw .48
   call lcd_caracter
   movlw b'11001101'
   call lcd_comando
   movf disp_max_d,w                ;enviar la variable disp_max_d al lcd.
   addlw .48
   call lcd_caracter
   movlw b'11001110'
   call lcd_comando
   movf disp_max_u,w                ;enviar la variable disp_max_u al lcd.
   addlw .48
   call lcd_caracter
usr_lcd_estado3
   goto usr_lcd_estado_salir
usr_lcd_estado_salir
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   return

lcd_inicio
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   clrf _np_lcd_1
   clrf _np_nro_msj
   movlw .5                         ;temporizador 50 mse
   call tiempo_100_1000_mc
   movlw b'00111000'
   call lcd_comando
   movlw b'00111000'
   call lcd_comando
   return
lcd_busy
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movlw .2                         ;temporizador 2 mse
   call tiempo_1_100_mc

   return
lcd_comando
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_temp1
   bcf porte,0
   goto lcd_enviar
lcd_caracter
   bcf status,rp0                   ;cambiar a banco 0
   bcf status,rp1
   movwf _np_temp1
   bsf porte,0
lcd_enviar
   bsf porte,1
   movf _np_temp1,w
   bcf portc,0
   bcf portc,1
   bcf portc,2
   bcf portc,3
   bcf portc,4
   bcf portc,5
   bcf portc,6
   bcf portc,7
   btfsc _np_temp1,0
   bsf portc,0
   btfsc _np_temp1,1
   bsf portc,1
   btfsc _np_temp1,2
   bsf portc,2
   btfsc _np_temp1,3
   bsf portc,3
   btfsc _np_temp1,4
   bsf portc,4
   btfsc _np_temp1,5
   bsf portc,5
   btfsc _np_temp1,6
   bsf portc,6
   btfsc _np_temp1,7
   bsf portc,7
   bcf porte,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

(las variables disp_x_u y disp_x_d son los dígitos en bcd de las variables a mostrar en el lcd)
« Última modificación: 06 de Noviembre de 2009, 10:59:06 por mcataldo »

Desconectado Suky

  • Moderador Local
  • DsPIC33
  • *****
  • Mensajes: 6758
Re: Problemas con LCD
« Respuesta #1 en: 06 de Noviembre de 2009, 11:13:55 »
La rutina del LCD hace control de estado del display testeando sus pines? Si es el caso Proteus no simula esto y te va a dar problemas, para simularlo reemplaza el test de estado por una demora de 60us.

Luego en las interrupciones utiliza una variable para indicar que mensaje quieres mostrar, y en el main testeas esta variable para mostrar el mensaje durante un tiempo agregándole un delay.


Saludos!
No contesto mensajes privados, las consultas en el foro

Desconectado mcataldo

  • PIC10
  • *
  • Mensajes: 10
Re: Problemas con LCD
« Respuesta #2 en: 06 de Noviembre de 2009, 13:34:01 »
A qué te refieres con control de estado, perdón? a las patas enable y rs del lcd?

Desconectado Suky

  • Moderador Local
  • DsPIC33
  • *****
  • Mensajes: 6758
Re: Problemas con LCD
« Respuesta #3 en: 06 de Noviembre de 2009, 13:48:26 »
Cuando se escribe en el LCD para saber si esta disponible para recibir otro carácter se lee los pines de datos observando en donde se indica su estado. Por aquí mas información.


Saludos!
No contesto mensajes privados, las consultas en el foro

Desconectado mcataldo

  • PIC10
  • *
  • Mensajes: 10
Re: Problemas con LCD
« Respuesta #4 en: 06 de Noviembre de 2009, 14:11:25 »
Mmm, por lo que entiendo vendría siendo el R/W entonces, o no?
No, no uso R/W


 

anything