PDA

View Full Version : LCD Problem



Sphere
- 11th May 2008, 20:09
I’ve got a 20 line 4 row alphanumeric display wired to a PIC18F252 using the default pins. On line 1 im displaying 20 characters, which displays ok, but the problem is the 13th to the 20th characters from the first line is displaying on line 2.

Thanks Sphere.


'-------------------------------------------------------------------------------
'---------------------------18F252 RUNNING AT 20Mhz-----------------------------
'-------------------------------------------------------------------------------

@CONFIG_REQ
@ __CONFIG _CONFIG7H, _EBTRB_OFF_7H
@ __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L
@ __CONFIG _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H
@ __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L
@ __CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
@ __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L
@ __CONFIG _CONFIG4L, _STVR_OFF_4L & _LVP_OFF_4L & _DEBUG_OFF_4L
@ __CONFIG _CONFIG3H, _CCP2MX_OFF_3H
@ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_128_2H
@ __CONFIG _CONFIG2L, _BOR_OFF_2L & _BORV_42_2L & _PWRT_ON_2L
@ __CONFIG _CONFIG1H, _OSCS_OFF_1H & _HS_OSC_1H




DEFINE OSC 20
DEFINE LCD_BITS 4
DEFINE LCD_LINES 4

adcon1=7

PAUSE 500
lcdout $FE,1
pause 500

lcdout $FE,$80,"THIS IS A TEST LINE1" 'LINE 1

MAIN:
pause 4000
GOTO MAIN

Ron Marcus
- 11th May 2008, 21:17
How about this, I believe that the $C0 is the beginning of the second line.




PAUSE 500
lcdout $FE,1,"THIS IS A TEST LINE1" 'LINE 1
pause 500

lcdout $FE,$C0,"This should be line2"

MAIN:
pause 4000
GOTO MAIN

Sphere
- 11th May 2008, 22:23
This is what shows on lines 1&2 on the display:


THIS IS A TEST LINE1
ST LINE1


Using the lcdout $FE,$C0,"This should be line2" shows on lines 3&4 on the display just like this:

This should be line2
be line2


Ive use other 20x4 lcd displays in the past with no problems.

Thanks Sphere.

Archangel
- 11th May 2008, 23:59
Hi Sphere,
Here is what I would do to troubleshoot: Change the comment on line 1 so you can tell if
it is scrambling the comment and printing it or if it is simply printing the last 8 characters
of line 1 on line 2. It maybe you will have to define commandus and Dataus for this particular LCD

Sphere
- 12th May 2008, 07:43
Ive altered LCD_COMMANDUS & LCD_DATAUS from one extreme to another and I either get nothing on the display, corrupt display or the same result as before.

Would wiring all of the data pins on the lcd make a difference or have I just got a duff lcd.


Thanks Sphere.

muddy0409
- 12th May 2008, 09:25
Have you included a defines list like below?
Note the lines define in the 10th line should be for 4 lines

Define LCD_DREG PORTb ' Port for LCD Data
Define LCD_DBIT 4 ' Use upper 4 bits of Port
Define LCD_RSREG PORTb ' Port for RegisterSelect (RS) bit
Define LCD_RSBIT 0 ' Port Pin for RS bit
Define LCD_EREG PORTb ' Port for Enable (E) bit
Define LCD_EBIT 2 ' Port Pin for E bit
DEFINE LCD_RWREG PORTb 'port for the R/W bit
DEFINE LCD_RWBIT 1 'port pin for R/W bit
Define LCD_BITS 2 ' Using 4-bit bus
Define LCD_LINES 4 ' Using 4 line Display **************************
Define LCD_COMMANDUS 2000 ' Command Delay (uS)
Define LCD_DATAUS 50 ' Data Delay (uS)

Sphere
- 12th May 2008, 17:36
Tried adding the defines but no joy, still the same result. Ill just wire all the data pins up and see if that works. If no joy ill just resign it to the scrap bin of life.

Thanks all Sphere.

skimask
- 12th May 2008, 17:41
Ive altered LCD_COMMANDUS & LCD_DATAUS from one extreme to another and I either get nothing on the display, corrupt display or the same result as before.
Keep in mind that LCD_DATAUS is a byte value. Max is 255. 256 would be treated just like a 0. LCD_COMMANDUS is still a word value.


Would wiring all of the data pins on the lcd make a difference or have I just got a duff lcd.
Of course wiring would make a difference.
Looks to me like you've got some crossed wires and/or solder joints.

Sphere
- 14th May 2008, 22:39
Wired all data lines but still have the same issue, but it looks like it treats lines 1 & 2 as line one and lines 3 & 4 as line two. Is there any limitation in picbasic pro's lcdout command for this type of display. The display type is Batron BTHQ42003AV, ive ordered a replacement anyway just in case this one is faulty.

Thanks Sphere.

skimask
- 14th May 2008, 23:33
Wired all data lines but still have the same issue, but it looks like it treats lines 1 & 2 as line one and lines 3 & 4 as line two. Is there any limitation in picbasic pro's lcdout command for this type of display. The display type is Batron BTHQ42003AV, ive ordered a replacement anyway just in case this one is faulty.


Would've been a lot more helpful to have the model information a lot earlier.
The model you've got has a controller that isn't 100% Hitachi 44780 compatible.
Seems it likes to work in blocks of 12...which would probably explain your issues.
In the case of this LCD, the standard 1st line ($80), 2nd line ($C0), 3rd line ($94), 4th line ($D4) addresses aren't going to work.
Here's the link to the datasheet:
http://www.datasheetcatalog.com/datasheets_pdf/H/C/D/6/HCD66712UA02.shtml
Read thru it a bit. You may/may not see what I mean...specifically page 364, 384, and 419.

Sphere
- 15th May 2008, 07:45
Is the display not compatable with pic basic and do you know what the EXT pin is.

Thanks Sphere.

skimask
- 15th May 2008, 13:36
Is the display not compatable with pic basic and do you know what the EXT pin is.

Thanks Sphere.

I'd say it's 'compatible enough', it just needs different parameters than what the PBP manual calls for.
From the quick read I did of that datasheet (the rest is up to you), it looks to me like the left 12 characters can be accessed normally, like it was a regular 12x4 display. But to get to the right 8 characters, you have to use that pin in some way.
It's either that or write your own routines to handle the display...

Sphere
- 15th May 2008, 18:18
Thanks for trying, I guess I will have to find an alternative display. If anyone out their can help with an alternative display which is compatible with pic basic but also has the same dimensions as the display I quoted it would be appreciated.

Thanks again skimask for the extended effort.

Sphere.

skimask
- 15th May 2008, 19:40
Thanks for trying, I guess I will have to find an alternative display. If anyone out their can help with an alternative display which is compatible with pic basic but also has the same dimensions as the display I quoted it would be appreciated.
I don't think you need a different LCD. A little bit of reading will most likely get this LCD working for you just fine.

Acetronics2
- 15th May 2008, 20:03
Hi,

it appears the "extention driver" must be enabled for character > 12 th column ...

solution is in the KS 0073 Datasheet, page 27 bottom ...

Good reading

Alain

mister_e
- 15th May 2008, 20:40
The HD66712 software is upwardly compatible with the LCDII (HD44780) which allows the user to
easily replace an LCD-II with an HD66712. In

it's compatible... hardware problem...