Your email is sent! Thanks!
Please enter a valid email.
Your email failed. Try again later.
Caution:Make sure that 5V and GND lines are properly connected otherwise you may end up in damaging parallel port.
If you want backlight than connect pin 15 of LCD to 5V and pin 16 of LCD to GND. By adjusting 10k resistor make pin 3 of LCD at 0V. If connection are proper you will see this after power on.
1.Make R/W low
2.Make RS=0 ;if data byte is command
RS=1 ;if data byte is data (ASCII value)
3.Place data byte on data register
4.Pulse E (HIGH to LOW)
5.Repeat the steps to send another data byte
This is the pit fall for beginners.Proper working of LCD depend on the how the LCD is initialized. We have to send few command bytes to initialize the lcd. Simple steps to initialize the LCD
1.Specify function set:
Send 38H for 8-bit,double line and 5x7 dot character format.
2.Display On-Off control:
Send 0FH for display and blink cursor on.
3.Entry mode set:
Send 06H for cursor in increment position and shift is invisible.
4. Clear display:
Send 01H to clear display and return cursor to home position.
NOTE:One must refer the datasheet of LCD to get the proper time delay and required sequence.
Major hurdle in accessing parallel port in Windows Xp is the knowledge of using inpout32 files.
Download : Driver files
Now save inpout32.dll and port.dll in system32 folder in windows directory.We will use certain subroutine provided by these dll files in our VB6 code.Open new project in VB6 and create the form as shown below.
Set the max length of two text boxes to 16.Create "Start" and "Clear" command button.Add visual basic code to form.
Dim data As Variant
Private Sub Clear_Click()LowRsOut Val(&H378), Val(1) ' function to send data to parallel portEnabletxtlcd1.Text = " " ' line 1 for LCDtxtlcd2.Text = " " ' line 2 for LCDEnd Sub
Private Sub Start_Click()Out Val(&H37A), Val(Inp(&H37A) And &HDF)lcd_intLCDWriteString txtlcd1.Textnext_line ' function to set cursor to second lineLCDWriteString txtlcd2.TextEnd Sub
Sub LowRs()Out Val(&H37A), Val(Inp(&H37A) Or &H8) ' Rs LowEnd Sub
Sub LowEn()Out Val(&H37A), Val(Inp(&H37A) Or &H1) ' En LowEnd Sub
Sub HighRs()Out Val(&H37A), Val(Inp(&H37A) And &HF7) ' Rs HighEnd Sub
Sub HighEn()Out Val(&H37A), Val(Inp(&H37A) And &HFE) ' En HighEnd Sub
Sub lcd_write(data%)HighRsOut Val(&H378), Val(data)EnableEnd Sub
Sub next_line()LowRsOut Val(&H378), Val(&HC0)EnableEnd Sub
Sub lcd_int() 'subroutine to initialize LCDLowRsOut Val(&H378), Val(&H38)EnableLowRsOut Val(&H378), Val(&HC)EnableLowRsOut Val(&H378), Val(&H6)EnableLowRsOut Val(&H378), Val(&H1)EnableEnd Sub
Sub Enable()DELAYUS 20000HighEnDELAYUS 2000LowEnDELAYUS 2000End Sub
' function to send ASCII character one by one to LCDPublic Sub LCDWriteString(ByVal OutStr As String)Dim i As Integer 'write a string to LCDFor i = 1 To Len(OutStr)lcd_write (Abs(Asc(Mid(OutStr, i, 1))))Next iEnd Sub
Now go to Project>Add Module .Select inpout4.bas and port.bas
1.Press F5 to run the program
2.Write the text you want to display on the LCD in the textboxes
3.Click "Start" command button.
4.You will see that the same text appears on LCD as shown in the textboxes.
5.To send other text click "Clear" command button and repeat the same procedure.
Acceptance of ignorance is true path of knowledge -Pujya Dadashri
© 2009 LCD Interfacing.