JH162A LCD initialise problem with at89s52: Showing black box
you havent cleared lcd. it has previous data stored in it sometimes. please clear it by sending it 01 like " lcdcmd(0x01);" also use a command "lcdcmd(0x06);" to shift the cursor to right.
increase the delay from " delay(50) to delay(250)"
i have simulated this in proteus. whenever i give that clear command (01h) , nothing is displayed on simulator. but without it, simulator display is fine. But practically, that LCD is giving black boxes in lab.
you try it using clear command and increase the delay as well. also you need to shift the cursor to right.
here is my modified code but nothing shows in simulator.
lcd requires some time to execute the commands so after a command we need to either give it a delay or we can check the busy flag.the crystal frequency is ok. in your program delay(250) is appropriate for lcd.
i have run the c code and assembly code for lcd, and both displays data on lcd. you also check your connections.
will try today and let u know after college
If nothing could be seen on the lcd, sometimes it happens because of over brightness. put a variable resistor in series with pin15 of the lcd, not less than 1k. Do the changes mentioned by Mehtab ali in his post. Try changing the resistance after running the code.