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++); // ************ // . . .
The problem is that when turn-on the circuit, sometimes the LCD does not work sounds like a uC reset problem to me. Do you know that it is the LCD, not the uC ? and if you "know" what makes you "know"? Erik
As Erik points out, it sounds as if you have a power up hardware problem. Does your LCD have a backlight? If so, does the backlight come on with power up? Many backlights are powered by a small charge pump that can suck down the VCC/VDD lines for millsecs while the MCU is resetting in microsecs. The brute force approach to prove this is to extend your sample delay loops way out into the millsec ranges for testing only. Bradfrod