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.

Problems with programming for Hitachi 44780U LCD display

Status
Not open for further replies.

anupriya

Newbie level 5
Joined
Nov 30, 2004
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
103
lcd 16x4 comandos de linea

hai everybody,
i am programming for lcd display HITACHI 44780U with 8051
in 4bit mode in c ,in that i have
ddram pointer addr=0x80
line1 0x00
line2 0x40

now if the user is only giving the position
and the character to display. the char as 'c' and
the position 5th then how can i calculate
the position and display,(even the line number will not be provided)

plz help
 

lcd display

Hi,

What's the size of the LCD display?
2x16 4x16 4x20 2x40?

Write a small routine that writes an X to all of the
positions slowly (wait 1 sec between them) and
you will see how the LCD screen is aligned.
(First it'll fill the first line than the second (or on
4x20 for example the third line) etc.
And then u can write your routine: if the user
writes to position 5 in the line 3 than it will be the
21. char position in the LCD's buffer(for a 2x16 one)
or vica versa.

Hope it helps,
Zed
 

    anupriya

    Points: 2
    Helpful Answer Positive Rating
Re: lcd display

hai every body,
i am connecting the bd7 to db4 lines to the lcd,and i need to send
the upper 4bits first and then the lower 4bits next
then if my instr is 0x38 then its binary equivalent is 0011 1000.
so the upper 0011 should be send first so its P3=0x38>>4;
and P3=(0x38&0x0F)
am i correct.
 

lcd display

It's not really clear (at least for me) what is your question?

In 4 bit mode only the lower 4 bits of data lines
and the other control lines (CE etc) connected.

Yes you should latch the upper than the lower
nibble.
But you should set 4 bit mode prior transfering
4 bit nibbles. (It's easy that's a 4 bit command too,
it should be sent first.)

Zed
 

Re: lcd display

First in a C program, you must write Routines like... (this is a routine for a 16X4 LCD)

void LCDSetXY(INT8U row, INT8U col)
{
INT8U pos; /* Variable temporal posición */


if (row < LCD_MAX_ROW && col < LCD_MAX_COL) {
/* Si la pantalla está en rango */
LCDSel(LCD_RS_LOW); /* Cambia a línea de comandos */
switch (row) { /* Decide que línea */
case LCD_ROW0: /* Si es la línea 0 */
pos = LCD_ROW0_OFFSET; /* Posiciona offset de línea 0 */
break; /* romper */
case LCD_ROW1: /* Si es la línea 1 */
pos = LCD_ROW1_OFFSET; /* Posiciona offset de línea 1 */
break; /* Romper */
case LCD_ROW2: /* Si es la línea 2 */
pos = LCD_ROW2_OFFSET; /* Posiciona offset de línea 2 */
break; /* Romper */
case LCD_ROW3: /* Si es la línea 3 */
pos = LCD_ROW3_OFFSET; /* Posiciona offset de línea 3 */
break; /* Romper */
} /* Fin de la decisión múltiple */
LCDWr(pos+col); /* Mueve hacia la fila-columna */
} /* Sal de la condicional */
}

void LCDWrChar(INT8U data)
{ /* Escribe un caracter */
LCDSel(LCD_RS_HIGH); /* Cambia a escritura */
LCDWr(data); /* Escribe caracter */
} /* Retorna */



void LCDSel(BOOLEAN cmd)
{ /* Selecciona modo esc./com. */
if (cmd == LCD_RS_HIGH) /* Si cmd es modo escritura */
LCD_RS_PORT |= (1 << LCD_RS_PIN); /* Selecciona modo de escritura */
else
LCD_RS_PORT &= ~(1 << LCD_RS_PIN); /* Selecciona modo de comandos */
}



void LCDWr(INT8U data)
{ /* Escribe caracter o comando */
#if LCD_8BIT_MODE_EN
LCD_DATA_PORT = data; /* Manda el dato/comando */
#else
LCD_DATA_PORT = (data & 0xF0) + (LCD_DATA_PORT & 0x0F);
/* Manda el dato/comando */
#endif
LCD_E_PORT |= (1 << LCD_E_PIN); /* Levanta Enable */
delayNus(5,1); /* Retarda +1us */
LCD_E_PORT &= ~(1 << LCD_E_PIN); /* Baja Enable, reconoce inst. */
delayNus(5,60);
#if LCD_8BIT_MODE_EN

#else
LCD_DATA_PORT = ((data & 0x0F)<<4) + (LCD_DATA_PORT & 0x0F);
LCD_E_PORT |= (1 << LCD_E_PIN); /* Levanta Enable */
delayNus(5,1); /* Retarda +1us */
LCD_E_PORT &= ~(1 << LCD_E_PIN); /* Baja Enable, reconoce inst. */
#endif
delayNus(5,60); /* Retarda +40us */
}


void LCDWrXY(INT8U row, INT8U col, INT8U data)
{ /* Escribe en la posición X-Y */
if (row < LCD_MAX_ROW && col < LCD_MAX_COL) {
/* Si está entre los límites */
LCDSetXY(row, col); /* Posiciona fila-columna */
LCDWrChar(data); /* Escribe caracter */
} /* Sale de la condicional */
} /* Retorna */
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top