2001 Microchip Technology Inc. DS39024B-page 51
LCD.C Description
DelayFor18TCY();
#ifdef BIT8 // 8-bit interface
if(DATA_PORT.7) // Read bit 7 (busy
bit)
{ // If high
E_PIN = 0; // Reset clock line
RW_PIN = 0; // Reset control
line
return 1; // Return TRUE
}
else // Bit 7 low
{
E_PIN = 0; // Reset clock line
RW_PIN = 0; // Reset control
line
return 0; // Return FALSE
}
#else // 4-bit interface
#ifdef UPPER // Upper nibble
interface
if(DATA_PORT&0x80)
#else // Lower nibble
interface
if(DATA_PORT&0x08)
#endif
{
E_PIN = 0; // Reset clock line
DelayFor18TCY();
E_PIN = 1; // Clock out other
nibble
DelayFor18TCY();
E_PIN = 0;
RW_PIN = 0; // Reset control
line
return 1; // Return TRUE
}
else // Busy bit is low
{
E_PIN = 0; // Reset clock line
DelayFor18TCY();
E_PIN = 1; // Clock out other
nibble
DelayFor18TCY();
E_PIN = 0;
RW_PIN = 0; // Reset control
line
return 0; // Return FALSE
}
#endif
}
/
*******************************************************************
**
* Function Name: ReadAddrXLCD
* Return Value: char: address from LCD controller
* Parameters: void
* Description: This routine reads an address byte from the
* Hitachi HD44780 LCD controller. The user