PICcoder.co.uk Forum  


::post new topic::
New line on a 16X2 LCD
Date: 2008/09/09 14:46 By: Laurance Status: User  
Karma: 0  
Posts: 1
graphgraph
I am having a problem trying to find a method to get the charactures to be displayed on a new line. I am using a pic16f887. I want the number stored in count2 to be written along the lower line of the LCD.

Here is the code that i am using to develop the display

#include <p16F887.inc>
__CONFIG _CONFIG1, _LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_OFF & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF & _INTRC_OSC_NOCLKOUT
__CONFIG _CONFIG2, _WRT_OFF & _BOR21V

org 0
count equ 0x020
count1 equ 0x021
count2 equ 0x022

Start: bsf STATUS,RP0
clrf count
clrf 0E
clrf 0F
clrf PORTC
clrf PORTD
bcf STATUS,RP0
movlw b'00000000'
movwf count1
movlw 0x01
movwf count2


setp bsf STATUS,RP1
movlw b'00000111'
movwf TRISC
movlw b'00000000'
movwf TRISD
bcf STATUS,RP1


movlw 0x02
movwf 0x050
long call short
decfsz 0x050,f
goto long



func bcf PORTC,0x02
bcf PORTC,0x01
movlw 0x38
movwf PORTD
call pulse_e
call short

disp bcf PORTC,0x02
bcf PORTC,0x01
movlw 0x0F
movwf PORTD
call pulse_e
call short
clrf count


mess movf count,w
call text
bsf PORTC,0x02
bcf PORTC,0x01
movwf PORTD
call pulse_e
call short
incf count,w
xorlw PORTC
incf count1,f
btfsc count1,7
call smess1
btfsc count1,7
goto stop
incf count,f
goto mess
movlw b'11111111'
movwf PORTD
stop goto stop

short decfsz 0F,f
goto short
retlw 0

pulse_e bsf PORTC,0x00
nop
bcf PORTC,0x00
retlw 0

text addwf 02,f
retlw 'P'
retlw 'o'
retlw 'w'
retlw 'e'
retlw 'r'
retlw ' '
retlw '('
retlw '8'
retlw '.'
retlw '8'
bsf count1,7
retlw ')'


smess1
movlw b'00000111'
movwf count
mess1
call text1
bsf PORTC,0x02
bcf PORTC,0x01
movwf PORTD
call pulse_e
call short
xorlw PORTC
decfsz count,1
goto mess1
return

text1
btfsc count2,count
retlw '0'
btfsc count2,count
retlw '1'

END
File Attachment:
File name: display.asm
File size:1780 bytes
reply | quote

Re:New line on a 16X2 LCD
Date: 2008/10/11 18:29 By: Graham2107 Status: User  
Karma: 0  
Posts: 2
graphgraph
I haven't digested your code but the first address on Line-1 is 0x00 and on Line-2 is 0x40
reply | quote

::post new topic::