I wanted to know if after i give power to micro controller and before the software starts executing what is the state of output ports? Will it be in uninitialized state or in some logic high or logic low and also can i control the states of these ports?
Look on the page that give the Register File Addresses/Summary you will see a "value on POR,BOR at the end.
Status at Power on Reset.
The first thing in the program or routine is set the status to how you need them.
Max.
The datasheet is your best bet, The 1802 had input and output posts and some were configurable.
"Generally" with configurable ports, they may be in a high Z state. The ULN2003 was/is a good way to interface to ports because unconnected the "relay" was off, a low resulted in the relay off and a high resulted in the relay being on. TTL floated high.
they should be in high-Z state before your program sets them to input or output...but they often are not, they can be in any random state sometimes. I have had this out with microchip before but to no avail
I had a single board system (not PIC) that would not work reliably with a linear power supply. Worked fine with a switching supply.
Fix was to change a chip to a Schmidt trigger version that fed the reset pin from an RC network. I think it was from a lack of a clean edge.
they should be in high-Z state before your program sets them to input or output...but they often are not, they can be in any random state sometimes. I have had this out with microchip before but to no avail
As I posted recently, there is at least one 18F micro (18F4431) where the setting of certain pins at POR depends from your election at configuration time. Surely there are more.
The op said after applying power and before software runs.
The reset on the micro will take an amount of time, during which the state of the o/p pins may be unknown, check the datasheet.