The General Idea
To send a command to the LCD, we send the high order nibble of the command byte to output 00, the RS line stays low, and we strobe the E line to clock in the nibble. Then we send the low order nibble out to port 0 and strobe the E line again. Finally, we sit through a delay long enough to make sure the LCD has completed the command before we go on.
The MAG-85 Gets Talkative. And Multi-Lingual.
To send data to the LCD, we do the same thing but with the RS line held high the whole time.
Before any of this happens, we need to initialize the LCD. This is not a simple thing, and is one of the frustrations many hobbyists have with the 44780 controlled LCDs. Once it is mastered, however, it's not so bad. The hobbyists who master it start adding LCDs to everything. I think I have one on my toothbrush now.
Here's the process:
Reset Sequence:Power On: wait at least 15mS for the LCD to do its internal reset. Send a "3" (just one nibble). Wait at least 7mS. Send a "3" again. Wait at least 180uS. Send another "3". Wait at least 72uS. Send a "2". Wait at least 72uS.
Reset Sequence Complete.
Start LCD Configuration CommandsSend a "2", then immediately send an "8". (Our first command, set 4-bits, 2 lines.) Wait at least 72uS. Send a "0", then send a "6". (Second command, Entry Mode Set.) Wait at least 2.93mS. (Entry mode set is a slow command.) Send a "0" then an "F". (Third command: Display, Cursor, Blink ON.) Wait at least 72uS. Send a "0" then a "1". (Fourth command, Clear Display.) Wait at least 2.93mS. (Another slow command.) Send an "8" then a "0". (Fifth command, Set data address to start.) Wait at least 72uS.
Initialization Complete, LCD Ready for Data
Code Listing for LCD Test
The code is listed here. Enter it carefully into your memory and try out the LCD. If it gives you gobbledygook instead of nice characters, that's no worse than I got on my first test. Check your wiring, check your software. If all looks good, try extending the delays in the software. You may have a particularly slow display. Getting the delays right was what gave me trouble at first. My procedure works with my display, and has been designed to work with any comparable display, but some displays have controllers that are a bit different from the run of the mill variety.
If at all possible, get the datasheet for your specific display and make sure that the initialization sequence is the same for yours.
If you get nothing, check that your potentiometer has been adjusted so that the characters are visible. When the display has power but has not been initialized (leave your 8085 in /RESET after power up), adjust the potentiometer to make solid blocks just visible in the top row of the display. The second row won't show anything, it's turned off by default.
And again, check wiring and your data. If your power supply and Reset circuits aren't stable enough, the NOVRAM can be corrupted.