Hello!
I'm starting to know a bit better the AtMega328P and for that I'm trying to interface it with an HD44780 compatible 20x4 LCD.
My problem so far is that I'm not sure about the correct timing sequence that I need to implement on my code to make things work.
From the time diagram from datasheet on page 58, I need:
RS = 0 //instruction mode RW = 0 //write mode E = 1 send 4 MSB of the byte delay(1us)
But at this point I'm not sure what comes next. Do I need to set E = 0 and another delay of 1uS and then set E = 1 again to send the 4 LSB of the bye and finally another delay of 1 uS?
I mean:
RS = 0; RW = 0; E = 1; sendByte(0x28);//the 0x28 is just for ilustration purposes _delay_us(1); E = 0; _delay_us(1); E = 1; sendByte(0x28 << 4); _delay(1); E = 0; _delay_us(1); _delay_ms(2);//time needed to process the command
or :
RS = 0; RW = 0; E = 1; sendByte(0x28);//the 0x28 is just for ilustration purposes _delay_us(1); sendByte(0x28 << 4); _delay(1); E = 0; _delay_ms(2);//time needed to process the command
Or are both version wrong? I'm struggling to understand this procedure!