TODOPIC
Microcontroladores PIC => Primeros pasos - Iniciación a los microcontroladores => Mensaje iniciado por: soymoe en 17 de Febrero de 2011, 00:32:43
-
Hola compre un LCD for data y quiero hacerlo funcionar. Baje las rutinas de este foro pero no puedo hacer que funcione. Este es el programa principal:
list p=16f628a
R_E_T_1 equ 0x20
R_E_T_2 equ 0x21
LCD_AUX equ 0x22
RS equ 00h
E equ 01h
#include "p16f628a.inc"
#include "Retardos_lcd.inc"
#include "Control-Dato.inc"
#include "ini4bits.inc"
org 00h
goto programa
programa bsf STATUS,5;BANCO 1
clrf TRISA;HABILITO COMO SALIDA
clrf TRISB
bsf PCON,3
bcf STATUS,5;BANCO 0
movlw 00000111
movwf CMCON
bcf PORTB,0
call ini4bits
movlw b'10001100'
call EnviaInstruccion
;movlw '$'
;call EnviaCaracter
duerme nop
goto duerme
end
Esta es la rutina de inicializacion:
ini4bits
call retardo50ms
bcf PORTA,RS
movlw b'00110000'
movwf PORTB
bsf PORTA,E
nop
bcf PORTA,E
call retardo2ms; Mas de 4 milesegundos
call retardo2ms
call retardo2ms
movlw b'00110000'
movwf PORTB
bsf PORTA,E
nop
bcf PORTA,E
call retardo2ms ;mas que 100micro
movlw b'00110000'
movwf PORTB
bsf PORTA,E
nop
bcf PORTA,E
call retardo45us
bcf PORTA,RS
movlw b'00100000'
movwf PORTB
bsf PORTA,E
nop
bcf PORTA,E
call retardo45us
movlw b'00101000'
call EnviaInstruccion
call retardo45us
movlw b'00001000'
call EnviaInstruccion
call retardo45us
movlw b'00000001'
call EnviaInstruccion
call retardo45us
movlw b'00000110'
call EnviaInstruccion
call retardo45us
movlw b'00001100' ;prende display
call EnviaInstruccion
call retardo45us
end;
Esta es la rutina de envio de datos e instrucciones:
EnviaInstruccion
BCF PORTA,RS
GOTO SIGUE
EnviaCaracter BSF PORTA,RS
SIGUE MOVWF LCD_AUX
MOVF LCD_AUX,W
MOVWF PORTB
BSF PORTA,E
NOP
BCF PORTA,E
CALL retardo45us
SWAPF LCD_AUX,W
MOVWF PORTB
BSF PORTA,E
NOP
BCF PORTA,E
CALL retardo45us
RETURN
-
los controladores que tiene el display son de los hitachi? o que marca?
-
No no son hitachi tiene otro controlador similar basado en el controlador splc780d" que estuve leyendo y es casi igual al hitachi solo cambia la inicializacion creo. El display es el FDCC1602G de fordata.
-
entonces habria que fijarse ahi el problema, cuando le erraste de us o ms para enviar datos o inicializarlo, es todo un problema, yo estuve como 1 mes y algo en solucionar el problema del mio (tarde mucho porque era mis primeros momentos en programacion jeje)