Specifications

char temp;
u_char priority;
/* Set the thread priority to the highest */
priority = NutThreadSetPriority(10);
LCD_RS(1); // select the data register
LCD_E(1);
/* Select the high 4 bits of the data */
temp = (PORTE & 0xF0)+((data & 0xF0)>>4);
PORTE = temp; //load nibble
for ( count = lcddelay; --count;)
;
LCD_E(0); // strobe
for ( count = lcddelay; --count;)
;
LCD_E(1);
data = (PORTE & 0xF0)+(data & 0x0F); //low nibble
PORTE = data; //load nibble
for ( count = lcddelay; --count;)
;
LCD_E(0); // strobe
NutThreadSetPriority(priority);
}
/*
* CONTROL
* write the passed data to the LCD control register
*
*/
void control(unsigned char data)
{
unsigned char count;
LCD_RS(0); // select the control register
data &= 0x0F; // clear the high 4-bits
LCD_E(1);
count = PORTE & 0xF0; //keep high 4 bits of port
data += count;
PORTE = data; //load data
for ( count = lcddelay; --count;)
;
LCD_E(0); //strobe data to LCD
LCD_RS(1); // select the data register
}
//clears the screen
void clrscn(void)
{
92