hi i have a problem with my school project, i cannot write to the lcd module....
i have a downloaded program for writing strings to the lcd....
pls take a look at this code because when i tried to run this prrogram the lcd was unable to display the string.
#include <dos.h>
#include <string.h>
#define PORTADDRESS 0x378
#define DATA PORTADDRESS+0
#define STATUS PORTADDRESS+1
#define CONTROL PORTADDRESS+2
void lcd_init(void);
void lcd_write(char char2write);
void lcd_puts(char * str2write);
void lcd_goto(int row, int column);
void lcd_clear(void);
void main(void)
{
lcd_init();
lcd_goto(1,1);
lcd_puts("Welcome To");
lcd_goto(1,0);
lcd_puts("My LIFE");
while(!kbhit() ) //wait until a key is pressed...
{}
}
void lcd_init()
{
outportb(CONTROL, inportb(CONTROL) & 0xDF);
outportb(CONTROL, inportb(CONTROL) | 0x08);
lcd_write(0x0f);
delay(20);
lcd_write( 0x01);
delay(20);
lcd_write( 0x38);
delay(20);
}
void lcd_write(char char2write)
{
outportb(DATA, char2write);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe */
delay(2);
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe */
delay(2);
}
void lcd_puts(char *str2write)
{
outportb(CONTROL, inportb(CONTROL) & 0xF7);
while(*str2write)
lcd_write(*(str2write++));
}
void lcd_goto(int row, int column)
{
outportb(CONTROL, inportb(CONTROL) | 0x08);
if(row==2) column+=0x40;
lcd_write(0x80 | column);
}
void lcd_clear()
{
outportb(CONTROL, inportb(CONTROL) | 0x08);
lcd_write(0x01);
}
pls help me....
the deadline of our project is this coming feb. 29....pls help me...
thanks....
i have a downloaded program for writing strings to the lcd....
pls take a look at this code because when i tried to run this prrogram the lcd was unable to display the string.
#include <dos.h>
#include <string.h>
#define PORTADDRESS 0x378
#define DATA PORTADDRESS+0
#define STATUS PORTADDRESS+1
#define CONTROL PORTADDRESS+2
void lcd_init(void);
void lcd_write(char char2write);
void lcd_puts(char * str2write);
void lcd_goto(int row, int column);
void lcd_clear(void);
void main(void)
{
lcd_init();
lcd_goto(1,1);
lcd_puts("Welcome To");
lcd_goto(1,0);
lcd_puts("My LIFE");
while(!kbhit() ) //wait until a key is pressed...
{}
}
void lcd_init()
{
outportb(CONTROL, inportb(CONTROL) & 0xDF);
outportb(CONTROL, inportb(CONTROL) | 0x08);
lcd_write(0x0f);
delay(20);
lcd_write( 0x01);
delay(20);
lcd_write( 0x38);
delay(20);
}
void lcd_write(char char2write)
{
outportb(DATA, char2write);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe */
delay(2);
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe */
delay(2);
}
void lcd_puts(char *str2write)
{
outportb(CONTROL, inportb(CONTROL) & 0xF7);
while(*str2write)
lcd_write(*(str2write++));
}
void lcd_goto(int row, int column)
{
outportb(CONTROL, inportb(CONTROL) | 0x08);
if(row==2) column+=0x40;
lcd_write(0x80 | column);
}
void lcd_clear()
{
outportb(CONTROL, inportb(CONTROL) | 0x08);
lcd_write(0x01);
}
pls help me....
the deadline of our project is this coming feb. 29....pls help me...
thanks....
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.