My cheap controller for 320x240 LCD - Page 1
Forum section: electronics / projects

author: rhodges
author_rank: Frequent Contributor
timestamp: January 17, 2019, 06:36:49 pm
content: I recently opened up a box of 320x240 LCD modules. They do not have controllers, just row and column drivers. Some years back, I made a controller using a PIC microcontroller and a 4-bit serial RAM chip.Why not see what I can do with my latest friend, the STM8S family? There is clearly not enough RAM for a graphic bitmap (9600 bytes), but the STM8S103 has enough for a 20x40 ASCII framebuffer (800 bytes). And there is enough flash memory for 256 font characters of 8x12.Does it have the speed to feed the LCD? The LCD needs at least 60 hz refresh, one new row loaded every 69 microseconds. That is 80 4-biit nybbles per row. And after looking up the pixels in the font table. Yes, it can! With 15 to 18 uSeconds to spare.I have a writeup and source code on Github:https://github.com/unfrozen/stm8_lcd_320x240/wikihttps://github.com/unfrozen/stm8_lcd_320x240QuoteWhy did I do this project when I only have 25 of these? (And they need -21 volts for contrast?) For the satisfaction of doing it!

author: Darkwing
author_rank: Contributor
timestamp: January 17, 2019, 11:18:19 pm
content: Congrats, that's cool!I wished, I could already do stuff like this.Btw: You should add a licence to your GitHub projects, to let people know whether they can use them.

author: rhodges
author_rank: Frequent Contributor
timestamp: January 17, 2019, 11:30:53 pm
content: Good point, thanks.Since I do have 25 of them, I will make the offer to send some to any interested people here.

author: james_s
author_rank: Super Contributor
timestamp: January 17, 2019, 11:34:37 pm
content: That is pretty cool, seems like driving one of those would make a good FPGA project. I have too many projects on my plate already though.

author: rhodges
author_rank: Frequent Contributor
timestamp: January 18, 2019, 12:06:25 am
content: It probably would make a good FPGA project. War story follows.Two and a half decades ago, I made a controller for the Hitachi LM215 out of a Z80, 62256 SRAM, 27256 EPROM, and some logic. We were using the LM213 LCD which had its own controller and worked fine. But it cost $60 or $70 each. I found a huge surplus of the LM215 for dollars each, so this looked like a great deal. But the LM215 did not have a controller. And a controller card cost something like $50 each.The Hitachi LM215 is the work of the devil.The display is divided into 4 quadrants, each 64x128 if I remember right. The controller had to send four pixels at a time, ONE FOR EACH QUADRANT. So the memory map was a complete mess. My controller "worked" and had a good display, but mangling the pixels was too much work for the Z80, which was spending most of its time refreshing the pixel rows. So close, yet so far away.This display has the decency to go top to bottom, left to right

author: westfw
author_rank: Super Contributor
timestamp: January 23, 2019, 12:31:50 am
content: QuoteSo, I've been wondering. Unlike a CRT, an LCD doesn't really have any internal electronics that "requires" a 60Hz frame rate, and they're usually clocked. What happens if you feed in pixels at a rate that's a bit "off"? What if it's a LOT off (say, 10Hz?)

author: jeremy
author_rank: Super Contributor
timestamp: January 23, 2019, 12:59:48 am
content: neat! the negative voltage for contrast is always a pain in the bum with these displays...

author: amyk
author_rank: Super Contributor
timestamp: January 23, 2019, 01:31:46 am
content: Quote from: westfw on January 23, 2019, 12:31:50 amIf it's too high the shift registers will probably start skipping pulses, if it's slightly too low they won't care, and if it's far too low then the dynamic logic in them will start discharging and you may risk electrolysis damage to the crystal.Depending on what you want to display, you might not even need a framebuffer...https://www.linusakesson.net/scene/craft/

author: rhodges
author_rank: Frequent Contributor
timestamp: January 23, 2019, 01:42:37 am
content: Quote from: westfw on January 23, 2019, 12:31:50 amI did not explore the lower refresh rates with this LCD. From my ancient experience with the LM215, if the refresh is too low, the display does not look good. I think the LCD pixels wander if you don't keep setting them.I did see that Emerging Technologies has data sheets for two other 320x240 displays, and those want 70hz refresh. On this one, I did not see any difference in quality going down to 60hz.Good question!

author: rhodges
author_rank: Frequent Contributor
timestamp: January 23, 2019, 01:52:47 am
content: Quote from: jeremy on January 23, 2019, 12:59:48 amI agree 100%I thought about an inverting switcher, but I don't feel like doing that right now. I chose the "stupid simple wasteful easy heavy" approach, and used a 24v transformer, bridge rectifier, LM317, and pot for the contrast. Yuck! Oh, well.

author: james_s
author_rank: Super Contributor
timestamp: January 23, 2019, 04:22:02 am
content: Those little switching converters are dead easy, I forget what one I used on a similar project, it was from Dallas/Maxim I think. For prototyping 9V batteries ought to work.