Author Topic: My cheap controller for 320x240 LCD  (Read 1804 times)

0 Members and 1 Guest are viewing this topic.

Offline rhodgesTopic starter

  • Frequent Contributor
  • **
  • Posts: 306
  • Country: us
  • Available for embedded projects.
    • My public libraries, code samples, and projects for STM8.
My cheap controller for 320x240 LCD
« on: January 17, 2019, 06:36:49 pm »
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/wiki
https://github.com/unfrozen/stm8_lcd_320x240

Quote
The font map is 256 characters, 12 pixels high and 8 wide. 96 are the usual ASCII characters. Six are line segments and corners for drawing rectangles. And 64 characters are pseudo-graphic building blocks with the 12x8 characters divided into six blocks of 4 pixels square. The library includes a function to plot these dots anywhere in the 80x60 dot area of the LCD.

Why 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!

Currently developing STM8 and STM32. Past includes 6809, Z80, 8086, PIC, MIPS, PNX1302, and some 8748 and 6805. Check out my public code on github. https://github.com/unfrozen
 
The following users thanked this post: oPossum, edavid, coromonadalix, tsman, reboots

Offline Darkwing

  • Contributor
  • Posts: 39
  • Country: de
  • Let’s get dangerous!
Re: My cheap controller for 320x240 LCD
« Reply #1 on: January 17, 2019, 11:18:19 pm »
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.
 

Offline rhodgesTopic starter

  • Frequent Contributor
  • **
  • Posts: 306
  • Country: us
  • Available for embedded projects.
    • My public libraries, code samples, and projects for STM8.
Re: My cheap controller for 320x240 LCD
« Reply #2 on: January 17, 2019, 11:30:53 pm »
Good point, thanks.

Since I do have 25 of them, I will make the offer to send some to any interested people here.
Currently developing STM8 and STM32. Past includes 6809, Z80, 8086, PIC, MIPS, PNX1302, and some 8748 and 6805. Check out my public code on github. https://github.com/unfrozen
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: My cheap controller for 320x240 LCD
« Reply #3 on: January 17, 2019, 11:34:37 pm »
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.
 

Offline rhodgesTopic starter

  • Frequent Contributor
  • **
  • Posts: 306
  • Country: us
  • Available for embedded projects.
    • My public libraries, code samples, and projects for STM8.
Re: My cheap controller for 320x240 LCD
« Reply #4 on: January 18, 2019, 12:06:25 am »
It probably would make a good FPGA project. War story follows.  ;D

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  :-+
Currently developing STM8 and STM32. Past includes 6809, Z80, 8086, PIC, MIPS, PNX1302, and some 8748 and 6805. Check out my public code on github. https://github.com/unfrozen
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: My cheap controller for 320x240 LCD
« Reply #5 on: January 23, 2019, 12:31:50 am »
Quote
Does it have the speed to feed the LCD? The LCD needs at least 60 hz refresh
So, 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?)
 

Offline jeremy

  • Super Contributor
  • ***
  • Posts: 1079
  • Country: au
Re: My cheap controller for 320x240 LCD
« Reply #6 on: January 23, 2019, 12:59:48 am »
neat! the negative voltage for contrast is always a pain in the bum with these displays...
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8275
Re: My cheap controller for 320x240 LCD
« Reply #7 on: January 23, 2019, 01:31:46 am »
Quote
Does it have the speed to feed the LCD? The LCD needs at least 60 hz refresh
So, 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?)
If 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/
 

Offline rhodgesTopic starter

  • Frequent Contributor
  • **
  • Posts: 306
  • Country: us
  • Available for embedded projects.
    • My public libraries, code samples, and projects for STM8.
Re: My cheap controller for 320x240 LCD
« Reply #8 on: January 23, 2019, 01:42:37 am »
What happens if you feed in pixels at a rate that's a bit "off"?  What if it's a LOT off (say, 10Hz?)
I 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!
Currently developing STM8 and STM32. Past includes 6809, Z80, 8086, PIC, MIPS, PNX1302, and some 8748 and 6805. Check out my public code on github. https://github.com/unfrozen
 

Offline rhodgesTopic starter

  • Frequent Contributor
  • **
  • Posts: 306
  • Country: us
  • Available for embedded projects.
    • My public libraries, code samples, and projects for STM8.
Re: My cheap controller for 320x240 LCD
« Reply #9 on: January 23, 2019, 01:52:47 am »
neat! the negative voltage for contrast is always a pain in the bum with these displays...
I 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.
Currently developing STM8 and STM32. Past includes 6809, Z80, 8086, PIC, MIPS, PNX1302, and some 8748 and 6805. Check out my public code on github. https://github.com/unfrozen
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: My cheap controller for 320x240 LCD
« Reply #10 on: January 23, 2019, 04:22:02 am »
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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf