LCD 4x16

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LCD 4x16

8,883 Views
ppcco
Contributor I
I need connect an LCD 4x16, hitachi compatible, with HC908QB8 and works fine at 8 bits mode, but, I want connect it in 4 bits mode, but in this conditions the display don't work (display is blank), with the variables
 
#define LCD_8BIT          0x10   /* LCD de 8 bit                                    */
#define LCD_4BIT          0x00   /* LCD de 4 bit                                    */
used in line ( LCDinit () )
 
LCDWr(0x20|LCD_8BIT|LCD_2LINE|LCD_5X11); /* Mode 8bits, 2 lines, 5X7 pt */
 
I can change 8 or 4 bits mode, so in line
 
#define LCD_DATA_OUTPUT 0xFF    /* Pins to use in LCD (0xFF 8bits / 0x0F 4bits)               */
in theory, must be works fine but doesn't.
 
attach the code, hope somebody can help me.
 
Regards.
 
Francisco
Labels (1)
0 Kudos
5 Replies

626 Views
Santa
Contributor I
I don't remember the exact behaviour, but you must tell the LCD that you are going to use 4 bits or 8 bits in the data bus. So your inicialization routine for the LCD must take this into account. Also chech the LCD datasheet because I remeber seeing that when in 4 bit mode the pins used are the highr 4, and from your code I can see you are using the lower 4. Check the datasheet again and please post again if you did not find the info.

Santa

Message Edited by Santa on 2006-08-17 08:51 AM

0 Kudos

626 Views
ppcco
Contributor I
I'm confused, if write 0xFF the 8 bit mode is selected, correct?, if write 0x0F is wrong? must be 0xF0 and reconect the higher 4 bits to D4, D5, D6 and D7 in LCD?, (in this moment I'm out of my lab, when return I'll do these modofications), thanks
 
Regards,
 
Francisco
0 Kudos

626 Views
bigmac
Specialist III

Hello Francisco,

Here is the LCD initialisation sequence that I have previously used following power-up, in order to use 4-bit mode -

Clear RS line
Set nybble value to 0 (D4-D7)
Pulse EN line
Wait 5ms
Pulse EN line
Wait 5ms
Set nybble value to 2
Pulse EN line
Wait 5ms

Command bytes can now be sent, in high nybble/low nybble sequence, to set the display for 4-bit mode, set the number of display lines, and determine the other display and cursor characteristics required.

Further display interface details can be found in AN1774 "Interfacing the MC68HC912B32 to an LCD Module".

Regards,
Mac

 

0 Kudos

626 Views
eckhard
Contributor V
Hello,

you have to connect the hger 4 data bts of the display und then you must do two write cycles in 4 bit mode to write a byte. So writing 0xff is two times a write of 0xf0.

Eckhard
0 Kudos

626 Views
ppcco
Contributor I
Thanks a lot, the display is working OK, the problem was wrong sent nibbles, nice job, thanks
0 Kudos