I'm trying to control an HD44780-based LCD in Proteus with 4-bit interface. The problem is that the simulation log gives me a series of messages, which I think means that I'm not sending the commands for initialization correctly.
The initialization code for the LCD is the following:
void Inicia_LCD4(unsigned short dato) /* Función para inicializar la*/
/* pantalla LCD. */
{
PORTD = 0;
retardo_ms(16);
E = 0;
retardo_us(5);
E = 1;
PORTD = 0x60 | 0x04;
retardo_us(5);
E = 0;
retardo_ms(10);
E = 1;
PORTD = 0x60 | 0x04;
retardo_us(5);
E = 0;
retardo_us(100);
E = 1;
PORTD = 0x60 | 0x04;
retardo_us(5);
E = 0;
retardo_us(100);
E = 1;
PORTD = 0x60 | 0x04;
retardo_us(5);
E = 0;
retardo_us(100);
E = 1;
PORTD = 0x20 | 0x04;
retardo_us(5);
E = 0;
retardo_us(100);
E = 1;
PORTD = 0x0c | 0x04;
retardo_us(5);
E = 0;
retardo_us(100);
E = 1;
PORTD = 0x60 | 0x04;
retardo_us(5);
E = 0;
retardo_us(100);
E = 1;
PORTD = 0x08 | 0x04;
retardo_us(5);
E = 0;
retardo_us(100);
E = 1;
PORTD = 0x60 | 0x04;
retardo_us(5);
E = 0;
retardo_us(100);
E = 1;
PORTD = 0x40 | 0x04;
retardo_us(5);
E = 0;
retardo_us(100);
E = 1;
PORTD = 0x60 | 0x04;
retardo_us(5);
E = 0;
retardo_us(100);
E = 1;
PORTD = 0x78 | 0x04;
retardo_us(5);
E = 0;
}
the simulation log result is the following:
Initial delta set to 2.5e-05
[HD44780] Set Function: bits=8, lines=1, dots=7 [LCD1]
[HD44780] Set Function: bits=8, lines=1, dots=7 [LCD1]
[HD44780] Set Function: bits=8, lines=1, dots=7 [LCD1]
[HD44780] Set Function: bits=8, lines=1, dots=7 [LCD1]
[HD44780] Set Function: bits=4, lines=1, dots=7 [LCD1]
[HD44780] Set DDRAM ptr = 03 [LCD1]
[HD44780] Set DDRAM ptr = 03 [LCD1]
[HD44780] Cursor left [LCD1]
and the pin assignment on my simulation is the following:
And of course I'm trying to copy this format:
How can I solve this problem?