6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Tue Sep 24, 2024 9:19 am

All times are UTC




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: LCD troubles...
PostPosted: Fri Oct 19, 2018 12:40 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1228
Location: Soddy-Daisy, TN USA
I'm writing some drivers for my SBC to drive an LCD of 20x4. However, I think the memory format is 40x4.

I can write characters just fine but I'm having trouble finding information on the bizarre memory format of it. From what I understand, it's defined somewhat like:

Code:
AAAAAAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBBB
AAAAAAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBBB


When I plot characters (and allow the cursor to automatically move), it fills up the "A" lines but the "B" lines never print. Actually, it seems like there is another page to the right just like the first page. Meaning, when I print past "ROW 0, COL 19", instead of going to the second line, there seems to be another 20 characters hidden to the right. It's like I have 80 characters total but only 40 can be seen (just the "A" lines).

I've tried searching for docs but everything I find is suited for Arduino. I suppose I could study the Arduino LCD library but I'd like to find a good list of commands, memory layouts, etc.

The good news is that I can successfully send commands and data. I just don't know what commands to send!

I have found some generic LCD command lists but none (that I've found) indicate the various memory layouts.

Thanks for any suggestions!

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
 Post subject: Re: LCD troubles...
PostPosted: Fri Oct 19, 2018 2:20 pm 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
For the BBB... lines you must precharge an address of 0x40 + actual position. You need to use the SET DDRAM address command (0x80 + address). You also need to initialize the display to 2 lines (0b001x1000 / x: 8 or 4 bit I/F). The controller sees lines 1 & 3 as line 1 and 2 & 4 as line 2.


Attachments:
KS0070B LCD-drive.pdf [566.84 KiB]
Downloaded 148 times

_________________
6502 sources on GitHub: https://github.com/Klaus2m5
Top
 Profile  
Reply with quote  
 Post subject: Re: LCD troubles...
PostPosted: Fri Oct 19, 2018 3:29 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1228
Location: Soddy-Daisy, TN USA
AH! Thanks Klaus.

I will give that a go later this evening.

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
 Post subject: Re: LCD troubles...
PostPosted: Fri Oct 19, 2018 7:47 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1228
Location: Soddy-Daisy, TN USA
FYI,

I am building some libraries to work with the LCD and the 65C02. I hope to get my Potpourri6502 completely documented and open-sourced as I go along. Warts and all.

Just a small way of giving back to the 6502 world.

"MOSTLY/SORTA" working code so far:

https://github.com/cbmeeks/Potpourri650 ... er/lcd.asm

I tried to keep everything within 80 columns. Old habit of mine. Even though I have large monitors. The 80 columns is nice to print out on old vintage printers too.

The main project will be hosted here:

https://github.com/cbmeeks/Potpourri6502

I hope to get the schematics and Gerbers up soon.

As I build a simple monitor, I will post that as well.

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
 Post subject: Re: LCD troubles...
PostPosted: Fri Oct 19, 2018 7:52 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
Thanks for sharing and open-sourcing your code!


Top
 Profile  
Reply with quote  
 Post subject: Re: LCD troubles...
PostPosted: Fri Oct 19, 2018 7:53 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1228
Location: Soddy-Daisy, TN USA
BigEd wrote:
Thanks for sharing and open-sourcing your code!


You're welcome. But you may not be thanking me after you read it. LOL

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
 Post subject: Re: LCD troubles...
PostPosted: Fri Oct 19, 2018 8:04 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8514
Location: Southern California
See my LCD code at http://wilsonminesco.com/6502primer/LCDcode.asm . Note the writing of the function set three times in the initialization. We found, in a work project years ago, that this is necessary for a reliable initialization that works every time. We sometimes had problems, until an applications engineer faxed us (this was when the internet was in its infancy) an ap. note with this information. We never had trouble again.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
 Post subject: Re: LCD troubles...
PostPosted: Fri Oct 19, 2018 8:08 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1228
Location: Soddy-Daisy, TN USA
GARTHWILSON wrote:
See my LCD code at http://wilsonminesco.com/6502primer/LCDcode.asm . Note the writing of the function set three times in the initialization. We found, in a work project years ago, that this is necessary for a reliable initialization that works every time. We sometimes had problems, until an applications engineer faxed us (this was when the internet was in its infancy) an ap. note with this information. We never had trouble again.


Thanks for that tip!

Yeah, I've read your LCD code and learned a lot from it. I forgot about the three times. Fortunately, mine has been working but I've only used the ONE LCD module. So I could just be lucky.

I will make those changes as it's not a big deal and I like the reliability. :-)

Thanks.

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
 Post subject: Re: LCD troubles...
PostPosted: Fri Oct 19, 2018 8:33 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8514
Location: Southern California
I forgot to address this one:
cbmeeks wrote:
I tried to keep everything within 80 columns. Old habit of mine. Even though I have large monitors. The 80 columns is nice to print out on old vintage printers too.

Epson dot-matrix printers (which I still use when developing code) respond to character 15 ($0F) by going into condensed mode, giving 136 columns on 8½"-wide paper (9½" including the pin-feed portions). The character shows up as the starburst character on the monitor in the DOS/ANSI [Edit: that should say IBM437] character set. I have the Trident 8900 video chip set on my DOS machine so I get 132 characters across the monitor, and usually 43 lines. (I can get up to 60 lines if I want to tolerate not having much space between them.)

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
 Post subject: Re: LCD troubles...
PostPosted: Fri Oct 19, 2018 8:42 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1228
Location: Soddy-Daisy, TN USA
GARTHWILSON wrote:
I forgot to address this one:
cbmeeks wrote:
I tried to keep everything within 80 columns. Old habit of mine. Even though I have large monitors. The 80 columns is nice to print out on old vintage printers too.

Epson dot-matrix printers (which I still use when developing code) respond to character 15 ($0F) by going into condensed mode, giving 136 columns on 8½"-wide paper (9½" including the pin-feed portions). The character shows up as the starburst character on the monitor in the DOS/ANSI character set. I have the Trident 8900 video chip set on my DOS machine so I get 132 characters across the monitor, and usually 43 lines. (I can get up to 60 lines if I want to tolerate not having much space between them.)


That's pretty awesome!

I used to have a wide-carriage dot matrix printer that I tossed years ago. Why did I do that??

Fortunately, I just purchased a Panasonic KX-P2123 from a thrift store for $3.99. Looks to be in great shape. I have a couple Apple dot-matrix printers too IIRC.

I plan on hooking that printer up to the Potpourri6502 and do some old-school printing. You can even still buy ribbons for that Panasonic.

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
 Post subject: Re: LCD troubles...
PostPosted: Fri Oct 19, 2018 9:06 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8514
Location: Southern California
There are also re-inkers and re-inking services (which I've seen at local electronics swap meets), but I have not helped myself to them so far. I do have a box of old ribbons I would like to get re-inked. Fry's electronics still sells the ribbons for my old printers which I have several of, in standard width and the wide ones too. I have a box of green-line wide fanfold paper too.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
 Post subject: Re: LCD troubles...
PostPosted: Sat Oct 20, 2018 4:11 am 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1228
Location: Soddy-Daisy, TN USA
LCD library is really coming along. I'm supporting 20x4 at the moment but it wouldn't be too hard to support others.

I've updated the GitHub project too. Nothing too fancy but should be easy to follow as I like to document very well.

Eventually, I hope to reserve an 80 byte buffer that is linear so that you can just peek/poke into it and the LCD will be refreshed in the background. Would be really useful in BASIC too.

https://github.com/cbmeeks/Potpourri6502


Attachments:
SampleScreen.jpg
SampleScreen.jpg [ 4.43 MiB | Viewed 4020 times ]

_________________
Cat; the other white meat.
Top
 Profile  
Reply with quote  
 Post subject: Re: LCD troubles...
PostPosted: Mon Nov 26, 2018 1:25 am 
Offline
User avatar

Joined: Wed Feb 13, 2013 1:38 pm
Posts: 588
Location: Michigan, USA
Nice job on the libraray.

If it may be of any help... here's an HD44780 DDRAM Memory Map diagram I did awhile back for a 4x20 display.

Attachment:
DDRAM.png
DDRAM.png [ 24.89 KiB | Viewed 3051 times ]


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 60 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron