Direct control of LCD display -an experiment
doggiedoc
Posts: 2,245
:cool:
So, after I managed to flub up my Parallax 2x16 Serial LCD (still not sure what happened) I decided to try to control the display directly from a Prop.
First step was to desolder the SX control board from the back of the JHD 162A - assuming that it was the damaged part (correct assumption in hind site).
Then I soldered on wires to each of the 16 pins on the LCD board.
Then after some research and trial and error - I came up with a hard coded output.
Future experiments:
1 - use shift register to reduce number of Prop's i/o pins
2 - refine code for more "object-like" use
3 - recreate daughter board approach using Propeller instead of original SX
Paul
So, after I managed to flub up my Parallax 2x16 Serial LCD (still not sure what happened) I decided to try to control the display directly from a Prop.
First step was to desolder the SX control board from the back of the JHD 162A - assuming that it was the damaged part (correct assumption in hind site).
Then I soldered on wires to each of the 16 pins on the LCD board.
{ --------TEST: directly control LCD #JHD 162A with Prop 3/8/2011 - Paul A. Willoughby, DVM } CON _xinfreq = 5_000_000 _clkmode = xtal1 + pll16x RsPin = 4 'Register select (RS) on LCD -LCD pin #4 'RS = 0: Instruction Register 'RS = 1: Data Register EnablePin = 6 'Enable Signal on LCD -LCD pin #6 'toggling Enable to low and back to high again 'writes to register value at Data Pins -LCD 'pins 7 thru 14 PUB Main dira [4..14]~~ 'set pins to output outa [EnablePin] := 1 'enable pin high waitcnt(clkfreq * 2 + cnt) 'wait 2 seconds to allow LCD to poweron (may not be needed) ''Inst_Mode 'register select to low for instruction register outa [RsPin] := 0 ''---initialize LCD outa [7..14] := %00001111 'show cursor, set blinking ToggleEnable outa [7..14] := %00000001 'cursor home Line 1 ToggleEnable outa [7..14] := %00111000 'Enable 2 lines ToggleEnable ''Char_Mode 'register select to low for instruction register outa [RsPin] := 1 '' Hello World outa [7..14] := %01001000 'H ToggleEnable outa [7..14] := %01100101 'e ToggleEnable outa [7..14] := %01101100 'l ToggleEnable outa [7..14] := %01101100 'l ToggleEnable outa [7..14] := %01101111 'o ToggleEnable outa [7..14] := %00101100 ', ToggleEnable outa [7..14] := %00100000 'space ToggleEnable outa [7..14] := %01010111 'W ToggleEnable outa [7..14] := %01101111 'o ToggleEnable outa [7..14] := %01110010 'r ToggleEnable outa [7..14] := %01101100 'l ToggleEnable outa [7..14] := %01100100 'd ToggleEnable outa [7..14] := %00100001 '! ToggleEnable ''Inst_Mode outa [RsPin] := 0 outa [7..14] := %11000000 ' move Cursor to begining Line 2 ToggleEnable ''Char_Mode outa [RsPin] := 1 ''Prop outa [7..14] := %01010000 'P ToggleEnable outa [7..14] := %01110010 'r ToggleEnable outa [7..14] := %01101111 'o ToggleEnable outa [7..14] := %01110000 'p ToggleEnable outa [7..14] := %00100000 'space ToggleEnable outa [7..14] := %01101001 'i ToggleEnable outa [7..14] := %01110011 's ToggleEnable outa [7..14] := %00100000 'space ToggleEnable outa [7..14] := %01000001 'A ToggleEnable outa [7..14] := %01010111 'W ToggleEnable outa [7..14] := %01000101 'E ToggleEnable outa [7..14] := %01010011 'S ToggleEnable outa [7..14] := %01001111 'O ToggleEnable outa [7..14] := %01001101 'M ToggleEnable outa [7..14] := %01000101 'E ToggleEnable outa [7..14] := %00100001 '! ToggleEnable { --not used outa [7..14] := %01011001 'Y ToggleEnable outa [7..14] := %01100101 'e ToggleEnable outa [7..14] := %01110011 's ToggleEnable outa [7..14] := %00100000 'space ToggleEnable outa [7..14] := %01101000 'h ToggleEnable outa [7..14] := %01100101 'e ToggleEnable outa [7..14] := %00100000 'space ToggleEnable outa [7..14] := %01101001 'i ToggleEnable outa [7..14] := %01110011 's ToggleEnable outa [7..14] := %00100001 '! ToggleEnable outa [7..14] := %00100001 '! ToggleEnable } repeat 'keep cog active to pins don't float? (there may be a better way to do this PUB ToggleEnable outa [EnablePin] := 0 waitcnt(clkfreq / 500 + cnt) ' 1/500th second seems to be reliable - faster doesn't ' always work outa [EnablePin] := 1
Then after some research and trial and error - I came up with a hard coded output.
Future experiments:
1 - use shift register to reduce number of Prop's i/o pins
2 - refine code for more "object-like" use
3 - recreate daughter board approach using Propeller instead of original SX
Paul
Comments
1- The number of I/O pins can be reduced by using the 4 bit mode of the display
2- Pick any LCD HD44780 compatible driver from the ObjectExchange
3- What a waste of a prop ;o) Take the smallest available AVR for little money and it can do this.
Just want to say:
If you do it for the fun, fine. If you have other funnier or more challenging things to do, rather use the drivers from the object exchange and do the funnier things.
Important information outcome of this thread so far:
1. Yes, the parallax serial LCD uses a standard HD44780 compatible display.
2. Yes, the Prop is AWSOME ;o)
But now doggiedog knows the basics and unless he has some real new ideas about a driver I'd say it's now more like a waste of time to create another one. I also wrote a LCD driver, but only because I wanted to have one which is written in PASM and because I added some nice features ( for example 32x16 pixel graphics on the text LCD, screen buffer mode which comes handy if several COGs have to update content on the LCD ...) .
Exploration could now be shifted to using low level drivers like the one I have put to the obex.
Yes I wrote one too because one didn't exist. It uses a HC374 latch instead of driving the LCD directly. The memory part of the dracblade already existed and there was a data buss and an address buss, so the extra "cost" of adding an LCD driver was a 50c chip and no extra propeller pins. The temptation to write a driver was just too high when it didn't cost any pins at all, but the catch was that all the code had to be written from scratch, and also had to be combined with other pasm code in the same cog.
So I have experienced the thrill of seeing "hello world" appear on an LCD after days of coding. MagIO2 and doggiedoc belong to the same exclusive club. It is fun! KyeDos boots up using a VGA display and also the serial port and the 20x4 LCD display.
That sounds cool. How about looking at the HC595 - that ought to reduce it to 3 propeller pins.
@WBA Consulting - I do have a better understanding of how the LCD works. I saw the 4 bit mode in the datasheet and plan to explore that more. As for the toggle switches, that's exactly how I set it up on my PPDB (with DIP switches) at first to grasp out how to make it work. Very retro!
@Dr_Acula - I'll have to look at the datasheet on the HC374, but I don't have any of them. I have a lot of HC595s so I suspect I'll try those first. BTW, "Hello, World!" was really second. I coded it to print my name first!
Paul
Good work doggiedoc. Keep experimenting, and I will stay tuned.
Here is a JAVA app that I found that really helped my understanding of it.
Here is a link to the datasheet too. I don't understand all of it yet.
Paul
Thanks for the kind remarks Humanoido! It was very satisfying to get the LCD working again. I could actually use it in a project now. I am glad I didn't just toss it out!
Paul
The tiny88 costs 1.80usd, add a .28 xtal and run the free VUSB software
and add USB to it...
Don't use a prop for this, save the prop for something
more useful. There is 8k of flash on the tiny88 so you have lots of room to
handle a bunch of protocols for communicating with the lcd and still there
are enough I/O pins and mips to do several other things. You can turn a
2.50usd ebay 2 line lcd into a powerhouse with a tiny88 and bring it all in
for about 6 dollars including shipping...very frugal :-)
You don't need a circuit board, epoxy the tiny88 upside down on the back of the
lcd and do dead bug point to point wiring.
Paul
BTW - dead bug style is awesome!
About the first thing I ever did with a Prop was drive an LCD like that. Just to get the hang of things. The Props first ever CP/M prompt was on that LCD as I had no spare monitor at the time.
It is not exceptionally cheap at 15usd delivered but it is the first
of its type that I have seen that has an OLED type of display.
There is also a seller with a similar red colored 40x4 unit.
It is green chars on a black background.
http://cgi.ebay.com/OLED-Quality-looking-LCD-20x4-HD44780-Green-Black-/360332254456?pt=LH_DefaultDomain_0&hash=item53e579dcf8
But the best buy is still this 16x2 blue unit at 3.49usd delivered.
There used to be a seller offering this same unit at 3usd delivered.
http://cgi.ebay.com/HD44780-1602-16x2-LCD-Display-Module-Blue-Blacklight-/180627312453?pt=LH_DefaultDomain_0&hash=item2a0e3a0f45
Those OLED displays are stunning. I picked one up about 3 years ago on ebay and then all the ones at ebay prices disappeared for a while. Nice to see them back again. They are drop-in replacements for the LCD displays.