Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 13:17 07 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 : CMM and 1604 LCD

Author Message
Chrisk

Senior Member

Joined: 21/12/2014
Location: Australia
Posts: 122
Posted: 10:11pm 05 Jul 2016
Copy link to clipboard 
Print this post

Hi Guys

I just connected a 1604 LCD to my CCM using MMBasic 4.5, the old 1602 worked fine but I wanted to display more info.
However I find that although I specify lines 3 and 4 to start at position 1, the display starts at position 5.
I have carried out the usual initialisation.
Any ideas for a fix would be greatly appreciated

Chrisk
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10215
Posted: 10:39pm 05 Jul 2016
Copy link to clipboard 
Print this post

Try LCD 1,17,"text" to put characters at the start of line 3 and LCD 2,17 for the start of line 4.
No promises, but worth a try
 
Chrisk

Senior Member

Joined: 21/12/2014
Location: Australia
Posts: 122
Posted: 05:12pm 06 Jul 2016
Copy link to clipboard 
Print this post

Thanks matherp

It worked. But how did you come to that conclusion?
Just for the rest of us who are happy with a solution but would like your thinking behind it.

Chrisk
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9590
Posted: 06:07pm 06 Jul 2016
Copy link to clipboard 
Print this post

My guess is that the four-line displays have two lines of text per command.
17 is column 1 on lines 1 and 3 of the LCD.

IE: The LCD controller itself accepts data for the screen in two sets of two lines, that being lines 1 & 3 and 2 & 4.

The LCD controller is expecting byte 17 to be the first column of the odd or even line sets:

LCD controller 32-byte data for lines 1&2:

Byte 01-> 1111111111111111 <-Byte 16
Byte 17-> 2222222222222222 <-Byte 32

LCD controller 32-byte data for lines 2&4:

Byte 01-> 3333333333333333 <-Byte 16
Byte 17-> 4444444444444444 <-Byte 32

The MM treats this as two lines:

Line 1: 11111111111111112222222222222222
Line 2: 33333333333333334444444444444444

So, LCD 1,17 puts the text at the start of LINE TWO OF THE LCD.
And LCD 2,17 puts the text at the start of LINE FOUR OF THE LCD.

This is how it works I think - others will correct me if I am wrong.

It depends on how the LCD itself expects the data to be formatted.
Other LCD's might have a 1,3,2,4 kind of format if you see what I mean, and yet other LCD's might have four seperate data sets - one for each line.

It depends on the LCD controller you are using.

The MM LCD routines were written to specifically be compatible with a couple of specific LCD controller chips, and if you use them, it should be plain sailing, but if you don't, sometimes you need to jump through a couple of hoops to make them co-operate.
Smoke makes things work. When the smoke gets out, it stops!
 
Chrisk

Senior Member

Joined: 21/12/2014
Location: Australia
Posts: 122
Posted: 08:32pm 06 Jul 2016
Copy link to clipboard 
Print this post

Thanks for the great explanation.

Chrisk

 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9590
Posted: 09:07pm 06 Jul 2016
Copy link to clipboard 
Print this post

Wait for matherp and others to confirm it.
I am only saying that's how I THINK it is being done, but I could always be wrong.
Smoke makes things work. When the smoke gets out, it stops!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10215
Posted: 09:17pm 06 Jul 2016
Copy link to clipboard 
Print this post

Grogster has it right although there a few mixed up 2s and 3s in his post

All 4 display-line displays are really 2 logical-line displays with the display-line 3 an extension of logical-line 1 and display-line 4 an extension of logical-line 2.

Normally 16x4 displays start display-line 3 at logical-line 1 position 20 and display-line 4 at logical-line 2 position 20 (in this case positions 17-20 just don't display). Geoff's firmware will work perfectly in this case.

Your display is odd in that display-line 3 starts at logical-line 1 position 17

Line 1: 11111111111111113333333333333333
Line 2: 22222222222222224444444444444444

From your description of the problem it was pretty obvious this is how it was wired hence the workround I proposedEdited by matherp 2016-07-08
 
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