Searching \ for '[EE] Trouble on 2nd line of LCD' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/lcds.htm?key=lcd
Search entire site for: 'Trouble on 2nd line of LCD'.

Exact match. Not showing close matches.
PICList Thread
'[EE] Trouble on 2nd line of LCD'
2009\07\10@233258 by Steve Maroney

flavicon
face
Dear gang,

I have this LCD: http://www.futurlec.com/LED/LCD16x2.shtml

I can write chars to the LCD and seems to work ok but when I move the
cursor to the 2nd line, and write to the LCD, nothing is displayed.

To move the cursor the 2nd line, I clear the RS bit, send 0xC0, then
pulse the EN bit.

The code works as expected on the OSHON PIC IDE/Simulator.  Anyone have
any ideas on what im doing wrong ?

Before writing characters to the LCD, I have this small function to
setup the LCD:

First I bring the RS bit low and bring the EN bit high

movlw 0x38          ; 8bit, 2 line, 5x7 resolution
movwf PORTC

then  I pulse the EN bit

movlw 0x0C                ; display on, cursor off
movwf PORTC                

pulse the EN bit again

movlw 0x01                ; clear LCD display
movwf PORTC

pulse the EN bit again

finally I bring the RS bit high before returning from the routine.


Best Regards,
Steve Maroney

Business Computer Support, LLC
Mobile Phone:504-914-4704
Office Phone: 504-904-0266
Fax: 866-871-7797

2009\07\11@001812 by Steve Maroney

flavicon
face
Also, I think I should add that If I turn the contrast all the up, to
where I cant read the chars and see square blocks, I thought I would see
the second row blocks, as I do the first row, but I only see the first
row.

Hopefully that makes some sense.


Best Regards,
Steve Maroney

Business Computer Support, LLC
Mobile Phone:504-914-4704
Office Phone: 504-904-0266
Fax: 866-871-7797



{Original Message removed}

2009\07\11@003244 by Tony Vandiver

flavicon
face
Are you sure setting up for multiline isn't movlw 0x28 instead of movlw
0x38?  I'm just going by some code for another similar display, but it's
hard to compare because I've got it in 4 bit mode.  I'd say that first
you should go back to the datasheet and go over the initialization
process with a fine tooth comb - make sure you're also meeting the
timing requirements listed, i.e. if it says stay in reset for 25msec,
try staying in reset for 100msec, etc..

Tony


Steve Maroney wrote:
{Quote hidden}

> {Original Message removed}

2009\07\11@003244 by davidcou

picon face
When you initialize the LCD Module (after power up) , You should init the module for 2 Line operation.

Whenever you do NOT see the DOTs on the 2nd line, this means that the Driver is in One Line Mode and only multiplexing the TOP Line of the LCD.

I would suggest that you?inspect your Init routine for this revision.? (This only needs to be setup once after power up).




{Original Message removed}

2009\07\11@004947 by John Coppens

flavicon
face
On Fri, 10 Jul 2009 23:16:18 -0500
"Steve Maroney" <spam_OUTsteveTakeThisOuTspambcsupportllc.com> wrote:

> Hopefully that makes some sense.

If no blocks at all are visible, it is probably because you didn't
(correctly) put the LCD in two-line mode at startup. This can only be
done once, I believe. The default (even for a two line display) is one
line only.

Note that those first instructions do not correctly activate the BUSY
line - you have to respect the times mentioned in the data sheet, for
each of the initialization steps. There is one step that takes even 1.5
ms! If you do not respect those times, the configuration command that
selects two-line mode will no be recognized.

look for the Hitachi HD44780 datasheet (which is probably the controller
chip on the LCD).

Quite probably the simulator doesn't respect the timing.

John


2009\07\11@020615 by Steve Smith

flavicon
face
Check the initialisation... here is an asm snippet that works...

;--------------Lcd handler for pic 16cxx / 5x-------------
;--------------By Steve Smith 1997 onwards----------------
;--------------RS line reused for other items-------------

;************* LCD FUNCTIONS ******************************
;LCD_DATA        EQU                PORTB                        ; PLACE TO SEND LCD
INFO
;#DEFINE        LCD_EN        PORTA,4                        ; LCD ENABLE
;#DEFINE        LCD_RS        PORTA,3                        ; LCD REGISTER SEL
                                               ; R/W IS NOT USED (GND)
;------------------MEMORY REQUIREMENTS----------------------------------
STRNUM            EQU     GP1 +1                        ; TEXT STRING NUMBER STORE
CHPT              EQU     STRNUM +1                    ; CHAR POINTER
LCDCH            EQU     CHPT +1                      ; LCD CHAR
TABOFF            EQU     LCDCH+1                      ; TABLE OFFSET

;------------------INCREMEMTS CHARTHER POINTER FOR TEXT STRING----------
POINT   MACRO

       INCF    TABOFF,1
       MOVFW   TABOFF
       ADDWF   PCL,1
       ENDM
POINT1   MACRO
       INCF    TABOFF,F
               incf        PCLATH,f
       MOVFW   TABOFF
       ADDWF   PCL,F
       ENDM
;--------------LCD CONTROL FUNCTION EQUATES-----------------
LINE1                EQU        B'10000000'
LINE2                EQU        B'11000000'
LINE1_8                EQU        B'10001000'
LINE1_14        EQU B'10001101'
LINE2_8                EQU        B'11001000'
LINE2_6                EQU        B'11000101'
BLINK                EQU        B'00001110'
NBLINK                EQU        B'00001100'
S_P                        EQU        020h

LCD_INIT        MACRO
;--------------LCD INITALISATION CODE-----------------------

       MOVLW   38h             ; LCD RESET
       CALL        LCD_CMD        ; DO INSTRUCTION
       MOVLW   06h             ; DISPLAY DIR RIGHT
       CALL        LCD_CMD        ; DO INSTRUCTION
       MOVLW   0Ch             ; DISPLAY ON AND CURSER SET
       CALL        LCD_CMD        ; DO INSTRUCTION
       ENDM
;--------------------------------LCD TEXT STRING
HANDLER---------------------
STRING        
       IF DEBUG == 1                ; REMOVE COMMENT DURING DEBUG
       RETLW        0                
       ELSE        
       MOVWF        STRNUM                ; SAVE STRING NUMBER
       MOVLW        0FFH                ; POINTER TO BEGINING OF STRING
       MOVWF        TABOFF                ; WELL IT IS NOW
DOSTR        PAGE1                        ; SET PAGE MARKER
       CALL        CALLSTR                ; GET STRING CHAR POINTED TO IN TABOFF
       PAGE0                        ; RESET PAGE MARKER
       MOVWF        LCDCH                ; SAVE CHAR
       ANDLW        B'01111111'        ; MASK END BIT (END OF STRING MARKER)
       CALL        LCD_OUT                ; SEND CHAR
       BTFSS        LCDCH,7                ; CHECK LAST
       GOTO        DOSTR                ; NOT FINISHED DO SOME MORE
       RETLW        0                ; EXIT
       ENDIF

LCD_CMD
       BCF     LCD_RS          ; CONTROL MODE
   goto        LCD_OUT_1
LCD_OUT
       BSF                LCD_RS                        ; data mode
LCD_OUT_1  
   MOVWF   LCD_DATA              ; PUT LCD CONTROL DATA ON BUS
; 1us port settle time
       NOP
   BSF     LCD_EN                        ; Lcd enable High SEND IT
       NOP                                                ; 1us port settle
time
       BCF     LCD_EN                        ; Lcd enable low


       
       BSF                LCD_RS                        ; RESET RS LINE
;        btfss        COM_F                        ; flag for line
;        BCF                LCD_RS


       MOVLW        .20                ; short delay period
       GOTO        SHORT                ; short delay
       

;--------------LCD CLEAR DISPLAY-----------------------------------
LCDCLR        
       MOVLW   01h             ; CLEAR DISPLAY
       CALL        LCD_CMD        ; SHORT TIME DELAY
       MOVLW        .3                ; LONG DELAY PERIOD
       GOTO        LONG                ; DO TIME

;************* END LCD FUNCTIONS ************************

;--------------TEXT STRINGS------------------------------
;    ORG 200
;LAST    EQU     b'10000000'

;CALLSTR
;        MOVFW   STRNUM  ; GET STRING
;        ADDWF   PCL,1   ; WHICH STRING
;        RETLW   '0'+LAST
;        GOTO    MSG7    ; ON
;        GOTO    MSG8    ; OFF
;        GOTO    MSG9    ; FAULT
;MSG7    POINT
;        RETLW   'O'
;        RETLW   'N'
;        RETLW   ' '+LAST
;MSG8    POINT
;        RETLW   'O'
;        RETLW   'F'
;        RETLW   'F'+LAST
;MSG9    POINT
;        RETLW   'F'
;        RETLW   'A'
;        RETLW   'U'
;        RETLW   'L'
;        RETLW   'T'
;        RETLW   ' '+LAST





{Original Message removed}

2009\07\11@132528 by Dwayne Reid

flavicon
face
At 09:31 PM 7/10/2009, Steve Maroney wrote:
>Dear gang,
>
>I have this LCD: http://www.futurlec.com/LED/LCD16x2.shtml
>
>I can write chars to the LCD and seems to work ok but when I move the
>cursor to the 2nd line, and write to the LCD, nothing is displayed.

There are two different styles of 2-line LCD display - those whose
2nd line start address begins right after the 1st line finishes and a
similar-looking display whose 2nd line start address begins at (I
think) either decimal 40 or decimal 80.  I suspect that you are
running into that problem.

Sorry that I can't remember the specific details right now but it
might prompt someone else to chime in with the start address of the
2nd line.  If not, I'll look it up and post another message later today.

Hope this helps!

dwayne

--
Dwayne Reid   <.....dwaynerKILLspamspam@spam@planet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax
http://www.trinity-electronics.com
Custom Electronics Design and Manufacturing

2009\07\11@143556 by Wouter van Ooijen

face picon face
>> I have this LCD: http://www.futurlec.com/LED/LCD16x2.shtml
>
> There are two different styles of 2-line LCD display - those whose
> 2nd line start address begins right after the 1st line finishes and a
> similar-looking display whose 2nd line start address begins at (I
> think) either decimal 40 or decimal 80.  I suspect that you are
> running into that problem.
>
> Sorry that I can't remember the specific details right now but it
> might prompt someone else to chime in with the start address of the
> 2nd line.

When all magic and guesswork fails, where do you go for help? Hint:
follow the URL.. No, not the ones in my sig.

--

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: http://www.voti.nl/hvu

2009\07\12@004822 by Steve Maroney

flavicon
face
In order to contribute to this list, I've wanted to let  you guys know
that I found my problem.

In my lcd_init routinue, I was sending the function set instructions (2
lines, 8bit, resolutions, etc) BEFORE my next command, which was turning
on the LCD and homing the cursor.

The solution was to first turn on the LCD, then to send the setup
instructions, then clear the LCD just in case there is chars on the
display.

Thanks for the help.


Best Regards,
Steve Maroney

Business Computer Support, LLC
Mobile Phone:504-914-4704
Office Phone: 504-904-0266
Fax: 866-871-7797



{Original Message removed}

2009\07\14@174526 by microsoftwarecontrol

flavicon
face
position index for second line is starts at 40. actual move value is 68
something.
try it, you will find correct index value.



----- Original Message -----
From: "Steve Maroney" <stevespamKILLspambcsupportllc.com>
To: "Microcontroller discussion list - Public." <.....piclistKILLspamspam.....mit.edu>
Sent: Sunday, July 12, 2009 12:46 AM
Subject: RE: [EE] Trouble on 2nd line of LCD


{Quote hidden}

> {Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2009 , 2010 only
- Today
- New search...