how to convert uart c51 code to lpc1788 code
Read datassheet/application notes/sample applications.
Write code.
Test.
Correct/reset.
Per Westermark (c) 2012
What, exactly, do you mean by "uart c51 code"?
There are some basic principles that apply to any UART - irrespective of the specific device; eg,
* UARTs are much slower than CPUs, so you have to wait for one transmission/reception to complete before starting another - commonly achieved with polling or interrupts
* UARTs have to be correctly configured to match whatever they're talking to - baud rate, parity, etc
Code that deals directly with 8051 registers is highly unlikely to be of any use on the LPC - so just refer to LPC documentation for how to handle its UART at the register level.
Similarly, you will have to study the LPC documentation for how its interrupts work.
Above the register/interrupt level, the detail becomes irrelevent - the code should not be specific to any particular chip.
If the 8051 code is well written, it should have functions like getchar(), putchar() and some configuration functions - so you should just be able to replace them without affecting the rest of the code.
IF the 8051 code is not well written, you have to ask yourself whether it's worth converting it at all...