You are on page 1of 3

26/2/2018 https://sena.blackboard.

com/bbcswebdav/pid-17426278-dt-content-rid-3157823_1/institution/semillas/22420152_1_VIRTUAL/Materiales del curso/Unidad …

INCLUDE <P16F628A.INC>

CBLOCK 0X20
R0C,R0D,R0E,R13,loops,loops2,REG_RX,CONTE,MEMORIA,RX_COMP,RX_ID1,RX_ID2,RX_PRO1,MENS_CONT,CON_USER,DATA
_IN,CONT_USER,
CONT_INTS,MEM_STATUS,DATA_RUP,DATA_COMP,ID1_SAVE,ID2_SAVE,ID3_SAVE
ENDC

E EQU 2H ; A LA PATA 6 (E) HABILITACION DEL MODULO


RS EQU 1H ; A LA PATA 4 DEL MODULO (RS - INSTRUCCION O CARACTER)
; PATA 2 DEL MODULO A +VCC
; 3 REGULA CONTRASTE, AL PM DE UN POTE 5K ENTRE VCC Y MASA
; 5 Y 1 A MASA
;PATA 6 DEL PIC----->A LA 4 DEL MóDULO
; 7----> 6
; 10--->11
; 11--->12
; 12-->13
; 13-->14

;retardo para COMUNICACIÓN CON MÓDUL0 LCD


ORG 0X00
GOTO INICIO

RETARDO
CLRWDT
MOVLW D'15' ;antes 15
MOVWF loops
top2_1
MOVLW D'25' ;antes 25
MOVWF loops2
top_1
CLRWDT
NOP
NOP
NOP
NOP
NOP
NOP
DECFSZ loops2,1 ;pregunta si termino 1 ms
GOTO top_1
DECFSZ loops,1 ;pregunta si termina el retardo
GOTO top2_1
RETLW 0

CONTROL
CLRWDT
BCF PORTB,RS ;ESTA RUTINA GENERA LAS
GOTO DATO2 ;SEÑALES DE CONTROL Y ENVIA
DATO
CLRWDT
BSF PORTB,RS ;EL DATO Al MODULO
DATO2
BSF PORTB,E ;CON INTERFACE DE 4 BITS
MOVWF R0E
MOVLW 0FH
ANDWF PORTB,1
MOVF R0E,W
ANDLW 0F0H
IORWF PORTB,1
CALL RETARDO
BCF PORTB,E

https://sena.blackboard.com/bbcswebdav/pid-17426278-dt-content-rid-3157823_1/institution/semillas/22420152_1_VIRTUAL/Materiales%20del%20curso/Unidad… 1/3
26/2/2018 https://sena.blackboard.com/bbcswebdav/pid-17426278-dt-content-rid-3157823_1/institution/semillas/22420152_1_VIRTUAL/Materiales del curso/Unidad …
CALL RETARDO
BSF PORTB,E
MOVLW 0FH
ANDWF PORTB,1
SWAPF R0E,W
ANDLW 0F0H
IORWF PORTB,1
CALL RETARDO
BCF PORTB,E
CALL RETARDO
RETLW 0
;------------------------------------------------------

;*********************************

INICIO
BSF STATUS,5
CLRF TRISB

MOVLW .255
MOVWF TRISA

BCF STATUS,5

CONFI_LCD

MOVLW 02H ;INICIO DEL MODULO A 4 BITS


CALL CONTROL ;
MOVLW 28H ;4 BITS Y DOS LINEAS
CALL CONTROL ;
MOVLW 0CH ;ACTIVA EL DISPLAY
CALL CONTROL
MOVLW 06H ;MENSAJE FIJO,SIN ROTAR
CALL CONTROL

ENTRADA
BTFSS PORTA,0
GOTO BORRA_LCD

MENSAJE
MOVLW 01H ;BORRA DISPLAY
CALL CONTROL
CALL RETARDO
MOVLW " "
CALL DATO
MOVLW " "
CALL DATO
MOVLW " "
CALL DATO
MOVLW " "
CALL DATO
MOVLW " "
CALL DATO
MOVLW "H"
CALL DATO
MOVLW "O"
CALL DATO
MOVLW "L"
CALL DATO
MOVLW "A"
CALL DATO
MOVLW " "
https://sena.blackboard.com/bbcswebdav/pid-17426278-dt-content-rid-3157823_1/institution/semillas/22420152_1_VIRTUAL/Materiales%20del%20curso/Unidad… 2/3
26/2/2018 https://sena.blackboard.com/bbcswebdav/pid-17426278-dt-content-rid-3157823_1/institution/semillas/22420152_1_VIRTUAL/Materiales del curso/Unidad …
CALL DATO
MOVLW "M"
CALL DATO
MOVLW "U"
CALL DATO
MOVLW "N"
CALL DATO
MOVLW "D"
CALL DATO
MOVLW "O"
CALL DATO
MOVLW " "
CALL DATO
MOVLW " "
CALL DATO
MOVLW " "
CALL DATO
MOVLW " "
CALL DATO
MOVLW " "
CALL DATO
CALL RETARDO
GOTO ENTRADA

BORRA_LCD

MOVLW 01H ;BORRA DISPLAY


CALL CONTROL
CALL RETARDO
GOTO ENTRADA
END

https://sena.blackboard.com/bbcswebdav/pid-17426278-dt-content-rid-3157823_1/institution/semillas/22420152_1_VIRTUAL/Materiales%20del%20curso/Unidad… 3/3