Information adding for Controlling 16×2 LCD Module


Here is some code that will help you connect a LCD module to Parallel port of a computer.
Almost any 16×2 LCD module should work. It has complete VB6 code. It works on Windows XP very well. I have used hwinterface.ocx from Logix4u.net that provides basic Inport and OutPort functionality (Thanks to them, made the work lot more fun).

Requirements:
a) Parallel Port connector
b) LCD Module
c) Power supply (5V, 50mA should be ok)
d) hwinterface.ocx downloadable from the net, free. (Visit logix4u.net for more info)

You will have to connect the LCD to Parallel port. Pin map is given below. You can get this info from several other locations on the net.

LCD – ParallelPort
RS – Pin 17
R/W – Gnd
E – Pin 1
D7-D0 – Pin8-Pin2

Other connections to LCD include back lit and contrast control. See LCD manual for details.

Copy the hwinterface.ocx to c:\windows\System32
From start menu, click on Run
In the text box key in the following
regsvr32 c:\windows\system32\hwinterface.ocx
You should get a message saying registered successfully.

Create a new project in VB6. Add a form.
Add required controls (text1, text2, text3, command1 and command2)
Add the code snippet as appropriate.

LPT port is generally located at 0x378. However, it may be moved to other ports as well. For example, on my laptop, it is located on 0x3BC. If in doubt, go to device manager and look for resources used by LPT.

Run the application (VB6)

Keyin the port number (in hex format itself). Click on command1 button to initialize the LCD. You should immediately see Welcome in text1 and ABCE… in text2. LCD module will also contain the exact same data displayed.

You can keyin any thing in text1 or text2. It is copied to LCD Module.

If in doubt, mail me. You can also contact me at udaywali@cquad.co.in

Happy interfacing!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s