LCD INTERFACING WITH PARALLEL PORT This tutorial is taken from the book
MY EXPERIENCE IN PARALLEL PORT INTERFACING.
you can download it free from the files
section(file:-parallelport(3 files) of
yahoo group-booksbybibinhttp://groups.yahoo.com/group/booksbybibin/
comments about this book on
www.booksbybibin.blogspot.comLCD DISPLAY
Here I am using a 16X2 LCD display available for
around Rs.140. The LCD JHD162A
More tutorials about LCD is available on the following links
http://www.roboticsindia.com/modules.php?name=News&file=print&sid=75http://www.beyondlogic.org/parlcd/parlcd.htmhttp://www.eio.com/lcdintro.htmhttp://home.iae.nl/users/pouweha/lcd/lcd0.shtml#hd44780http://ee.cleversoul.com/lcd_project.html
See the commands from the first link and see the program.
#include"bparlib.c"
#define Set_Enable Set_ControlPort_bit(2)
#define Clear_Enable Clear_ControlPort_bit(2)
#define Write_Lcd Clear_ControlPort_bit(1)
#define Read_Lcd Set_ControlPort_bit(1)
#define Select_InstructionRegister Clear_ControlPort_bit(0)
#define Select_DataRegister Set_ControlPort_bit(0)
#define Data_Lcd(a) Write_DataPort(a)
void main()
{
char string[] = {"BIBIN JOHN"};
char init[10];
int len,i;
init[0] = 0x01; /* Init Display */
init[1] = 0x38; /* Clear Display */
init[2] = 0x0c; /* Dual Line / 8 Bits */
init[3] = 0x06;
init[4] = 0x80;
/*clearing all bits of control port*/
for(i=0;i<4;i++)
Clear_ControlPort_bit(i);
Select_InstructionRegister;
for(i=0;i<5;i++)
{
Data_Lcd(init[i]);
Set_Enable;
delay(30);
Clear_Enable;
delay(30);
}
Select_DataRegister;
len=strlen(string);
for (i=0; i< len;i++)
{
Data_Lcd(string[i]);
Set_Enable;
delay(30);
Clear_Enable;
delay(30);
}
}
first select the instruction register to write these following commands. See the table of
commands
init<0> = 0x01;
init<1> = 0x38;
init<2> = 0x0c;
init<3> = 0x06;
init<4> = 0x80;
0x01 is used to clear display
0x38 for 2 lines and 8 bits
0x0c
0x06
0x80 is the CRA Address Corresponds to the cursor address. This is the main thing
you should do first
Now select the data register and write the data you want to send. Delays should be
proper for the display to set.
The following program writes some data into the LCD which will remain stored in the
RAM of LCD
TROUBLESHOOTING:
1. Make the LCD ON by varying the contrast. You vary the potentiometer knob so
that the contrast will vary and you will get dark matrix on the screen.
2. Reduce the contrast so that dark dot's of less intensity will be seen.
3. Now run the program, check for parallel port troubleshooting.
4. The delay inserted in the program should be sufficient.
5. The CRA address should be correct.
Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.