LCD - HD44780 Parallel Port

From MythTV Official Wiki
Revision as of 18:04, 15 August 2006 by Lozzo81 (talk | contribs)

Jump to: navigation, search

LCD gotchas on Mini ITX boards

The Epia SP13000 motherboard uses a 3.3volt interface for the parallel port in common with many laptop and 'all-in-one' motherboards. This causes a problem when trying to drive a HD44780 type of LCD - random bit changes, sometimes it works, sometimes it don't!!

This is my solution.

First of all, I installed all the LCDproc software and set it up for the ncurses display. This can then be used to fine tune the selection of items to display before getting the hardware to work it can be set up as the same size (rows and columns) as the real hardware. This proved to be very useful during debugging as its often not known if its the software or the hardware that's failing.

A piece of strip board was used to mount a couple of hex level shifter chips type 4504. These chips are quite happy only having 3volts or so input but will drive the 5volt display inputs and still meet the timing requirements of the HD44780 display (and its clones).

Since I'm using a line of 6 push buttons as a keypad on the LCD interface, I put all the parts associated with that (a few resistors) on the same board.

To make maintenance simple, I used ribbon cable connectors on the strip board with one going to the parallel port (the internal connections are a 26 way IDC Berg strip on the ITX motherboard), one to the display (which usefully has two rows of pins just right for a ribbon connector), one to the push buttons and a floppy power connector for the 5volts the level shifter chips required.

The output from the parallel port that is used to drive the LED backlight goes via a power transistor as the display I'm using uses about 200mA - way to much for any sort of buffer chip!

How do I include a picture here? - worth a 1000 words... => Try [[Image:TestPicture.png]] after uploading the image from the toolbox (left) "Upload file"

TestPicture.png

That means a circuit diagram as well!

VFD Display Via Parallel Port on the Ahanix D.Vine 5 Case With Redhat EL4

As with the above description your very first step should be to install the wonderful LCDproc software, which works with MythTV wonderfully. The Ahanix D.Vine 5 (and presumably some others) uses a VFD type display. This looks great in a HTPC, aside from being usefull.

I've had my case for about a year now and am only now getting around to setting it up..

Here is the abreviated LCDd.conf I'm using for my VFD:

[server]
Driver=HD44780
Bind=127.0.0.1
Port=13666
ReportLevel=5
ReportToSyslog=yes
WaitTime=5
User=nobody
ServerScreen=no
Foreground=no
#Hearbeat=open
Heartbeat=off
#InitialHeartbeat=slash
#Backlight=open
#InitialBacklight=on
BacklightBrightness=255
BacklightOffBrightness=0

[input]

[HD44780]
Port=0x378
ConnectionType=winamp
Keypad=no
Backlight=no
#Size=16x2
Size=18x3
DelayMult=4
DelayBus=true

You'll notice a few odd things, mainly the Size settings. The Dvine.5 VFD is actually a 16x2 character display, however I was getting garbage characters at the top right row and on screens such as the TV screen (channel, program info) I was getting garbage all along the bottom row. To "correct" this I added 2 characters to the top line (garbage is at least off the visible screen) and added an additional line to the display (garbage down below the visible display). I know this is cludgy and I'd love to hear the proper solution, but hey, it works.

The next annoying feature is a proper init script, or lack of. I'm using RHEL4. Not only are there no packages available (yes, I'm lazy) but the included init script doesn't work, at least with my version of Redhat. So I've put together a init script that should get your LCDd daemon started nicely, with all the regular bell and whistles. Isaac, I love your work feel free to add this to the scripts. I imagine it would help a lot of RHEL/CENTOS/WHITEBOX/TOAS/ETC users get things going nicely. I'm not init script guru, but this seems to work reliably and as expected:

#!/bin/sh
#
# chkconfig: - 91 35
# description: Starts and stops the LCDd daemon \
#              used to provide LCDd display services.
#
# config:  /etc/LCDd.conf


# Source function library.
if [ -f /etc/init.d/functions ] ; then
  . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
  . /etc/rc.d/init.d/functions
else
  exit 0
fi

# Avoid using root's TMPDIR
unset TMPDIR

# Source networking configuration.
. /etc/sysconfig/network

if [ -f /etc/sysconfig/LCDd ]; then
   . /etc/sysconfig/LCDd
fi

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# Check that LCDd.conf exists.
[ -f /etc/LCDd.conf ] || exit 0

RETVAL=0


start() {
        KIND="LCDd"
        echo -n $"Starting $KIND services: "
        daemon LCDd -c /etc/LCDd.conf
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/LCDd || \
           RETVAL=1
        return $RETVAL
}

stop() {
        KIND="LCDd"
        echo -n $"Shutting down $KIND services: "
        killproc LCDd
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/LCDd
        echo ""
        return $RETVAL
}

restart() {
        stop
        start
}

reload() {
        echo -n $"Reloading smb.conf file: "
        killproc LCDd -HUP
        RETVAL=$?
        echo
        return $RETVAL
}

rhstatus() {
        status LCDd
}


# Allow status as non-root.
if [ "$1" = status ]; then
       rhstatus
       exit $?
fi

# Check that we can write to it... so non-root users stop here
[ -w /etc/LCDd.conf ] || exit 0



case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  reload)
        reload
        ;;
  status)
        rhstatus
        ;;
  condrestart)
        [ -f /var/lock/subsys/LCDd ] && restart || :
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}"
        exit 1
esac

exit $?

You'll need to copy that file to /etc/init.d/LCDd then from within the /etc/init.d directory run: chmod 755 LCDd

After you've done that you can verify that its working buy running: /etc/init.d/LCDd restart

You should see it fail to stop (assuming its not running already) and then succeed in starting.

If all that goes as planned the last step is to set it up to start at boot. To do this we use the trusty chkconfig command as follows:

  1. chkconfig --add LCDd
  2. chkconfig LCDd on

Thats it.

You can double check that its there and ready to run if you'd like by running:

  1. chkconfig --list | less

And scrolling through all the startup scripts.

That really should be it. Once the VFD is working all you need to do is go into setup>setup>appearance and configure Myth to use the LCD display. Again Issac, I bow my head. :)

Hope this helps.