Lcd controller; connect 20×4 character LCD to parallel port

I use the Alix-1D motherboard for embedded applications, with Puppy Linux OS and Gambas2 visual Basic IDE. It’s very easy to connect an LCD character display to the parallel port of the motherboard. There is a PIN STRIP connector, named J14, that provides all the signals for the parallel port. In my application I used the Hitachi LM044L display connected to the board in this way:

schematic diagram of display connections

schematic diagram of display connections

  • DB7..DB0 – Data bus, connected to ‘D7..D0’ of LCD
  • /STB – Strobe, connected to ‘E’ of LCD
  • /SCI – Slct-in, connected to ‘WE’ of LCD
  • /AFD – Auto-LF, connected to ‘RS’ of LCD
  • GND – Signal ground, connected to ‘VSS’ of LCD
  • The +5V supply can be taken from pin 4 of connector J15

lcd20x4picThe downloadable file puppy_gambas_lcd.tar.gz contains the whole project folder with sources for Gambas2. This is a minimal working implementation; you have two buttons on the form: the first is for display initialization / clear, the second writes an incrementing character each time you click it, every time moving to next available LCD cursor position.

Install Puppy Linux (on Alix-1D motherboard or other)

I am a typical Windows user, but in first months of 2011, I decided to switch to Linux. This page will be intended as a short report of my experiences in this job. Sometimes a little problem requires a huge amount of time to be solved, expecially if you don’t have the right tools. Switching to Linux can be, sometimes, a little bit frustrating, ‘cause your “usual” win instruments are still present, but in a different form or name. I hope the tips and tricks you can find here will be useful for shorting the “switching time” if you are doing the giant leap to the open source world.

The “Alix-1D” is a compact mini-ITX motherboard with VERY low power consumption, based on AMD Geode chipset ; infos about the board can be obtained at this link . The hard disk can be a normal IDE 2.5″ or a compact flash memory (there is an on-board connector) and the 256 MBytes RAM is mounted directly on the board. If you use a Compact Flash memory as main mass storage, the Puppy Linux is the best choice, ‘cause it can be set to run entirely in RAM ; the access to disk will be limited and the life of the Compact Flash memory may be long.

So, let’s start to install ; this is a step-by-step operations list using a Windows PC to create a Linux based Alix PC.

1) Get the Unetbootin program from the Internet at this link . This tool can install an ISO file on USB memory key and makes it BOOTABLE.
2) Get the Puppy Linux 4.2 retro ISO file from the Internet at this link  or the Puppy Linux 4.3.1 retro from this other link . Both versions are based on kernel k2.6.21.7 that runs fine on Geode chipset.
3) Also get the MD5 (checksum) file for the the 4.2 version from this link or the 4.3.1 version from this link . Both are text files, so they will probably open directly as text in your browser ; in this case, click on the right mouse button and choose “save target as” for download.
4) Get the HP DiskOnKey USB disk storage format tool from this link (or search an alternative on Google).
5) Get the HashTab program from this link . This program integrates the Windows shell and, after installing, you have a new feature on the mouse right click : you can compute the MD5 verification code for any file.

Well, you have, now, all that you need -as software- for starting the job ; please, install the HashTab and the HP Format tool programs ; the Unetbootin program doesn’t need to be installed, it is already executable.
As first operation, right click the downloaded ISO file to verify the MD5 check code. The HashTab has added to your ‘right click’ menus the MD5 computation tool, so copy the MD5 code from the *md5.txt file and paste in the verify box ; if the checksum is good, a green ‘V’ will appear, so the downloaded file is correct (see below).

Now, the hardware ; you just need for an USB memory key (at least 128 MBytes size) and, obviously, for a compact flash or a 2.5″ IDE hard disk to connect to the motherboard.
Let’s go with a Compact Flash memory, cause is “compact” and fits directly in the motherboard’s socket; a 512 MBytes or 1 GByte size will be enough for a small system.

1) Format your USB memory key with the HP tool, specifying the FAT file system ; the boot option isn’t needed (see below).

2) Start the Unetbootin program and select the Puppy Linux ISO file you just downloaded from the Internet ; wait for end of operations and not restart the Windows system now.

3) Remove the USB key from the Windows system and put it in the Alix board.
4) Turn ON the Alix board and go into the BIOS, Advanced Features, and select
the USB drive as the first boot device, then restart.
5) After a while, you can see on your screen a selection box for what option to start ; choose Puppy and go on.
6) You will be requested for mouse type (PS/2, USB or RS232), for keyboard layout and for video mode. Select the appropriate keyboard and language for you and Xvesa for video.
7) After a while the splash screen (and dog bark) will appear, at typical 800×600
screen size. Accept it or change (better) to 1024×768, 16 bit colors.

Now you have a fresh Puppy Linux Live OS working. You can play with it or start the installation on hard disk (the Compact Flash in this case).
Puppy Linux has very powerful install feature and many useful tools, all this in about 100 MBytes of ISO file !
Note that Puppy Linux is less “paranoic” than other Linux distros. This means that you start as superuser (root) and without any password. Naturally, you can set your own user and password if you really need them.
In the Alix-1D case, and generally in embedded applications, the need for a severe security feature is inexistent, so the “Puppy way” to operate is good and smart.

Go on installing OS onto the compact flash disk.

Now.. you’re running your Puppy Linux from USB memory key. It’s time to install to hard disk ; in this example we use a Transcend 512MB Compact Flash, rated for 80x access data speed (normally used for photo cameras).

1) From ‘menu’ select : System -> GParted partition manager ; this launches the disk partition program. From the disk selection choose the hda internal drive and click Ok. If the Compact Flash was never formatted before, probably there is a fat16 default space of about 500 Mb named as /dev/hda1. Click on the box (the contour becames dotted) then choose : Partition -> Delete ; confirm clicking on ‘apply’. Now there is only unallocated space. Click the box (as usual the contour becames dotted) and select : Partition -> New, then leave all fields as default (Primary Partition, ext2) and click ‘Add’, then confirm with ‘apply’. Now, close the partition manager.
2) From ‘menu’ select : Setup -> Puppy universal installer ; this starts the Puppy installation on the hard disk. Select Internal (IDE or SATA) hard drive as destination and confirm the following box with hda installed disk.
3) Click the small dog with ‘install Puppy to hda1:’, then OK. At this point the program asks for location of installation files. There is a selection with two buttons: CD and DIRECTORY ; your files are on USB key, so you must click on the desktop icon called ‘sda1’ (that looks like a usb memory key drive) to make it available (mounted). Note that Puppy likes a single click, not double, for many operations (it can be changed, obviously). Now the sda1 is mounted (a green dot appeared on it) and a window opens with the contents of /mnt/sda1 directory. Well, close that window and choose DIRECTORY for the install files location. The installer now shows a file selection dialog ; on the left panel, double click ‘../’, then ‘mnt/’, then ‘sda1/’ ; on the right panel, now, double click the initrd.gz file.
4) The installer asks now for selection for FRUGAL or FULL install; choose FULL and the installer will start copying files from the USB disk drive. This will require some minutes… so, please wait patiently (don’t do anything else on the system) until next box appears !
5) When the installer has finished to copy files, it asks for the GRUB installation. The GRUB is  the boot manager for the system ; it can boot your PC from external drive or will reside on  the MBR of your internal disk. In my opinion, this is the better way to use it on the Alix motherboard system, so click ‘install/update GRUB’, ignoring ‘Boot from USB’. Next box will ask for ‘UPDATE’ or ‘INSTALL’, choose ‘INSTALL’ and confirm with ‘OK’. Again a box, with ‘simple’ or ‘expert’ mode, choose ‘simple’ ( it’s simpler ! ) , then on next message choose ‘standard’. Next box asks for GRUB location ; leave it as is (/dev/hda1) and confirm clicking ‘OK’. The last selection, now : where the GRUB start sector has to be stored. Choose ‘MBR’ and click ‘OK’; click again OK on the next message box, leaving blank the text field.
6) If all is gone right, you can see now the GRUB INSTALL SUCCESS message ; click ‘OK’ and when the program goes to next message, proposing to redo the operation, click ‘NO’. Finished.
7) Verify, now, if the GRUB is OK. Single click on the desktop icon hda1 to mount it ; the contents of directory ‘/mnt/hda1’ is shown. Click on ‘boot’, then ‘grub’, then ‘menu.lst’. The ‘Geany’ text editor will open the grub menu file for editing. If you see a line with text ‘title Windows (on /dev/sda1)’, then you have a problem. The grub installer thinks you have a Windows OS installed on the HD and has set the option to boot that, not Puppy ; in this case, follow next steps to force the Puppy Linux booting :
a) remove all file lines (empty file)
b) write next lines :

timeout 3
title Puppy Linux (on /dev/hda1)
root (hd0,0)
kernel /boot/vmlinuz root=/dev/hda1 ro
boot
title – For help press ‘c’, then type ‘help’
root (hd0)

c) save the modified menu.lst and close the editor
8) From ‘menu’, select : Shutdown, then click the shutdown button. The program asks for saving your options (mouse, keyboard etc..) but your answer will be ‘NO’. I suggest to do this way ‘cause you still have to set some option in the freshly installed Puppy.
9) Your Alix PC is now turned OFF ; remove the usb key and power-on it again.

Your Puppy Linux will start and run from the Compact Flash drive. You will be asked again for mouse, keyboard and video, but this is the last time.
Note that you have over 188 MBytes free for your programs on the 512 MBytes CompactFlash disk !

Enjoy Puppy Linux !