Beruflich Dokumente
Kultur Dokumente
CBLOCK 0X0C
DATO
DATO1
tiempo
tiempo1
tiempo2
libre
BYTE_ALTO
BYTE_BAJO
ENDC
envia_msj
clrf libre ; contador de posiciones.
sig_dato
movf libre,0 ; lIBRE SE CARGA A W ( INDICE DE LA LETRA A ENVIAR)
call TABLA
movwf DATO ; SE ALMACENA TEMPORALMENTE EL DATO A ENVIAR AL LCD
sublw '#' ; w-'#'=>w
btfss ESTADO,2
goto seguir ; Enviar letra
RETURN ; se termino el envio.
envia_dato_lcd
movwf BYTE_ALTO
swapf BYTE_ALTO,0
movwf BYTE_BAJO
bsf PTAA_T,0 ; RS=1
bcf PTAA_T,1 ; E=0
;///////////////////
movfw BYTE_ALTO ;enviando la parte alta
movwf PTAB_T
bsf PTAA_T,1 ; E=1; Inicio escrtura
bcf PTAA_T,1 ; E=0
call retardo_40microseg ; Debe durar 50 microsegundos
movfw BYTE_BAJO ;enviando la parte BAJA
movwf PTAB_T
bsf PTAA_T,1 ; E=1; Inicio escrtura
bcf PTAA_T,1 ; E=0
call retardo_40microseg ; Debe durar 50 microsegundos
return
inicializa_lcd
;----------------------------------
bcf PTAA_T,0 ; RS=0
bcf PTAA_T,1 ; E=0
;----------------------------------
movlw b'00110000'
movwf PTAB_T
bsf PTAA_T,1 ;E=1
bcf PTAA_T,1 ;E=0
call retardo_4.1ms
;-----------------------------------------
movlw b'00110000' ;Rb7 Rb6 Rb5 Rb4 Rb3 Rb2 XXX = DB7 DB6 DB5 DB4 RS E
XX
movwf PTAB_T
bsf PTAA_T,1 ;E=1
bcf PTAA_T,1 ;E=0
call retardo_100microseg ; deberia ser 200microseg
; ----------------------------------------
movlw b'00110000'
movwf PTAB_T
bsf PTAA_T,1 ;E=1
bcf PTAA_T,1 ;E=0
;------------------------------------------
CALL retardo_40microseg
movlw b'00100000'
movwf PTAB_T
bsf PTAA_T,1 ;E=1
bcf PTAA_T,1 ;E=
CALL retardo_40microseg
;-----------------------------------------
; BUS DE 4 BITS, 2 LINEA,CARACTER 5X7
;CONF. A ENVIAR b'00101000'
movlw b'00101000' ;enviando la parte alta
movwf PTAB_T
bsf PTAA_T,1 ; E=1; Inicio escrtura
bcf PTAA_T,1 ; E=0
call retardo_1.7mseg
movlw b'10000010' ;enviando la parte BAJA
movwf PTAB_T
bsf PTAA_T,1 ; E=1; Inicio escrtura
bcf PTAA_T,1 ; E=0
call retardo_1.7mseg
return
; FIN DE INICIALIZACION
;---------------------------------------------------------------------
;DISPLAY CONTROL --> formato=0000 1 D C B
; D=1 Display se enciende c=0 cursor no se visualiza b=0 no hay efecto de parpadeo
retardo_4.1ms
movlw d'3'
movwf tiempo2
t4.1 call retardo_1.7mseg
decfsz tiempo2,1
goto t4.1
return