<br/>
/******************************************************************************
* Name:    LCDD_Initilise
******************************************************************************/
    void LCDD_Initialise()
    {
        RS = 0;	        // write control bytes
        E  = 0;
        DelayMs(15);	// power on delay
        PORTB = 0x30;	// attention!
        ECLOCK();
        DelayMs(5);
        ECLOCK();
        DelayUs(100);
        ECLOCK();
        DelayMs(5);
        PORTB = 0x20;	// set 4 bit mode
        ECLOCK();
        DelayUs(40);
        LCDD_WriteCommand(0x28);	// 4 bit mode, 1/16 duty, 5x8 font
        LCDD_WriteCommand(0x08);	// display off
        LCDD_WriteCommand(0x0F);	// display on, blink curson on
        LCDD_WriteCommand(0x06);	// entry mode
        DelayMs(5);
        LCDD_WriteCommand(DispCLR);
        LCDD_WriteCommand(RetHome);
        LCDD_WriteCommand(DispON);
    }
/******************************************************************************
* Name:    LCDD_WriteData
******************************************************************************/

void LCDD_WriteData(byte nibbles)
{
    RS = HI;    // indicating data
    PORTB = (PORTB & 0x0f) | (nibbles & 0x0f0);
    ECLOCK();
    DelayMs(1);
    PORTB = (PORTB & 0x0f) | (nibbles << 4);// output lower 4 bits
    ECLOCK();
    DelayMs(1);
}
/******************************************************************************
* Name:    LCDD_WriteString
******************************************************************************/

void LCDD_WriteString(const register byte *s)
{
    while(*s) 
    {
        LCDD_WriteData(*s++);
        DelayMs(1);
    }
}

/******************************************************************************
* Name:    ECLOCK
******************************************************************************/

void ECLOCK(void)
{
    DelayUs(1);			// tas delay 
    E = HI;			// for write cycle only
    DelayUs(2);
    E = LOW;
    DelayUs(1);
}   

/******************************************************************************
*       function that clears the screen
******************************************************************************/
void LCDD_Cls()
{
    LCDD_WriteCommand(DispCLR);
    LCDD_WriteCommand(RetHome);
}

/******************************************************************************
* Name:    LCDD_GotoDispPos
******************************************************************************/

void LCDD_GotoDispPos(unsigned char dd)
{
    LCDD_WriteCommand(dd);
}
