This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Difference between making P1 I/O or sending data on it

I want to assign value 0x0f to port P1 of 8051(which is to be configured as an output port).

If I give the instruction
P1 = 0x00

it assigns P1 as output port. Now suppose I want to out data 0x0f on it, then will the subsequent instruction
P1 = 0x0f
out the required data on P1 or will it again initialise the P1 pins 0-3 as input and pins 4-7 as output pins?

How can we distinguish whether the statement is assigning data on the output port or initialising port as input/output?

Regards,

Mohit

0