Académique Documents
Professionnel Documents
Culture Documents
Conta1
Conta2
Conta3
ENDC
;RETARDO 20ms
Retardo_20ms ; almacenar contenidos en los contadores
movlw .255 ; mover el contenido de 255 a W
movwf Conta1 ; guardarn el contenido de W en Conta1
movlw .26 ; mover el contenido de 26 a W
movlw Conta2 ; guardar el contenido de W en Conta2
Re_20ms
decfsz Conta1, F ; salta cuando el Conta1 llega a 0
bra Re_20ms ; repite la subrutina para hacer el decremento de Conta1
decfsz Conta2 ; salta cuando el Conta2 llega a 0
bra Re_20ms ; salta a la subrutina
Retardo_5ms ; almacenar contenidos en los contadores
movlw .146 ; mover el contenido de 146 a W
movwf Conta1 ; guardarn el contenido de W en Conta1
movlw .13 ; mover el contenido de 13 a W
movlw Conta2 ; guardar el contenido de W en Conta2
Re_5ms
decfsz Conta1, F ; salta cuando el Conta1 llega a 0
bra Re_5ms ; repite la subrutina para hacer el decremento de Conta1
decfsz Conta2, F ; salta cuando el Conta2 llega a 0
bra Re_5ms ; salta a la subrutina
Delay
clrf Conta1
clrf Conta2
movlw .3
movwf Conta3
Re_Delay
decfsz Conta1, F ; salto cuando el Conta1 llega a 0
bra Re_Delay ; repite la rutina para hacer el decrememto de Conta1
return
LIST P=18F4550
INCLUDE <P18F4550.INC>
clrf PORTB
clrf PORTD
clrf TRISB
clrf TRISD
call LCD_Inicializa
bcf LCD_E
Inicio
call Delay ; esperar un tiempo antes de escribir
movlw 'M'
call LCD_Caracter
movlw 'I'
call LCD_Caracter
movlw 'C'
call LCD_Caracter
movlw 'R'
call LCD_Caracter
movlw 'O'
call LCD_Caracter
call Delay
call LCD_Borrar
goto Inicio
LCD_Inicializa
call Retardo_20ms ; Esperar 20ms
movlw b'00110000'
movwf PORTB ;
call Retardo_5ms ; Esperar 5ms
movlw b'00110000'
movwf PORTB
call Retardo_50us ; Esperar 50us
movlw b'00110000'
movwf PORTB ;
movlw 0x0F
movwf PORTB
bsf LCD_E
bcf LCD_E
return
LCD_Caracter
bsf LCD_RS ; leer datos, no direcciones
movwf PORTB
bsf LCD_E ; activar Enable
call Retardo_50us ; esperar 50us para ver los caracteres
bcf LCD_E ; desactivar el Enable
call Delay
return
LCD_Borrar
movlw b'00000001' ; comando de borrado
call LCD_Comando
LCD_Comando
bcf LCD_RS ; leer direcciones
movwf PORTB
bsf LCD_E
call Retardo_50us
bcf LCD_E
return
INCLUDE <Retardo.inc>
END