PDA

View Full Version : LCD 4X40 Futurlec



Bill Legge
- 26th November 2008, 04:18
I'm using PBP to drive a 4X40 LCD from Futurlec driven by a PIC16F877A at 20 MHz

I've read all/most of the 4X40 posts but still have a problem:

1. The LCD is marked JHD404A1 on the back.

2. I think the spec sheet published by Futurlec is wrong - there is no indication of two ENABLES although the data addresses for lines 1/3 and 2/4 are the same ($80-$A7 and $C0-$E7)?

3. On the JHD web-site there is a JHD404A that has different pin-outs and includes two ENABLES. Looks hopeful:

Pin 1 -8 Data 7 to 0
Pin 9 ENABLE1
Pin 10 R/W
Pin 11 RS
Pin 12 Contrast
Pin 13 Ground
Pin14 +5
Pin15 ENABLE2
Pin16 NC
Pin17 Backlight +
Pin18 Backlight -

But still won't work despite:

1. Long delay to let LCD settle
2. Going through all combinations of ENABLE 1/2 at initialisation
3. Painstaking checking of wiring from LCD to PIC877A
4. Checking of DEFINES for LCD (DEFINE LINES set at 2?)
5. Xtal is 20 MHz and is also DEFINED
6. Other 2 and 4 line LCDs work OK using the same PBP program

Anyone else out there using this Futurlec 4X40 LCD with PBP code. I'd welcome advice/comments/code.

I may have missed some previous post but have searched this site all morning?

Regards Bill Legge

Darrel Taylor
- 26th November 2008, 07:02
2. Going through all combinations of ENABLE 1/2 at initialisation
How are you controlling the enable lines?
External circuit?

Which pins of the databus are you using?

What's connected to the Contrast pin?

Which pins of the PIC are you using?

What DEFINES's are in your program?
<br>

Bill Legge
- 26th November 2008, 09:39
DT,

Thanks for a speedy reply. I'm using a MikroElektronica EasyPIC5 developement board and my Futurlec 4X40 LCD is connected to the PORTB pins as indicated by the following code (How do you post code here?):

DEFINE OSC 20
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 4
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 5
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
PAUSE 1000
LCDOUT $fe,$80, "Line 1 & 3"
LCDOUT $fe,$c0, "Line 2 & 4"

Here: goto here

END

The ENABLE1 goes to PORTB.5 (as DEFINed) and I've grounded ENABLE2. I have also tried reversing ENABLE1 and 2.

The contrast pin is connected to the wiper of a 10k variable resistor that sits between GROUND and +5.

The contrast adjustment 'sort of works' but has variable effects each time I programme the PIC.

my guess for the problem is:
1. A wiring error on my part but I have done a careful job and checked the result 'pin to pin' with a continuity test.
2. I've got the wrong pin-out for the Futurlec 4X40 LCD (I'm convinced that the spec sheet on Futurlec's US site is NOT the correct one.
3. I'm doing something wrong with ENABLE 1 and 2.
4. So far all I get on the LCD are black squares.

Someone must have got the Futurlec 4X40 LCD working - I hope

Regards Bil Legge

aratti
- 26th November 2008, 10:07
From the datasheet I have seen (link below) this 4x40 LDC has only one enable pin.(This is the only 4x40 that I have seen)

http://www.futurlec.com/LED/LCD40X4BL.shtml


Black square most of the times appear when you have a wrong contrast setting

(you should have a pot with the center tap connected to pin 3 to adjust the contrast)

Al.

Bill Legge
- 26th November 2008, 12:51
Aratti,

Thanks for your reply.

1. the centre tap of the pot is connected to the contrast pin and does affect the contrast of the display but in an intermittant fashioin that changes with programming the PIC - It seems as if I've got the pin-out wrong, hence my concern that the data sheet on the Futurlec site is not the correct one.

2. I agree with you that the Spec sheet of the 4X40 LCD on the Futurlec USA site shows only one ENABLE pin but it also shows rows 1/3 and 2/4 as having the same addresses (starting at $80 and $C0) - this would only work if there were separate ENABLE pins for lines 1/3 and 2/4.

3. On the JDH site I can't find the JDH404A1 but the JDH404 and the JDH404A both show two ENABLE pins - hence my concern that the vendor's (Futurlec) spec sheet is wrong.

Brock
- 28th November 2008, 15:25
I mainly use Optrex displays and never have problems with them.
Maybe I've been lucky, but I just thought I would mention it. :)

Bill Legge
- 30th November 2008, 01:23
Brock,

Thanks for your reply. I will have a look at Optrex LCDs.

I have had a reply from Futurlec and they acknowledge that the spec-sheet on their US site was the wrong one. They also sent me the correct specification but I have yet to test it out. I presume they have also changed their web-site? Thank you Futurlec for a good response to me query.

The new specification does have two ENABLE pins.

Regards Bill Legge

Archangel
- 30th November 2008, 08:16
Hello Bill Legge,
I am curious, as I have not used these 40 x 4 LCDs, do you have to Define which Ebit to use before the LCDOUT statement when you change lines, since they seem to use the same address values?

DaveC3
- 30th November 2008, 14:54
Here is some code I used to control the 4x40 display. This is just the LCD part that demonstrates the enable selection


'**** LCD ************************************************** *****
'Set LCD Data port
DEFINE LCD_DREG PORTB
'Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_DBIT 4
'Set LCD Register Select port
DEFINE LCD_RSREG PORTB
'Set LCD Register Select bit
DEFINE LCD_RSBIT 0
'Set LCD Enable port
DEFINE LCD_EREG PORTB
'Set LCD Enable bit
DEFINE LCD_EBIT 3
'LCD RW Register PORT
'DEFINE LCD_RWREG PORTB
'LCD read/write pin bit
'DEFINE LCD_RWBIT 5
'Set LCD bus size (4 or 8 bits)
DEFINE LCD_BITS 4
'Set number of lines on LCD
DEFINE LCD_LINES 4
'Set command delay time in us
DEFINE LCD_COMMANDUS 2000
'Set data delay time in us
DEFINE LCD_DATAUS 50

LCD1_Disable var portb.2
LCD2_Disable var portb.1
'*** Program variables *****************************************



lcdcnt var byte
lcdlen var byte
lcdline var byte
lcd var byte
lcdfunction var byte


'************************************************* **************

' Initialize LCD
input LCD1_Disable
input LCD2_Disable
LCDOut $fe,1 'clear lcd
pause 100
LCDOut $fe,2 'home
LCDOut $fe,$0c 'Curser off
LCDOut " USB 4X40 LCD "
LCDOut $FE,$C0
LCDOut " DAVE CUTLIFF "
low LCD1_Disable
input LCD2_Disable
LCDOut $fe,1 'clear lcd
LCDOut $fe,2 'home
LCDOut $fe,$0c 'Curser off
LCDOut " Highspeed USB Project "
LCDOut $FE,$C0
LCDOut " August 2005 "
pause 100
goto idleloop

Bill Legge
- 2nd December 2008, 10:04
1. Joe S. I have not been able to get my 4X40 LCD to work - so I'm hardly the fellow to give you advice. However, I think you are right and the 4X40 is built like two 2X40 displays that have separate ENABLE pins and the rest are common. I presume one simply swaps from ENABLE1 to ENABLE2 according to what needs to be displayed.

2. The new pin-out from Futurlec is NOT the correct one (Futurlec sheet is for a device 4004 and mine is a JHD404A1 with a different number of pins.) Adjusting/guessing the connections has yielded only fleeting black blobs - and yes, I do know that black boxes may be caused by too high contrast setting.

3. I'm a bit irritated that Futurlec is selling a $40 odd LCD device and can't publish the correct spec sheet - and it's not to be found on the internet. There are quite a few different pin-outs for other 4X40 LCDs but none seem to work on the JHD404A1.

4. Anyone go it to work? Futurlec must have sold a fair number of thes LCDs

Regards Bill Legge

rhino
- 2nd December 2008, 15:09
Bill - If it does happen to have 2 controllers, here is an excellent way to control it.
http://www.picbasic.co.uk/forum/showthread.php?t=626

Hope it helps.

Bill Legge
- 4th December 2008, 01:54
Rhino,

Thanks for the info. I have got a different 4X40 (DisplayTech LTd closing down sale for $5, how's that for a bargain) and - IT ALL WORKS OK - along with the code/circuits for driving two ENABLE pins.

I would still like to track down the pin-out for the Futurlec JHD404A1 if anyone out there has the info.

Regards Bill Legge :)

RussMartin
- 4th December 2008, 09:49
I use a lot of Crystalfontz displays with good (great!) success.

http://www.crystalfontz.com/

rixter
- 15th January 2009, 05:46
Hello,

I managed to get the Futurlec 4 x 40 LCD working. In my case, I did this with a BASIC Stamp. I hope I'm not escorted to the door from this forum. I found this forum to find a solution for communicating with an LCD. See attached photo.

Bill's initial thread actually had the correct pin assignments that were the key to getting me started, although the Futurlec LCD has no pins 17 & 18. Internet research had consistent documentation on 4 x 40 LCD with two rows of pins having different assignments than those posted on Futurlec's site. Those are clearly WRONG! Also, A and K connections are for the back light and are straightforward.

The second challenge was understanding how to address the 3rd and 4th lines on the display. My experience with LCD displays was limited to 2 x 16 and 4 x 20 serial units that have an entirely different way to address the screen coordinates. The 3rd and 4th lines are addressed with the second enable pin. This forum clued me in on that .. thank you. So I had to initialize both controllers in the LCD and communicate with the device as basically a stack of two 2 x 40 LCDs in one unit. The LCDCMD command in PBASIC allows me to address a set of pins in 4 bit mode while allowing some flexibility on which pin is the enable pin. This permitted me to address both sets of lines by adding the one additional connection to the LCD for the extra enable connection.

I am not versed on PIC language, but I'm sure it's doable if I've done it with the BASIC Stamp.... code attached.

Rick

Bill Legge
- 16th January 2009, 03:46
Rixter,

Thanks for your message and I'm pleased to learn that the pin-outs in the first post are correct. I must have made some wiring error because they would not work for me? I will have another go.

I have, since then, got some different 4X40 LCDs, with correct tech details, and they work well using the method posted by RHINO - a couple of resistors on the two ENABLE pins and a bit of code.

One mistake that took me a long time to find was using the PBP command "CLEAR" after the definition on the LCD1-Enable and LCD2-Enable pins - the CLEAR command clears the definition:

This won't work:
LCD1-Enable VAR PORTD.1
LCD2-Enable VAR PORTD.2
CLEAR

This will work:
CLEAR
LCD1-Enable VAR PORTD.1
LCD2-Enable VAR PORTD.2

Good luck - get off the Basic Stamps and into PICs soonest!

Regards Bill Legge

rixter
- 19th January 2009, 17:31
Thanks for the response Bill. Out of curiosity, what other 4 x 40 LCDs are you working with? When I ordered the Futurlec LCD I got a bit of tunnel vision and didn't pay attention to the true dimensions. Some how I didn't expect the unit to basically be twice the size of a 4 x 20, even though that would seem logical. I would rather trade for a bit smaller character size and be a smaller package overall for my implementation, which is a bicycle electronic route sheet device. Are any of the 4 x 40 LCD you've seen in smaller physical packages?

As far as moving off of the BASIC Stamp, it would only be to take on another challenge or to address a particular issue not attainable with the Stamp rather than putting it down. As limited as they can be, they are easy to use for most of what I have asked of them. Like eating ice cream with handcuffs on, they are enjoyable to work with despite some discomfort and limitations. I am a programmer first, a fabricator second and an electronics expert last. I've learned much in the past two years on the electronics part. Despite learning many programming languages over the years, I come from an extensive background in BASIC and keep coming back to it. Does anyone remember Micro 80 magazine and the contests to solve a challenge in the fewest lines of code? Generally, one line programs won the contest. While I don't use it anymore, the "Trash 80" is still here and the spirit and fun of simple BASIC lives on. If I ever got into production level of my projects, I would definitely develop using a different platform, but that is not the case at present.

Rick

Bill Legge
- 20th January 2009, 01:38
Rick,
My Displaytech 4X40s are about the same size as the Futurlec devices and I think you will find that most manufacturers will be the same.

Many electronic magazines (e.g. Everyday Practical Electronics-December 2009. www.epemag.com) have recently carried articles on 'OLED'. These are Organic LED displays and are the type used in mobile phones. They appear to be:

1. Smaller that the typical LCD.
2. Much better resolution and colour: e.g. 160X128 pixel.
3. Talk to the devices by SPI comms.
4. Don't cost much.
5. Pixel data is easy, text/figs difficult.
5. But are a bugger to connect to-small pads/special connectors etc.
6. Have a dig around the 'Spark Fun' web site - I bet they have something useful?

I've not used one - only read a few articles - an 'armchair expert!'

STAMP/PIC - I retired a few years ago and after 40 years away from electronics decided to re-visit it for a hobby. After a few months it became obvious that electronics these days centers on MCUs - I entered the field by getting the StampWorks kit. I've moved to PIC because of the price of chips and processing speed.

I live in the back of beyond in South West Australia and have to get all my bits by post. I've settled on a few suppliers:

1. Futurlec in Asia - Low cost boards and components. Documentation is sometimes terrible but I can now translate the 'Minglish.'
2. MikroElektronica in Serbia - Good value developement boards.
3. Olimex in Belgrade - Good value boards.

My latest project is a sports pitch line marking robot positioned by counting wheel revs and getting direction by tracking the sun (lots of that here in Australia). I'm a year into the project and I'm sure it will work - but how well I don't yet know.

Regards Bill Legge

murali
- 1st April 2009, 19:07
Dear Mr.Bill Legge,
I need the correct datasheet for 40*4 lcd which you got finally from futurelec. I am not able to trace the exact datasheet. kindly help me in this regard

murali


Rick,
My Displaytech 4X40s are about the same size as the Futurlec devices and I think you will find that most manufacturers will be the same.

Many electronic magazines (e.g. Everyday Practical Electronics-December 2009. www.epemag.com) have recently carried articles on 'OLED'. These are Organic LED displays and are the type used in mobile phones. They appear to be:

1. Smaller that the typical LCD.
2. Much better resolution and colour: e.g. 160X128 pixel.
3. Talk to the devices by SPI comms.
4. Don't cost much.
5. Pixel data is easy, text/figs difficult.
5. But are a bugger to connect to-small pads/special connectors etc.
6. Have a dig around the 'Spark Fun' web site - I bet they have something useful?

I've not used one - only read a few articles - an 'armchair expert!'

STAMP/PIC - I retired a few years ago and after 40 years away from electronics decided to re-visit it for a hobby. After a few months it became obvious that electronics these days centers on MCUs - I entered the field by getting the StampWorks kit. I've moved to PIC because of the price of chips and processing speed.

I live in the back of beyond in South West Australia and have to get all my bits by post. I've settled on a few suppliers:

1. Futurlec in Asia - Low cost boards and components. Documentation is sometimes terrible but I can now translate the 'Minglish.'
2. MikroElektronica in Serbia - Good value developement boards.
3. Olimex in Belgrade - Good value boards.

My latest project is a sports pitch line marking robot positioned by counting wheel revs and getting direction by tracking the sun (lots of that here in Australia). I'm a year into the project and I'm sure it will work - but how well I don't yet know.

Regards Bill Legge

murali
- 1st April 2009, 19:15
Dear Mr.Bill Legge,
I need the correct datasheet for 40*4 lcd which you got finally from futurelec. I am not able to trace the exact datasheet. kindly help me in this regard

murali

rixter
- 2nd April 2009, 03:03
Murali,

If you are not able to locate the datasheet, what information are you seeking for this LCD? I have successfully attached this LCD to a processor as I explained in an earlier thread on this post. I have gotten another LCD from this company and it is yet a different LCD than the one I received the first time and different than the datasheet. Their information is not correct for the model mentioned in Bill's post or the second one I received.

I found other similar pin diagrams for 4x40 LCDs that did the trick for me. The key lays not only in knowing which pins are for what, but also understanding that these units have two controllers.... one for the top two lines and the other for the bottom two lines. Pins 1-8 are for data (DB7 down to DB0 respectively). In my case I only use 1-4 because I am using 4 bit mode. Pin 9 is the enable for controller #1, Pin 10 is RW, Pin 11 is RS, Pin 12 is Contrast, Pin 13 is Ground (VSS), Pin 14 is VDD, Pin 15 is enable for controller #2 and Pin 16 is no connection. Pins A & K over at the opposite end are for the LED backlight..... A being positive and K being negative.

So to write to lines 1 or 2 on the LCD, you must enable at Pin 9 before your write and to write to lines 3 and 4, you must enable Pin 15 before a write. In the case of BASIC Stamp that I am using, I just specify a different parameter in the LCDOUT command to activate the other enable pin in my outputs to the LCD. The concept should apply in your implementation as well.

Anything I can do to help out, just ask.

Rick

Bill Legge
- 4th April 2009, 00:44
Murali,

1. The pin-out on the Futurlec site is wrong - a 4X40 MUST have two ENABLE pins.

2. Rixter says he has got the device working using the pin-outs on my first post of this thread. They didn't work for me but I may have made some wiring/software error. These are the revised pin-outs sent to me by Futurlec.

3. Take up his offer of assistance - after months of messing around with 4X40 LCDs I am starting to think they are not worth the trouble.

4. It's quite irritating that Futurlec can not be bothered to put up the correct data on the web. I know their prices are rock bottom and they need to keeep costs down but it's only a few minutes of work?

Regards Bill Legge

murali
- 7th April 2009, 18:06
Dear Rixter & Legge,
Thanks for your prompt reply. Now my display is working for the first two lines or the second two lines. I am trying to complete the same

Rgds

Murali

rixter
- 8th April 2009, 04:35
Murali,

I am guessing that what you are saying is that you can get either the first two lines or second two lines to work, but NOT both at the same time.

I'd say if you are getting all four lines to get something that you are well on your way to success and you have some minor code issues to check.

You could have a couple of things going on there. You may be putting the LCD into a condition where the unit is resetting (initializing), as you do each write cycle. Or you could be doing a screen clear of the opposite set of lines that you are displaying. For example, you might be clearing lines 3 & 4 as you write to 1 & 2 and clearing 1 & 2 as you write to 3 & 4.

My code would be different than what you would use because I am using a BASIC Stamp, but the logic should be the same. In my case, I am clearing lines 1 & 2, then writing to lines 1 & 2. Then I clear lines 3 & 4 before writing to lines 3 & 4.

Rick