#include <p18cxxx.h>
#include "xLCD_PicDem2.h"
#include <Delays.h>

#define PIC_Osc_MHz  4	// ## Set Crystal.Osc Speed ***
#include "XLCD_Subs_DWD.c"

/**************************************************/
void set_clr_line_XLCD( char line )
{
char ln, x;

if (line==2) ln = 0xC0;
else         ln = 0x00;

while( BusyXLCD() ); 
SetDDRamAddr( ln );   // set line

for (x=0; x<16; x++)  // clear line
	{
	while( BusyXLCD() ); 
	WriteDataXLCD(' ');		// write a blank
	}

while( BusyXLCD() ); 
SetDDRamAddr( ln );   // set back to beginning of line
return;
}

//====================================================
void main ( void )
{
ADCON1 = 0x0E;  // **** Make PORTA Digital except AN0
DelayPORXLCD();

OpenXLCD( FOUR_BIT & LINES_5X7 );
WriteCmdXLCD( DON & CURSOR_OFF & BLINK_OFF );

set_clr_line_XLCD( 1 );
while( BusyXLCD() ){};
putrsXLCD( "Hello Maxwell" );

set_clr_line_XLCD( 2 );
while( BusyXLCD() ){};
putrsXLCD( "Does it Work?" );

while( 1 ){};
}
