WAIT_LCD:

CLR EN             ;Start LCD command
CLR RS             ;It's a command
SETB RW            ;It's a read command
MOV DATA,#0FFh     ;Set all pins to FF initially
SETB EN            ;Clock out command to LCD
MOV A,DATA         ;Read the return value
JB ACC.7,WAIT_LCD  ;If bit 7 high, LCD still busy
CLR EN             ;Finish the command
CLR RW             ;Turn off RW for future commands
RET
