Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Interfacing Lcd with pic16f877A

Status
Not open for further replies.

Clone_X

Newbie level 2
Joined
Feb 13, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,289
hey guys im using hitec c in ma projects...and i wanna know how to change the lcd.c file that comes with hitec c samples to use with following pin configuration...

RD4-LCD_DATA BIT 4

RD5-LCD_DATA BIT 5

RD6-LCD_DATA BIT 6

RD7-LCD_DATA BIT 7
 

Try changing these two lines

Code:
/* write a byte to the LCD in 4 bit mode */

void lcd_write(unsigned char c)
  {
  __delay_us(40);
  LCD_DATA = ( ( c >> 4 ) & 0x0F );	//LCD_DATA = ( c & 0xF0 ); ?????? CHANGE
  LCD_STROBE();
  LCD_DATA = ( c & 0x0F );		//LCD_DATA = ( ( c << 4 ) & 0xF0  ); ?????? CHANGE    
  LCD_STROBE();
  }

And change these

Code:
/* initialise the LCD - put into 4 bit mode */

void lcd_init()
  {
  char init_value;
  
  ADCON1 = 0x06;	// Disable analog pins on PORTA

  init_value = 0x3;	//init_value = 0x30; ?????? CHANGE
  TRISA=0;
  TRISD=0;
  LCD_RS = 0;
  LCD_EN = 0;
  LCD_RW = 0;
	
  __delay_ms(15);	// wait 15mSec after power applied,
  LCD_DATA	 = init_value;
  LCD_STROBE();
  __delay_ms(5);
  LCD_STROBE();
  __delay_us(200);
  LCD_STROBE();
  __delay_us(200);
  LCD_DATA = 2;	// Four bit mode		//LCD_DATA = 0x20; ?????? CHANGE
  LCD_STROBE();

  lcd_write(0x28); // Set interface length
  lcd_write(0xF); // Display On, Cursor On, Cursor Blink
  lcd_clear();	// Clear screen
  lcd_write(0x6); // Set entry Mode
  }
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top