PICDEM™ 17 Demonstration Board User’s Guide
DS39024B-page 50 2001 Microchip Technology Inc.
#else // Lower nibble
interface
TRIS_DATA_PORT &= 0xf0; // Make port output
DATA_PORT &= 0xf0; // and write upper
nibble
DATA_PORT |= (((DDaddr | 0b10000000)>>4) & 0x0f);
#endif
RW_PIN = 0; // Set control bits
RS_PIN = 0;
DelayFor18TCY();
E_PIN = 1; // Clock the cmd and
address in
DelayFor18TCY();
E_PIN = 0;
#ifdef UPPER // Upper nibble
interface
DATA_PORT &= 0x0f; // Write lower nib-
ble
DATA_PORT |= ((DDaddr<<4)&0xf0);
#else // Lower nibble
interface
DATA_PORT &= 0xf0; // Write lower nib-
ble
DATA_PORT |= (DDaddr&0x0f);
#endif
DelayFor18TCY();
E_PIN = 1; // Clock the cmd and
address in
DelayFor18TCY();
E_PIN = 0;
#ifdef UPPER // Upper nibble
interface
TRIS_DATA_PORT |= 0xf0; // Make port input
#else // Lower nibble
interface
TRIS_DATA_PORT |= 0x0f; // Make port input
#endif
#endif
return;
}
/
*******************************************************************
*
* Function Name: BusyXLCD
* Return Value: char: busy status of LCD controller
* Parameters: void
* Description: This routine reads the busy status of the
* Hitachi HD44780 LCD controller.
*******************************************************************
*/
unsigned char BusyXLCD(void)
{
RW_PIN = 1; // Set the control
bits for read
RS_PIN = 0;
DelayFor18TCY();
E_PIN = 1; // Clock in the com-
mand