PDA

View Full Version : LCD driver compatability



jmgelba
- 2nd November 2005, 03:19
I've done a fairly extensive search over the course of a few hours and still cannot determine if the SEC KS0066 is compatible with the HD44780. Some say yes, some say no, some say with software mods, and some say it works perfectly with PBP's LCDOUT command.
I only found one official datasheet which was pretty poor, that shows a connection between the two drivers, but does not mention if they are compatible. I have a 16x2 KS0066 lcd here made by Tianama that does not appear to work. The top line displays all black boxes and the bottom is empty.
The code is the simple and obvious PBP example.........

define osc 10
ADCON1 = 7
TRISA = %00000000
TRISB = %00000000
PORTA = 0
PORTB = 0
Pause 1000
loop: Lcdout $fe, 1
Lcdout "Hello"
Pause 1000

Lcdout $fe, 1
Lcdout "World"
Pause 1000

Goto loop


So, if any of you are using a KS0066 driven device, please post here. Tell us which display you are using and if there were any workarounds, if it works perfectly out of the box.
This should help everyone who's looking for compatability information.

Thanks.

muddy0409
- 2nd November 2005, 08:32
Have you set up the port defines?
RTFM.
MEL PBP manual page 91 LCDOUT gives a damn good description, shows how to connect it and everything.

UNRELATED to jmgelba's question:

While on the subject of LCDs I keep wondering why people buy and use the serial adaptors for LCDs. Economically speaking, they cost around $20 or so, but a PIC with aditional port lines, say a full port, in a 28 pin version is only in the order of $10 or so. I do think the extra bit of programming experience is most helpful. I used a (few different) serial bacpacks too, until I came across Mel's Olympioc Timer and RTFM It is so much better using the suggested method of driving an LCD and it is easier to stack the LCD module straight onto your PCB or Vero without another backpack getting in the way.

jmgelba
- 2nd November 2005, 13:39
Of course the Defines are set up correctly. I did not include them in the post as I thought it would be understood by everyone that they are needed.
Also, "RTFM" the manual. You know what that means right? Stop dodging the swear filter.

CocaColaKid
- 2nd November 2005, 20:39
From what I could fine they should be compatible with the key words "should be"

muddy0409
- 3rd November 2005, 07:12
Well, EXCUSE ME for upsetting your sensitivity.....

Don't the commands have to be in one line?

EG loop: Lcdout $fe, 1
Lcdout "Hello"

Should be (?)

loop: Lcdout $fe, 1,"Hello"

Just another idea..........

Melanie
- 3rd November 2005, 08:27
I have known some LCDs that requires TWO SECONDS of timeout BEFORE any data is sent to them after initial power-up.

jmgelba - never assume your defines are correct which is why you should really provide everyone on the forum with as much information to your problem as possible without folks trying to second-guess your setup. You MUST check the SPELLING because PICBasic will not nescessarilly flag an error in a DEFINE statement - and of course your hardware connections EXACTLY match your DEFINE statements... you've not done something silly like cross-connect RS and E lines? Or reverse-connect the Datalines, or connect them to D0 thru D3 rather than D4 thu D7? We've all done it sometime!

The defines listed below function on almost every LCD I've tried (alter the Hardware pins to suit your own layout), but do try with a longer initialisation timeout... you've nothing to lose except a couple of seconds...



'
' LCD Display
' -----------
Define LCD_DREG PORTC ' Port for LCD Data
Define LCD_DBIT 4 ' Use upper 4 bits of Port
Define LCD_RSREG PORTC ' Port for RegisterSelect (RS) bit
Define LCD_RSBIT 3 ' Port Pin for RS bit
Define LCD_EREG PORTC ' Port for Enable (E) bit
Define LCD_EBIT 0 ' Port Pin for E bit
Define LCB_BITS 4 ' Using 4-bit bus
Define LCD_LINES 2 ' Using 2 line Display
Define LCD_COMMANDUS 2000 ' Command Delay (uS)
Define LCD_DATAUS 50 ' Data Delay (uS)


Finally, a lot of folks do regard the 'F' in RTFM as a swear word... it's original usage was as such even if you claim it isn't in your interpretation of it. Even I wince at it's public usage sometimes. I also want to scream "Read the ** Manual", or "Read the ** Datasheet", or "Search the ** forum posts" or "Why don't you just try it and see if it ** works instead wasting bandwidth" (insert your favourite word[s] at asterisk position) at folks so many times on this forum, it's best not to reply or bite your lip and moderate what you really would like to say rather than offend. Let's appear to be nice even if we aren't sincere about it. *smiles* Melanie - who's always nice to everyone equally - yeah right!

jmgelba
- 3rd November 2005, 17:42
Mel I appreciate your responce - very mellow for you ;-)
I can understand the constant feelings towards people who ask the same questions over and over. A little searching of the site would help, and reading through the manual. I am guilty of not searching enough, and to me sometimes the manual is vauge. It needs a more indepth explanation of some of the functions and better examples of the uses. The manual is guilty of the same thing I did in my original post, assumes you know how to set up the start of a program. It hardly ever sets up a full program when providing an example of how to use a particular statment. Sometimes you just gotta do that for some people. They see it correctly written form the first DEFINE to the last GOTO and it clicks for them.

Regarding the RTFM. Yeah, it pi**ed me off. I'm not usually that emotional, but I had received the news yesterday that my mother had been diagnosed with skin cancer, and I'm 4000 miles away and can't visit. I apologise for my responce. Still I think as a mature group, we don't need the phrase.

My intent was to basically have a reference point thread for LCD out of the box compatability with PBP's LCDOUT commands. I'd read the manual several times, and the datasheets for the 2 pics I used, and the datasheet for the LCD. Played with 2 LCD's, 6 different PICS (3x 16F818, 3x 18F1320) and still had not got it to work, and checked the wiring and defines about eleventy billion times.

To help cure the problem of repeated questions and "do all my code for me" questions, several things can be done.

1. When new members sign up, they should have to go through a FAQ section before they get to post anything.

2. Stickys should be placed at the top of the forums stating "Questions that will not be answered without/until" and an appropriate list created such as post all your code, what doesnt work, what hardware, what programmer, what software? etc etc.

3. Better examples of code that include a complete program from start to finish. Basically a library of building blocks that a member can adapt to their individual needs. Examples to state the PIC used, and possibly a schematic? I realise that some people do this already and provide a wondeful level of information.

4. It seems as though a lot of the same questions are posted in different forums. Perhaps if they were moved to the correct forums, people would be able to find something they are looking for quicker and easier. Repeat posts in different forums by the same member should either be combined into one thread or the second instance be deleted. If this website grows and includes 60,000 members one day, double posting will cluter this place and kill its usefulness.

5. Reciprocation. If you are a beginner, you'll be doing all the asking. One day you will grasp something, use it, understand it and be able to do some of the answering. Don't leave the answering up to the same handful of people. If you KNOW it works and how to fix the problem for someone, help out and post up a responce.

6. In keeping with a community feeling, there should be someway (I'm aware of the adverts forum) that people can advertise any services that they provide. If someone needs a pcb designed, and another member does pcb layout, there should be a way for the 2 to connect. Perhaps under the user name, there could be a "services offered" line? Yeah its free advertising through the site, and the site itself dosent gain primary benefits from it but its users do, and the word spreads. Great if you are a small business and that one customer helps make this months mortgage payment.

I will post up the defines and even a picture of the breadboard in another relpy to this thread later today.

Regards,

James.

jmgelba
- 4th November 2005, 02:34
DEFINE OSC 10
DEFINE LCD_DREG PORTA
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 1
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50

' DATA LINES ON PORTA.0 - 3 for DB4 to DB7
' 4 BIT MODE
' E PIN ON PORTB.1
' RS PIN ON PORTB.0
' TRIED COMMANDUS UP TO 5000 and DATAUS UP TO 255

ADCON1 = 7
TRISA = %00000000
TRISB = %00000000



Pause 5000 ' Wait for LCD to startup

loop: Lcdout $fe, 1 ' Clear LCD screen
Lcdout "Hello" ' Display Hello
Pause 2000 ' Wait 2 seconds

Lcdout $fe, 1 ' Clear LCD screen
Lcdout "World"
Pause 2000 ' Wait 2 seconds

Goto loop ' Do it forever


Picture to follow after camera batteries have finished charging.

jmgelba
- 5th November 2005, 02:58
Ermmmm yeah - helps to turn OFF the ADC instead of ON!! The 18F1320 has an ADCON1 bit for each ADC pin, and its 0 for ADC channel i/p and 1 for Digtial o/p.
All is well and my sexy new Optrex Negative blue LCD is working great. Haven't tried the Tianma yet, or the Noritake VFD.
Will update.