write a program for auto baud rate i.e change the baud rate automatically using lpc2138 arm
Why would we do that?
the new fashion, is, so it seems, to copy-paste homework questions... The DATASHEET clearly explains how to use auto-baudrate!
Actually, I think NXP tend to divide their chip documentation into what they call a "Datasheet" and what they call a "User Manual":
What they call a "Datasheet" usually just gives electrical, timing, and mechanical specifications;
What they call a "User Manual" describes the operation of the chip - including such things as how to use auto-baudrate...
As always, one should take time to familiarise oneself with all the documentation provided by the manufacturer - that will include Application Notes, examples, etc...