Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:00 06 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : LCD 40X4 problem.

Author Message
kermess
Regular Member

Joined: 04/04/2013
Location: Spain
Posts: 45
Posted: 09:50am 23 Feb 2015
Copy link to clipboard 
Print this post

Hello everyone.

I go to the forum to ask if anyone has had this problem and know how it has solved.
I am using this LCD
RayStar Optronics LCD 40x4 RC4004A
http://www.tme.eu/es/Document/6de177fca5cf350474d79235ec3715 33/RC4004A-FHW-CSX.pdf

Decoding signal "Enable", En1 and En2 using this application note.
http://www.thebackshed.com/forum/forum_posts.asp?TID=6723&KW =74HC00

And this is the simple program.
'----------------------------------------------------------- ----------------
'LCD 40X4 RAYSTAR RC4004A
'D0,D1,D2,D3 and R/W to GND
'Power LCD +5V.
'EN ----En1 and En2 with 74HC00 "decoder" in Pin(10)
'LCD INIT D4,D5,D6,D7,RS,EN
'LCD 14,15,21,22, 9, 7
'...EN (Pin10) (74HC00) En1/En2

SetPin 10,dout

'Init LCD lines 1 and 2
Pin(10)= 0
LCD init 14,15,21,22, 9, 7
LCD close

'Init LCD lines 3 and 4
Pin(10)= 1
LCD init 14,15,21,22, 9, 7
LCD close

Pin(10)= 0
LCD init 14,15,21,22, 9, 7

Pin(10)= 0
LCD 1,4,"Line 1, Pos 4":LCD 1,18,"Line 1, Pos 18"
LCD 2,7,"Line 2, Pos 7":LCD 2,25,"Line 2, Pos 30"

Pin(10)= 1
LCD 1,4,"Line 3, Pos 4":LCD 1,20,"Line 1, Pos 20"
LCD 2,2,"Line 4, Pos 2":LCD 2,17,"Line 2, Pos 17"
Do
'etc....
Loop

LCD close
End
'----------------------------------------------------------- -----------------

Lines one, two "OK".
Lines three, four "ERROR" writing.

If I change the value of the Pin (10) then

Lines one, two "ERROR" writing.
Lines three, four "OK".

Ideas .. ??
Thank you very much.
kermess
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10209
Posted: 10:33am 23 Feb 2015
Copy link to clipboard 
Print this post

Use two I/O lines, one for E1 and one for E2 to eliminate the 74HC00 to start with.
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3282
Posted: 12:20pm 23 Feb 2015
Copy link to clipboard 
Print this post

The LCD command only works with displays using a certain controller chip and it sounds as if your display uses a different controller. There is no real answer to this problem as there are many different displays with a wide variety of controllers - and it is not possible to support them all.

The solution probably is to find a compatible display.

Geoff
Geoff Graham - http://geoffg.net
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2428
Posted: 12:22pm 23 Feb 2015
Copy link to clipboard 
Print this post

the correct link to the datasheet is:
http://www.tme.eu/es/Document/6de177fca5cf350474d79235ec3715 33/RC4004A-FHW-CSX.pdf

the module does seem to contain two separate controllers, which makes life complicated. you likely need to initialize both controllers simultaneously for correct operation with the micromite, but only send data to one or the other when writing text. the use of LCD close on just one controller will likely confuse mmbasic.

i'd suggest using 3 pins to route the E signals correctly. lets say you want to keep using pin 7 as the EN output, while pins 25 and 26 route the signal:

connect E1 to pin 25.
connect E2 to pin 26.
connect a 4k7 resistor between pins 7 and 25.
connect a 4k7 resistor between pins 7 and 26.

the above arrangement means that, with pins 25 and 26 both configured as open collector outputs, the signal to E1 or E2 can be individually suppressed by setting the appropriate pin (25 or 26) to 0. if set to 1, then the EN signal is allowed through.

in your code, do something like this:


setpin (25, DOUT, OC)
setpin (26, DOUT, OC)
pin(25) = 1
pin(26) = 1
LCD init 14,15,21,22, 9, 7 ' initialize both controllers

[...]

pin(25) = 1 ' enable writing to first controller
pin(26) = 0 ' disable writing to second controller

LCD 1,4,"Line 1, Pos 4": LCD 1,18,"Line 1, Pos 18"
LCD 2,7,"Line 2, Pos 7": LCD 2,25,"Line 2, Pos 30"

pin(25) = 0 ' disable writing to first controller
pin(26) = 1 ' enable writing to second controller

LCD 1,4,"Line 3, Pos 4":LCD 1,20,"Line 1, Pos 20"
LCD 2,2,"Line 4, Pos 2":LCD 2,17,"Line 2, Pos 17"


the above code is totally untested, and has not been anywhere near a micromite - it may contain small syntax errors, etc. but, in principal, i believe the method should work.

btw, a similar routing method could be applied to other signals, for instance to split the output of a single comm port across several receiving devices (similar in use to the SerialTx custom function).


cheers,
rob :-)
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2428
Posted: 12:30pm 23 Feb 2015
Copy link to clipboard 
Print this post

geoff:
"The ST7066U has pin function compatibility with the HD44780, KS0066 and SED1278 that allows the user to easily replace it with an ST7066U"
http://www.sitronix.com.tw/sitronix/product.nsf/Doc/ST7066U? OpenDocument

the problem is not so much the command set, but more one of the signal routing, and being able to talk to what is effectively two LCD modules attached to a single micromite at the same time.

cheers,
rob :-)Edited by robert.rozee 2015-02-24
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9588
Posted: 12:55pm 23 Feb 2015
Copy link to clipboard 
Print this post

Interesting way of doing things - the two LCD controllers in one display idea(one for each of the two lines, I guess?)

Why do it that way when you already HAVE four-line LCD controllers?

Is it just cost(cheaper) do you think?
Smoke makes things work. When the smoke gets out, it stops!
 
srnet
Senior Member

Joined: 08/08/2014
Location: United Kingdom
Posts: 164
Posted: 09:51pm 23 Feb 2015
Copy link to clipboard 
Print this post

  Grogster said   Interesting way of doing things - the two LCD controllers in one display idea(one for each of the two lines, I guess?)

Why do it that way when you already HAVE four-line LCD controllers?

Is it just cost(cheaper) do you think?


Possibly because the standard HD44780 command to set the cursor position has DB7 set, and thus only allows for 128 display positions ?


$50SAT is Silent but probably still working.
For information on LoRa visit http://www.loratracker.uk/

 
kermess
Regular Member

Joined: 04/04/2013
Location: Spain
Posts: 45
Posted: 08:03am 24 Feb 2015
Copy link to clipboard 
Print this post

Thank you all.
It's working now.
The answer was the two resistors and the uMite [output/exits] in open colector mode.

At the beginning I wasn't sure the the initialization was correct for both drivers but it seems to work pretty well.

Here it is the source code of the working system.

'By David Perez from Barcelona (Spain)
'LCD 40X4 RAYSTAR RC4004A
'D0,D1,D2,D3 and R/W to GND
'D4,D5,D6,D7,En1,En2
'14,15,21,22, 25, 24
'Power LCD +5V.
'LCD INIT D4,D5,D6,D7,RS,EN ("En1+En2")
'LCD 14,15,21,22, 9, 7 ("25+24")
'Pin(25)uMite to - En1(LCD) with 4k7 resistor to Pin(7)uMite
'Pin(24)uMite to - En1(LCD) with 4k7 resistor to Pin(7)uMite
SetPin 25,dout,oc
SetPin 24,dout,oc
'Enable En1,En2
Pin(25)= 1
Pin(24)= 1
'Init LCD lines 1 and 2
'Init LCD lines 3 and 4
LCD init 14,15,21,22, 9, 7
'Disable (En1,En2)
Pin(25)= 0
Pin(24)= 0
'Enable (En1) Line 1 and 2
Pin(25)= 1
Pin(24)= 0
LCD 1,2,"Line 1, Pos 2":LCD 1,23,"Line 1, Pos 23"
LCD 2,7,"Line 2, Pos 7":LCD 2,25,"Line 2, Pos 25"
'Enable (En2) Line 3 and 4
Pin(25)= 0
Pin(24)= 1
LCD 1,5,"Line 3, Pos 5":LCD 1,20,"Line 3, Pos 20"
LCD 2,2,"Line 4, Pos 2":LCD 2,27,"Line 4, Pos 27"
'Disable (En1,En2)
Pin(25)= 0
Pin(24)= 0
LCD close
end

Un saludo
DavidEdited by kermess 2015-02-25
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3282
Posted: 10:17am 24 Feb 2015
Copy link to clipboard 
Print this post

Congratulations, great result.
Geoff Graham - http://geoffg.net
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2428
Posted: 11:13am 24 Feb 2015
Copy link to clipboard 
Print this post

reading that it now works has absolutely made my day. it is really nice to see a positive result, and what you have achieved will most certainly help others in future

congrats,
rob :-)
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025