| ??? 02/02/08 10:43 Read: times |
#150207 - Thanks, but still doesnt work Responding to: ???'s previous message |
You are right about the or part, I guess I was tired :|
It still showing 1 lit line as before. About the timeing, I use much more space than needed to make sure that it won't be a timing issue. The code is now:
void E_clk() {
delay_ms(1);
LCD_E =0;
delay_ms(1);
LCD_E=1;
delay_ms(1);
LCD_E =0;
}
void main() {
unsigned int i;
//Toggle led
for (i = 0; i < 2; i++) {
P2_7 = 1;
delay_ms(50);
P2_7 = 0;
delay_ms(50);
}
//Power on
//Wait more than 15 msecs after power is applied.
delay_ms(40);
LCD_RS = 0; //instructions
LCD_BUS_PORT = 0x30;
E_clk();
delay_ms(10);
LCD_BUS_PORT = 0x30;
E_clk();
LCD_BUS_PORT = 0x30;
E_clk();
LCD_BUS_PORT = 0x20;
E_clk();
//0x28 (4Bit mode,2Lines,Small font)
LCD_BUS_PORT = 0x20;
E_clk();
LCD_BUS_PORT = 0x80;
E_clk();
//0x08 (Display off)
LCD_BUS_PORT = 0x00;
E_clk();
LCD_BUS_PORT = 0x80;
E_clk();
//0x01 (Clear the display) - Takes more than normal time
LCD_BUS_PORT = 0x00;
E_clk();
LCD_BUS_PORT = 0x10;
E_clk();
delay_ms(10);
//0x06 (Entry mode - no shifting, auto increase)
LCD_BUS_PORT = 0x00;
E_clk();
LCD_BUS_PORT = 0x60;
E_clk();
while(1);
}
|



