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.

lcd16x2 data lines with shifting bits

Status
Not open for further replies.

embedded_galaxy

Newbie level 4
Joined
Sep 12, 2015
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
79
hi,

i am working on 16x2 lcd with 4bit mode on pic18f. my connections are as follows :

  • RS -RA5
  • E - RA4
  • D4 - RA3
  • D5 - RA2
  • D6 - RA1
  • D7 - RA0

so my shifting bits are as follows :

Code:
	/* First  nibble */
	E_BIT_HIGH; // E to HIGH
	udelay(2);
	// Write data
	LATA = ((LATA & 0x0F) | ((cmd & 0xF0)));

	/* Second nibble */
	// E to HIGH
	LCD_E_BIT_HIGH;
	udelay(2);
	// Write data
	LATA = ((LATA & 0x0F) | (cmd &0x0F)>>4);

is the right way?
is shifting of bits are ok with my data lines connections(D4-D7,RA3-RA0)?

my other configuration for lcd is OK(code is work fine with different data line connections).

is D0-D3 must connected to gnd?

ASAP


thanks
 
Last edited by a moderator:

Hi,

is LATA is your data to be send to LCD?

if yes then in your code you are only sending lower 4 bits (LATA & 0x0F).

you can try like this:

low |= (Data&(0x0F));
temp |= (Data >> 4);
high |= temp;
LcdSend(high);
LcdSend(low);

Amit
 

thanks for your reply ,

but i am sending command to both lower and higher nibble.

normally lcd is connected to suppose :


RS -RA5
E - RA4
D4 - RA0
D5 - RA1
D6 - RA2
D7 - RA3

but my hardware have following connections :


RS -RA5
E - RA4
D4 - RA3
D5 - RA2
D6 - RA1
D7 - RA0

is there anything different shifting sequence is required?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top