Example #1
0
void lcd_send_byte(int8 address, int8 n){

	RSPIN=0;

#ifdef USE_RW
	while((lcd_read_byte()&0x80)==0x80);
#else
	_delay_100us();
#endif

	TRIS_DATA_PIN_4=0;
	TRIS_DATA_PIN_5=0;
	TRIS_DATA_PIN_6=0;
	TRIS_DATA_PIN_7=0;

	if(address)
		RSPIN=1;
	else
		RSPIN=0;

	Nop();

#ifdef USE_RW
	RWPIN=0;
	Nop();
#endif

	lcd_send_nibble(n >> 4);
	lcd_send_nibble(n & 0xf);
}
Example #2
0
void LCDinit(void)
{
   PORTA = 00;         // Clear Control port
   LATA = 00;         // and its corresponding Latch
   TRISA = 0x01;         // Make PORTA as output port
   ADCON1 = 0x0E;     // Make PORTA as digitital I/O
   // This is done here assuming application code may be using PORTA of Analog application.

   _delay(4);         //
   _delay(4);          //
   _delay(4);         //~15 ms delay


   WriteNibble(0x30);  // #1 control byte
   _delay(4);

   WriteNibble(0x30);  // #2 control byte

   _delay_100us();


   WriteNibble(0x30);  // #3 control byte
   _delay_100us();

   WriteNibble(0x20);  // #4 control sets 4 bit mode
   _delay_100us();

   Check_LCDBusy();    // Check whther LCD is free to continue operation

   FunctionSet(0x28);   // #5 control byte Function set

   DisplayON (0x0D);    // Turn on Display

   DisplayClr (0x01);    // Clear Display (clears junk if any)

   EntryMode(0x06);   // Entry mode selection

   DDRAMadrs(0x80);   // Initialise DDRAM address to 80h.

}                  // LCD Init ends
void lcd_send_byte(int8 address, int8 n){

	RS_PIN=0;

	_delay_100us();


	TRIS_DATA_PIN_4=0;
	TRIS_DATA_PIN_5=0;
	TRIS_DATA_PIN_6=0;
	TRIS_DATA_PIN_7=0;

	if(address)
		RS_PIN=1;
	else
		RS_PIN=0;

	Nop();


	lcd_send_nibble(n >> 4);
	lcd_send_nibble(n & 0xf);
}