VFD - HD44780 Parallel Port

From MythTV Official Wiki
Revision as of 16:58, 6 November 2010 by Wagnerrp (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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

Your very first step should be to install the 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 useful.

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

Here is the abbreviated 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 bells 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 LCDd.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:

  1. /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/utilities>setup>appearance and configure Myth to use the LCD display. Again Issac, I bow my head. :)

Hope this helps.