I have a microcontroller (philips P89c51RD2) at 12MHz, reads data by serial port and shows them by display LCD. The problem is that when turn-on the circuit, sometimes the LCD does not work, as if microcontroller was not connected. The LCD shows the first and third row in black and second and fourth in white. I think that as the problem only sometimes happens, could be problem of time to initialisation of the LCD, but I have put a loop at the beginning of the program and the problem persists. I show the principle of the code, where the LCD is initialized.
void main(void) { . . . . for(i=0;i<6500;i++); config_RS232(); // ***** Init LCD ******* // for(i=0;i<40000;i++); lcd_reset(); for(i=0;i<40000;i++); lcd_reset(); for(i=0;i<6500;i++); // ************ // . . .