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: IndiaPosts: 115 |
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 StatesPosts: 1421 |
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 ZealandPosts: 2290 |
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 KingdomPosts: 676 |
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 The only Konstant is Change |
||||
akashh Senior Member Joined: 19/01/2014 Location: IndiaPosts: 115 |
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: AustraliaPosts: 5 |
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 |