Hola Gente..
Empezando con el tema de los Pics empeze a jugar con los LEDs, leer y escribir la EEPROM, ...
Ahora me surgio un pequeño problemilla, espero puedan ayudarme.. Estoy armando las rutinas para controlar un LCD 16x2 y me encuentro con varias cosas..
- Al simularlo en el Proteus el programa funciona, solo si cargo el archivo .cof, con el .hex no..
- En la realidad no funciona ni para atras..
- Cuando modifico el programa y vuelvo a cargar (el .cof) sigue simulando el programa anterior..
Aqui el programa entero:
; --- Datos PIC ---
list P=16F628A
#include <P16F628A.INC>
; --- Fusibles de Configuracion ---
__CONFIG _BOREN_ON & _CP_OFF & _DATA_CP_OFF & _PWRTE_ON & _WDT_OFF & _LVP_OFF & _MCLRE_ON & _INTOSC_OSC_NOCLKOUT
; --- Declaraciones ---
COUNTER equ 0x20
; --- Programa ---
Reset
org 0x00
goto Inicio
org 0x04
nop
org 0x05
Inicio
bsf STATUS,RP0
bsf PCON,OSCF ; Oscilador Interno funcione a 4MHz.
movlw 0x20
movwf TRISA
movlw 0x00
movwf TRISB
bcf STATUS,RP0
movlw 0x07 ; Comparadores Apagados.
movwf CMCON
Programa
call Retardo
movlw b'00000001' ; Clear Display
bcf PORTA,0 ; RS = 0
call SENDTOLCD
movlw b'00000011' ; Home
bcf PORTA,0 ; RS = 0
call SENDTOLCD
movlw b'00000110' ; Entry Mode
bcf PORTA,0 ; RS = 0
call SENDTOLCD
movlw b'00001110' ; Display Control
bcf PORTA,0 ; RS = 0
call SENDTOLCD
movlw b'00010100' ; Cursor Display Shift
bcf PORTA,0 ; RS = 0
call SENDTOLCD
movlw b'00111000' ; Function Set
bcf PORTA,0 ; RS = 0
call SENDTOLCD
movlw 'L'
bsf PORTA,0 ; RS = 1
call SENDTOLCD
movlw 'i'
bsf PORTA,0 ; RS = 1
call SENDTOLCD
movlw 'o'
bsf PORTA,0 ; RS = 1
call SENDTOLCD
movlw 'n'
bsf PORTA,0 ; RS = 1
call SENDTOLCD
movlw 'e'
bsf PORTA,0 ; RS = 1
call SENDTOLCD
movlw 'l'
bsf PORTA,0 ; RS = 1
call SENDTOLCD
nop
goto $-1
Retardo
movlw 0xFF
movwf COUNTER
decf COUNTER,1
btfss STATUS,Z
goto $-2
retfie
SENDTOLCD
bsf PORTA,1 ; EN = 1
movwf PORTB ; Muevo el Dato al Puerto.
nop
bcf PORTA,1 ; EN = 0 (supuestamente con la bajada del EN el LCD toma los datos)
nop
bcf PORTA,0 ; RS = 0
clrf PORTB
call Retardo
retfie
end
Seguro es una estupidez pero no me estoy dando cuenta..
Gracias por su tiempo..
Saludos..