Can anyone tell me how to configure ports for input/output
The Datasheet for your particular device will tell you any specific details;
Information general to the 8051 architecture can be found in the so-called "bible" for the 8051: www.8052.com/.../120112
See also: www.8052.com/.../120176
8051/2 Tutorials: http://www.8052.com/tutorial
And, of course, look on the website of the manufacturer!