I used the code below and i m able to send characters to it but when...sending long texts it wont show up on the whole screen of the lcd 2x16...i have to write a scrolling function can anyone help please...
This is the code
Code:
#include <dos.h>
#include <string.h>
#define PORTADDRESS 0x378 /* Port Address Here */
#define DATA PORTADDRESS+0
#define STATUS PORTADDRESS+1
#define CONTROL PORTADDRESS+2
void main(void)
{
char string[] = {"Testing 1,2,3 "
"It' Works ! "};
char init[10];
int count;
int len;
init[0] = 0x0F; /* Initialise Display */
init[1] = 0x01; /* Clear Display */
init[2] = 0x38; /* Dual Line / 8 Bits */
init[3] = 0x1C; /* Shift the entire display to the right (aris) */
outportb(CONTROL, inportb(CONTROL) & 0xDF); /* Reset Control Port - Make sure Forward Direction */
outportb(CONTROL, inportb(CONTROL) | 0x08); /* Set Select Printer (Register Select) */
for (count = 0; count <= 2; count++)
{
outportb(DATA, init[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe (Enable)*/
delay(20); /* Larger Delay for INIT */
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe (Enable)*/
delay(20); /* Larger Delay for INIT */
}
outportb(CONTROL, inportb(CONTROL) & 0xF7); /* Reset Select Printer (Register Select) */
len = strlen(string);
for (count = 0; count < len; count++)
{
outportb(DATA, string[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe */
delay(2);
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe */
delay(2);
}
}