Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 05:00 06 May 2024 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 16x4 MMBasic issue

Author Message
akashh
Senior Member

Joined: 19/01/2014
Location: India
Posts: 115
Posted: 02:38am 12 Aug 2014
Copy link to clipboard 
Print this post

I have MMBasic 4.5 for Duinomite and I am using a 16x4 LCD. The positioning works great on the first 2 lines, but lines 3 and 4 shift the characters to the right. Position 1,3 is about 6 or 8 chars to the right, same goes for line 4. Did anyone else have this problem and if so is there a fix?
Thanks,
Akash
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1421
Posted: 03:34am 12 Aug 2014
Copy link to clipboard 
Print this post

There is another thread that discusses this.

Some LCD displays have slightly different locations for where lines 3 and 4 start in memory.

I suggested a work-around using the built-in LCD command and a little additional logic wrapped in a subroutine.


Micromites and Maximites! - Beginning Maximite
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2290
Posted: 06:57am 12 Aug 2014
Copy link to clipboard 
Print this post

with a bit of luck, with the next release of micromite basic geoff may be able to add some way of adjusting for the differing memory location. has anyone made a close examination of the different controller datasheets to determine how many variations there are? syntax-wise, specifying a line of 3a, 4a could indicate an alternative offset. eg:
LCD 3A, C20, "this is a test"
i'm picking that there are most likely only a couple of variations, perhaps 3 at most.


rob :-)
 
G8JCF

Guru

Joined: 15/05/2014
Location: United Kingdom
Posts: 676
Posted: 08:26am 12 Aug 2014
Copy link to clipboard 
Print this post

This may help you.

Adapted from my I2C LCD library. These numbers worked for me with a 20 x 4 LCD, so maybe you can try, and if needs be adjust the numbers.

73

Peter


'----------------------------------------------------------- -------
'
' Print String to LCD
'
'
SUB LCD_(LineNum,CharPos,Text$)
LOCAL I
IF LineNum=1 THEN I=(&H80 + CharPos-1)
IF LineNum=2 THEN I=(&HC0 + CharPos-1)
IF LineNum=3 THEN I=(&H94 + CharPos-1)
IF LineNum=4 THEN I=(&HD4 + CharPos-1)

LCD CMD I

FOR I=1 TO LEN(Text$)
LCD DATA ASC(MID$(Text$,I,1))
NEXT I

END SUB

Edited by G8JCF 2014-08-13
The only Konstant is Change
 
akashh
Senior Member

Joined: 19/01/2014
Location: India
Posts: 115
Posted: 03:26pm 12 Aug 2014
Copy link to clipboard 
Print this post

Great, thanks for the suggestions! I will try them out as soon as I can get around to it!
Akash
 
flowerpetal
Newbie

Joined: 26/08/2014
Location: Australia
Posts: 5
Posted: 03:25am 26 Aug 2014
Copy link to clipboard 
Print this post

first character on third line for a 16x4 will be 0x10 in DDRAM but for 20x4 it will be 0x14,(fourth line 0x50 and 0x54 respectively) so you would have to adjust your coding to suit.
 
Print this page


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

© JAQ Software 2024