4x20 huge LCD problem
Scarecrow
Posts: 38
hi guys,
i just bought a 4x20 lcd and i made it work but i get some very strange results and ive tried everything and i think im going to hang myself now...hehe BUT before i do i tought that maybe you guys had the same problem so maybe theres hope in my life so here it is:
ive programed the lcd to display a character and display in the debug terminal the adress where that character is
the problem comes when in the first line at the 13·position it has a duplicate in line 2 at the first position, and then when line 1 is finished that duplicate(which is now in pos 9·of line 2)continues to finish line 2
same for line 3 and 4
i dont know what could be the problem and i really would like to make this work, ive read other posts with the same problem but no solution, thanks in advance =P
i just bought a 4x20 lcd and i made it work but i get some very strange results and ive tried everything and i think im going to hang myself now...hehe BUT before i do i tought that maybe you guys had the same problem so maybe theres hope in my life so here it is:
ive programed the lcd to display a character and display in the debug terminal the adress where that character is
the problem comes when in the first line at the 13·position it has a duplicate in line 2 at the first position, and then when line 1 is finished that duplicate(which is now in pos 9·of line 2)continues to finish line 2
same for line 3 and 4
i dont know what could be the problem and i really would like to make this work, ive read other posts with the same problem but no solution, thanks in advance =P
Comments
One must assume you think that your code is at no fault here since you declined to post it....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
·· While I am inclined to agree with you for many reasons, there are those that will buy the bargain or surplus LCDs, and for those circumstances Jon has a good point.· Assuming the connections are the same as other LCDs (Most are) and at least a Hitachi-Comaptible controller, then you can at least map the display by slowly printing to all the addresses (Displaying the address in DEBUG) and determine mapping.· And of course, it always helps to obtain the datasheet for any LCD.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Post Edited (Scarecrow) : 7/21/2005 3:40:29 PM GMT
Folks in my supply space are four LCD displays. One is a large format a 4x16 one from Optrex, the others are all 2x16 devices. One is a new one, the others are surplus.
The heck of it is that they are all using the Hitachi controller, and have the same pinouts. Also the same "instruction sequences". All are parallel controlled by the way.
So unless we see either the code, or screenshots of the device at work, we can't assume anything.
Personal for both Chris, and Jon, your both right.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Buck Rogers
www.gregg.levine.name
From experience, usally the pinout connections cause the most trouble.
Find the data sheet and double check the connections, then check them
again.
Good Luck
Gordon
addr = $80 + $00· (Line 1 position 0)
addr = $80 + $40· (Line 2 position 0)
addr = $80 + $20· (Line 3 position 0)
addr = $80 + $60· (Line 4 position 0)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
addr = $80 + $00 (Line 1 position 0)
addr = $80 + $40 (Line 2 position 0)
then you get the result you see in lcdtest.bmp
if i do the whole 4, the same problem in line 1 and line 3 copying to line 2 and 4 after character 13
Post Edited (Scarecrow) : 7/22/2005 3:11:16 PM GMT
·· That is weird.· I think I finally grasp what you're saying is happening.· After character 13 you're saying data prints to two locations at the same time?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Nice display actually. Where did you get it? (I might not want to buy one until your problem is solved, but it's still very small and cute!)
Post Edited (Scarecrow) : 7/22/2005 6:45:07 PM GMT
char = %00101100 'enter extended function set
GOSUB LCDcmd
char = %00001001 '4 lines
GOSUB LCDcmd
char = %00101000 'exit extended function set
GOSUB LCDcmd
char = %00001100 ' display on, cursor off, blink off
GOSUB LCDcmd
char = %00000110 ' inc crsr, no disp shift
GOSUB LCDcmd
==================================================================================================
PAUSE 4000························· 'Pause (4sec) Wait for LCD Bootup to Clear
SEROUT 9,BAUD,[noparse][[/noparse]003]················ 'Hide display
SEROUT 9,BAUD,[noparse][[/noparse]014,100]············ 'Turn Backlight to 100% (On)
SEROUT 9,BAUD,[noparse][[/noparse]020]················ 'Turn Scroll Off
SEROUT 9,BAUD,[noparse][[/noparse]024]················ 'Turn Wrap Off
SEROUT 9,BAUD,[noparse][[/noparse]004]················ 'Turn Cursor Off
SEROUT 9,BAUD,[noparse][[/noparse]CLR]················ 'Clear Screen
SEROUT 9,BAUD,[noparse][[/noparse]LINE1]·············· 'Goto Home Position
SEROUT 9,BAUD,[noparse][[/noparse]"Hello World!"]····· 'Display Text
SEROUT 9,BAUD,[noparse][[/noparse]017,000,001]········ 'Position Cursor at Col 1 of Line 2 on LCD
SEROUT 9,BAUD,[noparse][[/noparse]"Text Sent by BS2"]· 'Display Text
PAUSE 4000························· 'Pause
SEROUT 9,BAUD,[noparse][[/noparse]CLR]················ 'Clear Screen
·
'{$STAMP BS2}
'{$PORT COM2} ' Dont forget here
E CON 7 ' CHANGE HERE for YOUR pins to LCD
RS CON 8
Char VAR BYTE
DA VAR BYTE
MAIN:
pause 1000
GOSUB LCD_ini
DIS:
Char = 12
GOSUB LCDcmd
Char = 133 ' CHANGE VALUE HERE FOR diferent CURSER SPACES
GOSUB LCDcmd
Char = 69 ' VALUE for E
GOSUB LCDda
Char = 77 ' VALUE for M
GOSUB LCDda
Char = 73 ' VALUE for I
GOSUB LCDda
Char = 84 ' VALUE for T
GOSUB LCDda
STOP
LCD_ini:
LOW 9
'PAUSE 1000
Char = 48 ' 8-bit mode
GOSUB LCDcmd
PULSOUT E, 1
PAUSE 10
Char = 48 ' 8-bit mode
GOSUB LCDcmd
PULSOUT E, 1
PAUSE 1
Char = 48 ' 8-bit mode
GOSUB LCDcmd
PULSOUT E, 1
PAUSE 1
PAUSE 5
PULSOUT E, 1
PULSOUT E, 1
Char = 32 ' 4-bit mode
GOSUB LCDcmd
PULSOUT E, 1
Char = 40 ' Set for 2 line operation
GOSUB LCDcmd
Char = 12 ' Shift cursor right
GOSUB LCDcmd
Char = 6 ' Increment DDRAM after write
GOSUB LCDcmd
Char = 1 ' Clear LCD screen
GOSUB LCDcmd
Char = 4
GOSUB LCDcmd
RETURN
LCDcmd:
LOW RS
LCDwr:
DA = Char.HIGHNIB
GOSUB CONV
PULSOUT E, 1
DA = Char.LOWNIB
GOSUB CONV
PULSOUT E, 1
HIGH RS
RETURN
LCDda:
HIGH RS
LCDwrD:
DA = Char.HIGHNIB
GOSUB CONV
PULSOUT E, 1
DA = Char.LOWNIB
GOSUB CONV
PULSOUT E, 1
LOW RS
RETURN
CONV:
OUTPUT 3
OUT3 = DA.BIT3 ' CHANGE HERE for the pins you have connected to LCD 4 bit mode
OUTPUT 4
OUT4 = DA.BIT2
OUTPUT 5
OUT5 = DA.BIT1
OUTPUT 6
OUT6 = DA.BIT0
RETURN
Either way I am glad you got it working! It's a very cute display to say the least!
I would think I would prefer serial any day. I see Pbasic having some code on this in this thread. Pbasic - what model(s) did you use with that?
Just trying to find a 4x20 lcd/vfd that is small and can be controlled serial wise without tossing out more then 30$ for the deal.
·· Basically you read in the command register (Which will read in the current address pointer) and check the state of BIT7.· If BIT7 is set, you re-read the register until it's cleared then send your next character/command.· This is more useful to the SX, but the faster BASIC Stamps, such as the BS2px24 could find themselves wasting time pausing when it might be quicker to simply check the busy flag at the entry point into your LCD write routine.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
=============================================================================================================================================
Name=Chris Ault
=============
Age
12
======
grade
7
Webpage
Email=miniwarrior@cox.net