Since the ports are bit addressable on an 8051, can I make some bits of a port inputs and some bits outputs by writing ones and zeros to them.
Example:
Will the following make bits 0,2,4 and 6 of P1 an input and bits 1,3,5 and 7 output bits?
ORG 030H
SETB P1.0 ;Make P1.0 an input bit
CLR P1.1 ;Make P1.1 an output bit
SETB P1.2 ;MAKE P1.2 AN INPUT BIT
CLR P1.3 ;MAKE P1.3 AN OUTPUT BIT
SETB P1.4 ;MAKE P1.4 AN INPUT BIT
CLR P1.5 ;MAKE P1.5 AN OUTPUT BIT
SETB P1.6 ;MAKE P1.6 AN INPUT BIT
SETB P1.7 ;MAKE P1.7 AN OUTPUT BIT
END
If the above is true then will the following acomplish the same thing?
ORG 030H
MOV P1,#AAH
END
Example:
Will the following make bits 0,2,4 and 6 of P1 an input and bits 1,3,5 and 7 output bits?
ORG 030H
SETB P1.0 ;Make P1.0 an input bit
CLR P1.1 ;Make P1.1 an output bit
SETB P1.2 ;MAKE P1.2 AN INPUT BIT
CLR P1.3 ;MAKE P1.3 AN OUTPUT BIT
SETB P1.4 ;MAKE P1.4 AN INPUT BIT
CLR P1.5 ;MAKE P1.5 AN OUTPUT BIT
SETB P1.6 ;MAKE P1.6 AN INPUT BIT
SETB P1.7 ;MAKE P1.7 AN OUTPUT BIT
END
If the above is true then will the following acomplish the same thing?
ORG 030H
MOV P1,#AAH
END