PDA

View Full Version : Crappy copy of HD44780?



mike_s
01-08-2006, 06:19 AM
I hope this is the last time I have to post questions about this damn thing and there's probably a few others who feel the same.
After much persistence and cursing I have an initialization for this display I have. I thought it was a HD44780 clone but I'm beginning to suspect it is not or at least a very poor implementation of the hitachi spec.
I seem to have no control of the cursor once the message data has been sent. A workaround I found was to keep the display in a loop of the message dislayed.
Also it does not work when powered up until I reset the stamp. Which isn't exactly desirable.
When the contrast is turned up till the background is visible(blocks) The cursor is still visible writing the message. This may be normal?
I have attached the code for anyone else (probably only aussies) who may have tried to use this diplay with a bs2 stamp.
Datasheet is available here
http://www.jaycar.com.au/products_uploaded/QP-5515.pdf
If there is anyone that thinks they can shed some light on why it only works with this peculiar sequence I would like to know.
Also with the powerup problem the only work around I can think of at the moment would be to use a spare i/o pin pulsed low and connected to the reset pin. However is this safe as long as the pin used is always used for this purpose and only ever used as an out low?

mike_s
01-08-2006, 07:00 AM
One question I should ask. How important is the 4.7k resistor between e and db0-3?

PJ Allen
01-08-2006, 07:03 AM
in re. "Fourbit", you have: Fourbit CON %00100100 (or $24)

Instruction Codes for Function Set:

DB7 = 0, DB6 = 0, DB5 = 1 (to chose Function Set), DB4 = 0 for 4 bits, DB3 = 1 for 2 lines *** DB2 = 0 for 5x7···· ***, DB1 = 0, DB0 = 0.·

So, I think that should be: ·Fourbit CON %00101000 (or $28.)

I think in your previous post about counting mm:ss you mentioned a 2 line display.

Try it with this and excise the work-around/s.

[The order is % DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 ]

Post Edited (PJ Allen) : 1/7/2006 11:07:52 PM GMT

mike_s
01-08-2006, 07:41 AM
You are right Fourbit was incorrect if I want 4 bit mode 2 lines and 5x7. The way I had it %00100100 would be 4 bit 1 line and 5 x 10
I have corrected it although Whether it is one line or 2 lines for the application hardly matters to me.
Having found that this brief initialization routine somewhat works I might go back to my 8 bit code and see how much can be removed or altered without affecting the display.

mike_s
01-08-2006, 08:21 AM
Here is my 8 bit code for same purpose after playing with removing and changing code this does not have a powerup problem it executes as expected and no rogue cusor.
However I am baffled why the clr_display command does not return home but writes continuously at the end of each strings through both lines.

PJ Allen
01-08-2006, 11:04 AM
in re. your 2nd program (8-bit) --
it keeps repeating because... you never tell it to stop.


Start:
FOR index = 0 TO 14
READ msg + index, char
GOSUB LCDwr
NEXT
GOTO main <------- !!!!!!!

At the end there, you have GOTO main -- so, it goes back to main, over and over and over and...
So, you need to tell it to stop doing that, get rid of the GOTO main; PAUSE or END or something.
Another thing, one of my datasheets has Execution times for Instruction Codes as being between 40 usec to 1.64 msec.
I worked over your program a little, an END, longer PULSOUTs.· How's it work for you?




Post Edited (PJ Allen) : 1/8/2006 3:16:02 AM GMT

mike_s
01-08-2006, 12:33 PM
No go. I have tried those things you suggested previously and both the 4 bit and 8 bit code are about as close as I can get to make the display behave.
But I tried them again as you suggest to remind me why they didn't work.
Substituting end for the loop results in the cursor writing randomly the last character written. (2)
And like I said I have tried pauses of various lengths with no effect. In fact even leaving all delays out seems to have no effect which is against every timing chart including the one for this display.
I think I'll source an lcd from another supplier to see 1. How my code works on it and 2. How it behaves with all the samples of lcd code from parallax and others.
It must be a dodgy display I'm using.
Don't get me wrong I have had the timer you helped me with, up and working including the keypad buttons for mins, tens of seconds and start. Display worked fine with the code
But 4 bit was problematic from the start and is still not working as well as 8 bit does.
I have attached the countdown timer if you are interested.

mike_s
01-08-2006, 12:36 PM
I haven't added a pause or clear yet but you can reset the timer with the reset on the stamp

Chris Savage
01-08-2006, 01:14 PM
I know your code says you've tried various PAUSE values in the code, but they are required in the Hitachi spec.· In fact, a good reference to working Parallel code (4-Bit Mode) is at the following link.· I think I sent it to you before, but don't recall if you ever tried it.

http://www.parallax.com/dl/src/prod/LCD2x16Par.zip

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

mike_s
01-08-2006, 02:35 PM
I thought I had but I will try it again. Thanks Chris

mike_s
01-08-2006, 03:13 PM
Just tried it Chris and it doesn't work. I changed the pin declarations for RS, RW and E to match pins 4,5 and 6 which I used as you'll see and also the outs and dirs variables to match pins 12-15 for the data by my connections.
I've attached the code just in case I've forgotten to alter anything else thats needed but I can't see it.
All I'm getting is blocks over the display in no pattern I can discern.

PJ Allen
01-09-2006, 03:09 AM
mike_s,

You asked about 4.7K resistors?· What document are you referring to?

Can I ask you, because I'm not sure, have you seen any letters at all?· Does each matrix have all the pixels on/dark?· What about pin 3 of the LCD (contrast control) -- are you using an adjust POT or do you have it connected to Ground (VSS)?

mike_s
01-09-2006, 06:25 AM
In stampworks sw11.pdf and sw13 there is a 4.7k resistor between Enable and Vss and in a document I can't recall the resistor is also tied to the lower unused 4 data bits.
The display is basically working but for 2 problems. 1 really doesn't matter because by backing off the contrast I can't see the cursor going.
The second problem will require a workaround which I hope is ok to do.
On powerup it will not initialize properly. It writes to the display but only random characters not the text string provided.
I thought seeing I have a pin to spare could I connect it as a reset source for the stamps reset pin?
I have found that if I hit the reset button after powerup it will work. However that is not really a 100% satisfactory solution. I can live with it but it's not exactly what you'd expect from a bought one.
Maybe there is a comand for an internal reset?
If either of these is possible then I could put that at the start of the program and no one would ever see the goofy display.
As far as do all the pixels go dark?
That is what occurs if I use any of the code I have found that is in general use.
I intend to source another display of another brand to see if it works with my code and then with the mountains of examples out there.
I already bought a second display because early on I thought I'd accidently shorted terminals on the back against a metal object on the desk but it is ok after checking it with the 4 and 8 bit test programs I created.
I can always find a use for the extra displays as I have plenty of ideas to implement when I'm finished this.
Thanks for your interest in helping.
Catch you later

Jon Williams
01-09-2006, 06:34 AM
It's a good idea to pull the E line low through a 4.7K -- this will prevent circuit noise from strobing bad data into the display during initialization. The unused pins can be left alone or tied to Vss through 4.7K.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax

Chris Savage
01-09-2006, 08:39 AM
mike_s said...(trimmed)
Just tried it Chris and it doesn't work. I changed the pin declarations for RS, RW and E to match pins 4,5 and 6 which I used as you'll see and also the outs and dirs variables to match pins 12-15 for the data by my connections.

Mike,

·· The reason it's not working is that the code is only partially altered to work in your situation.· There are still several commands sending data to the original pins that were configured for this code.· What might be a better idea, at least for test purposes, just to see if the code will work, would be to wire it up the way we had it set up, and just see if it works that way.· Afterward the code could be edited to function on the pins you need.· Is this possible?· I really believe this code will work for you.· I have tried it on some unknown chipset LCD Displays and never had a problem with it.

BTW - If you're wondering what I meant about the unaltered code affecting you, the initialization routine is still accessing the lower pin numbers, as is the Send_Inst and Send_Text routines.· There may be more, but obviously this code won't work with your wiring, so I would try the unedited code wired as our example and see what happens.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

mike_s
01-09-2006, 07:13 PM
I should have asked you that long ago. Because the sample code works fine now. Thanks very much. I'll add that resistor as well now.

Should be easy to alter the pins for the keypad. A lot easier than altering the sample code to suit my pin connections. I don't know why I balked at changing the pins to match when they were easily altered. I used headers and sockets and the pins easily swap around in the sockets.

I'm glad that it's solved now. I'll have to study the sample code· and see why I couldn't workout·what else needed changing·in the code to suit my connections.

Thankyou so much.

mike_s
01-09-2006, 08:24 PM
Ok Chris, put the pins back the way I had them originally and fixed the right bits to make it work.
I realise where my mistakes were now.
Actually I like the way the pins are assigned in the parallax code so I'll be swapping them back again.
Just needed the practice I guess.

Thanks again

Chris Savage
01-09-2006, 11:12 PM
I'm glad you finally got it working.· It's almost always better to test known working code using the original configuration in a situation like this just in case other errors get introduced when making changes.· I almost always do that with new code examples if they don't work right away for me or the problem isn't apparent.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)