scroll text in lcd with pi16f84

Status
Not open for further replies.

loml666

Newbie level 2
Joined
Apr 7, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,312
i am trying to program a text to scroll right to the left, but not work, here is the code en the effect:

:wink:

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

;------------------------------------------------------------------
; Configuración del PIC
; -----------------------------------------------------------------
LIST p=16f84

; Palabra de configuración para el microcontrolador
; code protection off/ power up timer off/ wdt off /XT oscillator
__config 0x3ff9

; -----------------------------------------------------------------
; Variables en RAM a partir de la dirección 0x10
; -----------------------------------------------------------------
cblock 0x10
lcdcount
lcdcount1
lcdcount2
offset
endc

org 0
start:
call IIC_INIT ; inicializar interfaz I2C
call LCD_INIT ; inicializar LCD
call Display ; visualizar posiciones BCD en display LCD
goto start
main:
goto main ; bucle infinito

; -----------------------------------------------------------------
; Subrutinas
; -----------------------------------------------------------------
Display:
movlw D'12' ; columna 0 de LCD hacia W
movwf lcdcount2 ; W hacia columna

movlw D'12' ; columna 0 de LCD hacia W
movwf lcdcount1 ; W hacia columna

movlw D'0' ; columna 0 de LCD hacia W
movwf columna ; W hacia columna

xxx:
movlw 0x20 ; dirección de LCD línea 2 hacia W
movwf línea ; W hacia línea
call LCD_GOTO_XY ; posicionar cursor LCD

movf lcdcount2,0
movwf lcdcount2 ; valor de lcdcount hacia W
movwf lcdcount ; W hacia lcdcount (12 caracteres)

movlw D'0' ; posición de tabla 0 hacia W
movwf offset ; W hacia offset para tabla "text1"

loop1:
movf offset,w ; posición de tabla hacia W
call text1 ; buscar carácter
call LCD_SEND_ASCII ; visualizar en LCD
incf offset,f ; offset para siguiente carácter en "text1"

decfsz lcdcount,f ; lcdcount - 1 -> =0?
goto loop1 ; no -> saltar a loop1
decfsz lcdcount2,f ; lcdcount - 1 -> =0?

incfsz columna,f ;izqu a der
decfsz lcdcount1,f
goto xxx
call wait_480ms

return
; -----------------------------------------------------------------
; Cadenas de texto
; -----------------------------------------------------------------
text1:
addwf PCL,f
retlw ' '
retlw 'U'
retlw 'N'
retlw 'I'
retlw 'V'
retlw 'E'
retlw 'R'
retlw 'S'
retlw 'I'
retlw 'D'
retlw 'A'
retlw 'D'
return

; -----------------------------------------------------------------
; Archivos de inclusión
; -----------------------------------------------------------------
include "p16f84.inc" ; definiciones de controlador de destino
include "time.inc" ; subrutinas de retardo de tiempo
; por software
include "iic.inc" ; subrutinas IIC
include "lcd.inc" ; subrutinas LCD

; -----------------------------------------------------------------
end
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…